diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-01-26 17:18:48 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-01-26 17:18:48 +0400 |
commit | d235d240d8ba88b931cb9ca0aca2cfa586c7eea0 (patch) | |
tree | bdf6e17de3f5e40af72b9e1a60a79b3377488a3f /libavcodec/libx264.c | |
parent | e7e14bc69a606a6bec82efef729263cd38f122d4 (diff) | |
parent | ded3673d77943c376d94e8157b1238bbd1eeca2d (diff) |
Merge commit 'ded3673d77943c376d94e8157b1238bbd1eeca2d'
* commit 'ded3673d77943c376d94e8157b1238bbd1eeca2d':
doc: document libx264 options and mappings
libx264: introduce -x264-params private option
Conflicts:
doc/encoders.texi
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libx264.c')
-rw-r--r-- | libavcodec/libx264.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index e2ef7530a6..2e0404d490 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -73,6 +73,7 @@ typedef struct X264Context { int slice_max_size; char *stats; int nal_hrd; + char *x264_params; } X264Context; static void X264_log(void *p, int level, const char *fmt, va_list args) @@ -522,6 +523,22 @@ static av_cold int X264_init(AVCodecContext *avctx) if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) x4->params.b_repeat_headers = 0; + if (x4->x264_params) { + AVDictionary *dict = NULL; + AVDictionaryEntry *en = NULL; + + if (!av_dict_parse_string(&dict, x4->x264_params, "=", ":", 0)) { + while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) { + if (x264_param_parse(&x4->params, en->key, en->value) < 0) + av_log(avctx, AV_LOG_WARNING, + "Error parsing option '%s = %s'.\n", + en->key, en->value); + } + + av_dict_free(&dict); + } + } + // update AVCodecContext with x264 parameters avctx->has_b_frames = x4->params.i_bframe ? x4->params.i_bframe_pyramid ? 2 : 1 : 0; @@ -653,6 +670,7 @@ static const AVOption options[] = { { "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_NONE}, INT_MIN, INT_MAX, VE, "nal-hrd" }, { "vbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_VBR}, INT_MIN, INT_MAX, VE, "nal-hrd" }, { "cbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_CBR}, INT_MIN, INT_MAX, VE, "nal-hrd" }, + { "x264-params", "Override the x264 configuration using a :-separated list of key=value parameters", OFFSET(x264_params), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, { NULL }, }; |