aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2011-04-19 16:12:13 -0700
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2011-04-19 16:12:13 -0700
commitf92b0084c0e02b3c816a9eb234c548487acadae8 (patch)
tree958df17d47c86cd65c9e39530d5cd64b58b79be4 /libavcodec
parent37c0a443f9aa01fcf33215b3cde06961f1e9df5c (diff)
downloadffmpeg-f92b0084c0e02b3c816a9eb234c548487acadae8.tar.gz
In libx264 wrapper, add -level specific option.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/libx264.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 0ef42cd9ad..29c535c5bc 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -38,6 +38,7 @@ typedef struct X264Context {
const char *preset;
const char *tune;
const char *profile;
+ const char *level;
int fastfirstpass;
} X264Context;
@@ -163,6 +164,15 @@ static av_cold int X264_close(AVCodecContext *avctx)
return 0;
}
+#define OPT_STR(opt, param) \
+ do { \
+ if (param && x264_param_parse(&x4->params, opt, param) < 0) { \
+ av_log(avctx, AV_LOG_ERROR, \
+ "bad value for '%s': '%s'\n", opt, param); \
+ return -1; \
+ } \
+ } while (0); \
+
static av_cold int X264_init(AVCodecContext *avctx)
{
X264Context *x4 = avctx->priv_data;
@@ -249,9 +259,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.analyse.i_trellis = avctx->trellis;
x4->params.analyse.i_noise_reduction = avctx->noise_reduction;
- if (avctx->level > 0)
- x4->params.i_level_idc = avctx->level;
-
x4->params.rc.b_mb_tree = !!(avctx->flags2 & CODEC_FLAG2_MBTREE);
x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor);
x4->params.rc.f_pb_factor = avctx->b_quant_factor;
@@ -295,6 +302,8 @@ static av_cold int X264_init(AVCodecContext *avctx)
(float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size;
}
+ OPT_STR("level", x4->level);
+
if (x4->fastfirstpass)
x264_param_apply_fastfirstpass(&x4->params);
@@ -361,6 +370,7 @@ static const AVOption options[] = {
{"tune", "Tune the encoding params", OFFSET(tune), FF_OPT_TYPE_STRING, 0, 0, 0, VE},
{"fastfirstpass", "Use fast settings when encoding first pass", OFFSET(fastfirstpass), FF_OPT_TYPE_INT, 1, 0, 1, VE},
{"profile", "Set profile restrictions", OFFSET(profile), FF_OPT_TYPE_STRING, 0, 0, 0, VE},
+ {"level", "Specify level (as defined by Annex A)", OFFSET(level), FF_OPT_TYPE_STRING, 0, 0, 0, VE},
{ NULL },
};