Skip to content

Commit 69a56e7

Browse files
yangsen5xiaoxiang781216
authored andcommitted
system/nxcodec: modify print usage
Signed-off-by: yangsen5 <[email protected]>
1 parent b3a4246 commit 69a56e7

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

system/nxcodec/nxcodec_main.c

+32-14
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@
3030

3131
#include "nxcodec.h"
3232

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+
3342
/****************************************************************************
3443
* Private Data
3544
****************************************************************************/
@@ -53,17 +62,17 @@ static const struct option g_long_options[] =
5362

5463
static void usage(FAR const char *progname)
5564
{
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"
5869
"Options:\n"
5970
"-d | --device Video device name\n"
6071
"-s | --size Size of stream\n"
6172
"-h | --help Print this message\n"
6273
"-f | --format Format of stream\n"
6374
"-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",
6776
progname);
6877

6978
exit(EXIT_SUCCESS);
@@ -86,7 +95,16 @@ int main(int argc, FAR char **argv)
8695
0
8796
};
8897

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;
90108

91109
while (1)
92110
{
@@ -133,8 +151,11 @@ int main(int argc, FAR char **argv)
133151
snprintf(codec.output.filename,
134152
sizeof(codec.output.filename), "%s", optarg);
135153

136-
codec.output.format.fmt.pix.pixelformat =
154+
if (cc[0])
155+
{
156+
codec.output.format.fmt.pix.pixelformat =
137157
v4l2_fourcc(cc[0], cc[1], cc[2], cc[3]);
158+
}
138159
break;
139160

140161
case 'o':
@@ -143,8 +164,11 @@ int main(int argc, FAR char **argv)
143164
snprintf(codec.capture.filename,
144165
sizeof(codec.capture.filename), "%s", optarg);
145166

146-
codec.capture.format.fmt.pix.pixelformat =
167+
if (cc[0])
168+
{
169+
codec.capture.format.fmt.pix.pixelformat =
147170
v4l2_fourcc(cc[0], cc[1], cc[2], cc[3]);
171+
}
148172
break;
149173

150174
default:
@@ -153,12 +177,6 @@ int main(int argc, FAR char **argv)
153177
}
154178
}
155179

156-
if (argc != optind)
157-
{
158-
printf("Too few input parameter!\n\n");
159-
usage(argv[0]);
160-
}
161-
162180
ret = nxcodec_init(&codec);
163181
if (ret < 0)
164182
{

0 commit comments

Comments
 (0)