From: Xiang, Haihao Date: Mon, 26 Nov 2012 08:00:37 +0000 (+0800) Subject: mpeg2enc: add --mode option to command line X-Git-Tag: libva-1.2.0~93 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07f6782e7e1b406e021c6b1cda893929c23d2db1;p=platform%2Fupstream%2Flibva.git mpeg2enc: add --mode option to command line Usage: --mode <0|1|2> 0 means I frames only 1 means I and P frames 2 means I, P and B frames Signed-off-by: Xiang, Haihao --- diff --git a/test/encode/mpeg2enc.c b/test/encode/mpeg2enc.c index f5f9b46..dd81742 100644 --- a/test/encode/mpeg2enc.c +++ b/test/encode/mpeg2enc.c @@ -74,6 +74,7 @@ struct mpeg2enc_context { /* args */ int rate_control_mode; int fps; + int mode; /* 0:I, 1:I/P, 2:I/P/B */ int width; int height; int frame_size; @@ -500,6 +501,7 @@ usage(char *program) fprintf(stderr, "where options include:\n"); fprintf(stderr, "\t--cqp const qp mode with specified \n"); fprintf(stderr, "\t--fps specify the frame rate\n"); + fprintf(stderr, "\t--mode specify the mode 0 (I), 1 (I/P) and 2 (I/P/B)\n"); } static void @@ -512,6 +514,7 @@ parse_args(struct mpeg2enc_context *ctx, int argc, char **argv) {"help", no_argument, 0, 'h'}, {"cqp", required_argument, 0, 'c'}, {"fps", required_argument, 0, 'f'}, + {"mode", required_argument, 0, 'm'}, { NULL, 0, NULL, 0 } }; @@ -558,6 +561,7 @@ parse_args(struct mpeg2enc_context *ctx, int argc, char **argv) ctx->fps = 30; ctx->qp = 28; ctx->rate_control_mode = VA_RC_CQP; + ctx->mode = 1; optind = 5; @@ -597,6 +601,16 @@ parse_args(struct mpeg2enc_context *ctx, int argc, char **argv) break; + case 'm': + tmp = atoi(optarg); + + if (tmp < 0 || tmp > 2) + fprintf(stderr, "Waning: MODE must be 0, 1, or 2\n"); + else + ctx->mode = tmp; + + break; + case '?': fprintf(stderr, "Error: unkown command options\n");