History

In libx264 wrapper, add -level specific option.

Baptiste Coudurier committed 15 years ago

Commit f92b0081 parent 37c0a441 file · +13 −3Browse files

Unified · Split

libavcodec/libx264.c+13−3
@@ -38,6 +38,7 @@ typedef struct X264Context { · 37 unmodified lines
3838 const char *preset;
3939 const char *tune;
4040 const char *profile;
41+ const char *level;
4142 int fastfirstpass;
4243 } X264Context;
4344
@@ -163,6 +164,15 @@ static av_cold int X264_close(AVCodecContext *avctx) · 119 unmodified lines
163164 return 0;
164165 }
165166
167+#define OPT_STR(opt, param) \
168+ do { \
169+ if (param && x264_param_parse(&x4->params, opt, param) < 0) { \
170+ av_log(avctx, AV_LOG_ERROR, \
171+ "bad value for '%s': '%s'\n", opt, param); \
172+ return -1; \
173+ } \
174+ } while (0); \
175+
166176 static av_cold int X264_init(AVCodecContext *avctx)
167177 {
168178 X264Context *x4 = avctx->priv_data;
@@ -249,9 +259,6 @@ static av_cold int X264_init(AVCodecContext *avctx) · 80 unmodified lines
249259 x4->params.analyse.i_trellis = avctx->trellis;
250260 x4->params.analyse.i_noise_reduction = avctx->noise_reduction;
251261
252− if (avctx->level > 0)
253− x4->params.i_level_idc = avctx->level;
254−
255262 x4->params.rc.b_mb_tree = !!(avctx->flags2 & CODEC_FLAG2_MBTREE);
256263 x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor);
257264 x4->params.rc.f_pb_factor = avctx->b_quant_factor;
@@ -295,6 +302,8 @@ static av_cold int X264_init(AVCodecContext *avctx) · 37 unmodified lines
295302 (float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size;
296303 }
297304
305+ OPT_STR("level", x4->level);
306+
298307 if (x4->fastfirstpass)
299308 x264_param_apply_fastfirstpass(&x4->params);
300309
@@ -361,6 +370,7 @@ static const AVOption options[] = { · 60 unmodified lines
361370 {"tune", "Tune the encoding params", OFFSET(tune), FF_OPT_TYPE_STRING, 0, 0, 0, VE},
362371 {"fastfirstpass", "Use fast settings when encoding first pass", OFFSET(fastfirstpass), FF_OPT_TYPE_INT, 1, 0, 1, VE},
363372 {"profile", "Set profile restrictions", OFFSET(profile), FF_OPT_TYPE_STRING, 0, 0, 0, VE},
373+ {"level", "Specify level (as defined by Annex A)", OFFSET(level), FF_OPT_TYPE_STRING, 0, 0, 0, VE},
364374 { NULL },
365375 };
366376

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t