30
30
31
31
#include "nxcodec.h"
32
32
33
+ /****************************************************************************
34
+ * Pre-processor Definitions
35
+ ****************************************************************************/
36
+
37
+ #define NXCODEC_VER "1.00"
38
+
39
+ #define NXCODEC_WIDTH 640
40
+ #define NXCODEC_HEIGHT 480
41
+
33
42
/****************************************************************************
34
43
* Private Data
35
44
****************************************************************************/
@@ -53,17 +62,17 @@ static const struct option g_long_options[] =
53
62
54
63
static void usage (FAR const char * progname )
55
64
{
56
- printf ("Usage: %s [options]\n\n"
57
- "Version 1.3\n"
65
+ printf ("NxCodec Version: " NXCODEC_VER "\n"
66
+ "Usage: %s -d devname -s [wxh] -f [informt] "
67
+ "-i infile -f [outformat] -o outfile\n"
68
+ "Default settings for decoder parameters\n\n"
58
69
"Options:\n"
59
70
"-d | --device Video device name\n"
60
71
"-s | --size Size of stream\n"
61
72
"-h | --help Print this message\n"
62
73
"-f | --format Format of stream\n"
63
74
"-i | --infile Input filename for M2M devices\n"
64
- "-o | --outfile Outputs stream to filename\n\n"
65
- "eg: nxcodec -d /dev/video1 -s 256x144 \
66
- -f H264 -i input.h264 -f YU12 -o output.yuv\n" ,
75
+ "-o | --outfile Outputs stream to filename\n" ,
67
76
progname );
68
77
69
78
exit (EXIT_SUCCESS );
@@ -86,7 +95,16 @@ int main(int argc, FAR char **argv)
86
95
0
87
96
};
88
97
89
- memset (& codec , 0 , sizeof (codec ));
98
+ /* Default settings for decoder parameters */
99
+
100
+ codec .output .format .fmt .pix .width =
101
+ codec .capture .format .fmt .pix .width = NXCODEC_WIDTH ;
102
+
103
+ codec .output .format .fmt .pix .height =
104
+ codec .capture .format .fmt .pix .height = NXCODEC_HEIGHT ;
105
+
106
+ codec .output .format .fmt .pix .pixelformat = V4L2_PIX_FMT_H264 ;
107
+ codec .capture .format .fmt .pix .pixelformat = V4L2_PIX_FMT_YUV420 ;
90
108
91
109
while (1 )
92
110
{
@@ -133,8 +151,11 @@ int main(int argc, FAR char **argv)
133
151
snprintf (codec .output .filename ,
134
152
sizeof (codec .output .filename ), "%s" , optarg );
135
153
136
- codec .output .format .fmt .pix .pixelformat =
154
+ if (cc [0 ])
155
+ {
156
+ codec .output .format .fmt .pix .pixelformat =
137
157
v4l2_fourcc (cc [0 ], cc [1 ], cc [2 ], cc [3 ]);
158
+ }
138
159
break ;
139
160
140
161
case 'o' :
@@ -143,8 +164,11 @@ int main(int argc, FAR char **argv)
143
164
snprintf (codec .capture .filename ,
144
165
sizeof (codec .capture .filename ), "%s" , optarg );
145
166
146
- codec .capture .format .fmt .pix .pixelformat =
167
+ if (cc [0 ])
168
+ {
169
+ codec .capture .format .fmt .pix .pixelformat =
147
170
v4l2_fourcc (cc [0 ], cc [1 ], cc [2 ], cc [3 ]);
171
+ }
148
172
break ;
149
173
150
174
default :
@@ -153,12 +177,6 @@ int main(int argc, FAR char **argv)
153
177
}
154
178
}
155
179
156
- if (argc != optind )
157
- {
158
- printf ("Too few input parameter!\n\n" );
159
- usage (argv [0 ]);
160
- }
161
-
162
180
ret = nxcodec_init (& codec );
163
181
if (ret < 0 )
164
182
{
0 commit comments