Commit 482afe8f authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avcodec/lib*, avformat/tee: Simplify iterating over AVDictionary

Reviewed-by: epirat07@gmail.com
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
parent ce22e7ab
......@@ -970,9 +970,9 @@ static av_cold int aom_init(AVCodecContext *avctx,
#if AOM_ENCODER_ABI_VERSION >= 23
{
AVDictionaryEntry *en = NULL;
const AVDictionaryEntry *en = NULL;
while ((en = av_dict_get(ctx->aom_params, "", en, AV_DICT_IGNORE_SUFFIX))) {
while ((en = av_dict_iterate(ctx->aom_params, en))) {
int ret = aom_codec_set_option(&ctx->encoder, en->key, en->value);
if (ret != AOM_CODEC_OK) {
log_encoder_error(avctx, en->key);
......
......@@ -111,8 +111,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (ctx->kvz_params) {
AVDictionary *dict = NULL;
if (!av_dict_parse_string(&dict, ctx->kvz_params, "=", ",", 0)) {
AVDictionaryEntry *entry = NULL;
while ((entry = av_dict_get(dict, "", entry, AV_DICT_IGNORE_SUFFIX))) {
const AVDictionaryEntry *entry = NULL;
while ((entry = av_dict_iterate(dict, entry))) {
if (!api->config_parse(cfg, entry->key, entry->value)) {
av_log(avctx, AV_LOG_WARNING, "Invalid option: %s=%s.\n",
entry->key, entry->value);
......
......@@ -210,7 +210,7 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
{
SvtContext *svt_enc = avctx->priv_data;
const AVPixFmtDescriptor *desc;
AVDictionaryEntry *en = NULL;
const AVDictionaryEntry av_unused *en = NULL;
// Update param from options
if (svt_enc->enc_mode >= -1)
......@@ -326,7 +326,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
handle_side_data(avctx, param);
#if SVT_AV1_CHECK_VERSION(0, 9, 1)
while ((en = av_dict_get(svt_enc->svtav1_opts, "", en, AV_DICT_IGNORE_SUFFIX))) {
while ((en = av_dict_iterate(svt_enc->svtav1_opts, en))) {
EbErrorType ret = svt_av1_enc_parse_parameter(param, en->key, en->value);
if (ret != EB_ErrorNone) {
int level = (avctx->err_recognition & AV_EF_EXPLODE) ? AV_LOG_ERROR : AV_LOG_WARNING;
......@@ -336,7 +336,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
}
#else
if ((en = av_dict_get(svt_enc->svtav1_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
if (av_dict_count(svt_enc->svtav1_opts)) {
int level = (avctx->err_recognition & AV_EF_EXPLODE) ? AV_LOG_ERROR : AV_LOG_WARNING;
av_log(avctx, level, "svt-params needs libavcodec to be compiled with SVT-AV1 "
"headers >= 0.9.1.\n");
......
......@@ -1385,8 +1385,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
x4->params.b_repeat_headers = 1;
{
AVDictionaryEntry *en = NULL;
while (en = av_dict_get(x4->x264_params, "", en, AV_DICT_IGNORE_SUFFIX)) {
const AVDictionaryEntry *en = NULL;
while (en = av_dict_iterate(x4->x264_params, en)) {
if ((ret = x264_param_parse(&x4->params, en->key, en->value)) < 0) {
av_log(avctx, AV_LOG_WARNING,
"Error parsing option '%s = %s'.\n",
......
......@@ -495,8 +495,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
{
AVDictionaryEntry *en = NULL;
while ((en = av_dict_get(ctx->x265_opts, "", en, AV_DICT_IGNORE_SUFFIX))) {
const AVDictionaryEntry *en = NULL;
while ((en = av_dict_iterate(ctx->x265_opts, en))) {
int parse_ret = ctx->api->param_parse(ctx->params, en->key, en->value);
switch (parse_ret) {
......
......@@ -313,7 +313,7 @@ static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave)
}
entry = NULL;
while (entry = av_dict_get(bsf_options, "", NULL, AV_DICT_IGNORE_SUFFIX)) {
while (entry = av_dict_iterate(bsf_options, NULL)) {
const char *spec = entry->key;
if (*spec) {
if (strspn(spec, slave_bsfs_spec_sep) != 1) {
......@@ -390,7 +390,7 @@ static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave)
if (options) {
entry = NULL;
while ((entry = av_dict_get(options, "", entry, AV_DICT_IGNORE_SUFFIX)))
while ((entry = av_dict_iterate(options, entry)))
av_log(avf2, AV_LOG_ERROR, "Unknown option '%s'\n", entry->key);
ret = AVERROR_OPTION_NOT_FOUND;
goto end;
......
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