Commit 91f64ea4 authored by Marton Balint's avatar Marton Balint

avcodec/libx265: use AV_OPT_TYPE_DICT for x265-params

Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent dfea6d2e
...@@ -47,7 +47,7 @@ typedef struct libx265Context { ...@@ -47,7 +47,7 @@ typedef struct libx265Context {
char *preset; char *preset;
char *tune; char *tune;
char *profile; char *profile;
char *x265_opts; AVDictionary *x265_opts;
/** /**
* If the encoder does not support ROI then warn the first time we * If the encoder does not support ROI then warn the first time we
...@@ -336,12 +336,9 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) ...@@ -336,12 +336,9 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
return ret; return ret;
} }
if (ctx->x265_opts) { {
AVDictionary *dict = NULL;
AVDictionaryEntry *en = NULL; AVDictionaryEntry *en = NULL;
while ((en = av_dict_get(ctx->x265_opts, "", en, AV_DICT_IGNORE_SUFFIX))) {
if (!av_dict_parse_string(&dict, ctx->x265_opts, "=", ":", 0)) {
while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) {
int parse_ret = ctx->api->param_parse(ctx->params, en->key, en->value); int parse_ret = ctx->api->param_parse(ctx->params, en->key, en->value);
switch (parse_ret) { switch (parse_ret) {
...@@ -357,8 +354,6 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) ...@@ -357,8 +354,6 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
break; break;
} }
} }
av_dict_free(&dict);
}
} }
if (ctx->params->rc.vbvBufferSize && avctx->rc_initial_buffer_occupancy > 1000 && if (ctx->params->rc.vbvBufferSize && avctx->rc_initial_buffer_occupancy > 1000 &&
...@@ -645,7 +640,7 @@ static const AVOption options[] = { ...@@ -645,7 +640,7 @@ static const AVOption options[] = {
{ "preset", "set the x265 preset", OFFSET(preset), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, { "preset", "set the x265 preset", OFFSET(preset), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ "tune", "set the x265 tune parameter", OFFSET(tune), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, { "tune", "set the x265 tune parameter", OFFSET(tune), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ "profile", "set the x265 profile", OFFSET(profile), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, { "profile", "set the x265 profile", OFFSET(profile), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ "x265-params", "set the x265 configuration using a :-separated list of key=value parameters", OFFSET(x265_opts), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, { "x265-params", "set the x265 configuration using a :-separated list of key=value parameters", OFFSET(x265_opts), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE },
{ NULL } { NULL }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment