[FFmpeg-cvslog] avcodec/libvpxenc: use AV_OPT_TYPE_DICT for ts-parameters

Marton Balint git at videolan.org
Wed Jan 1 23:45:23 EET 2020


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Wed Dec 25 02:02:30 2019 +0100| [9ac1066dc6b52dd97b654369d08a78972dd30228] | committer: Marton Balint

avcodec/libvpxenc: use AV_OPT_TYPE_DICT for ts-parameters

Signed-off-by: Marton Balint <cus at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ac1066dc6b52dd97b654369d08a78972dd30228
---

 libavcodec/libvpxenc.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 721a052641..3f659b4b67 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -100,7 +100,7 @@ typedef struct VPxEncoderContext {
     int rc_undershoot_pct;
     int rc_overshoot_pct;
 
-    char *vp8_ts_parameters;
+    AVDictionary *vp8_ts_parameters;
 
     // VP9-only
     int lossless;
@@ -757,19 +757,13 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
     enccfg.g_error_resilient = ctx->error_resilient || ctx->flags & VP8F_ERROR_RESILIENT;
 
-    if (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8 && ctx->vp8_ts_parameters) {
-        AVDictionary *dict    = NULL;
+    if (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8) {
         AVDictionaryEntry* en = NULL;
-
-        if (!av_dict_parse_string(&dict, ctx->vp8_ts_parameters, "=", ":", 0)) {
-            while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) {
-                if (vp8_ts_param_parse(&enccfg, 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);
+        while ((en = av_dict_get(ctx->vp8_ts_parameters, "", en, AV_DICT_IGNORE_SUFFIX))) {
+            if (vp8_ts_param_parse(&enccfg, en->key, en->value) < 0)
+                av_log(avctx, AV_LOG_WARNING,
+                       "Error parsing option '%s = %s'.\n",
+                       en->key, en->value);
         }
     }
 
@@ -1462,7 +1456,7 @@ static const AVOption vp8_options[] = {
                          "frames (2-pass only)",                        OFFSET(auto_alt_ref),    AV_OPT_TYPE_INT, {.i64 = -1}, -1,  2, VE},
     { "cpu-used",        "Quality/Speed ratio modifier",                OFFSET(cpu_used),        AV_OPT_TYPE_INT, {.i64 = 1}, -16, 16, VE},
     { "ts-parameters",   "Temporal scaling configuration using a "
-                         ":-separated list of key=value parameters",    OFFSET(vp8_ts_parameters), AV_OPT_TYPE_STRING, {.str=NULL},  0,  0, VE},
+                         ":-separated list of key=value parameters",    OFFSET(vp8_ts_parameters), AV_OPT_TYPE_DICT, {.str=NULL},  0,  0, VE},
     LEGACY_OPTIONS
     { NULL }
 };



More information about the ffmpeg-cvslog mailing list