From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 463544A007 for ; Fri, 17 May 2024 15:41:37 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4306868D2A5; Fri, 17 May 2024 18:41:36 +0300 (EEST) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5A3B268D0BD for ; Fri, 17 May 2024 18:41:29 +0300 (EEST) Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-51ff65b1e14so2409089e87.2 for ; Fri, 17 May 2024 08:41:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715960488; x=1716565288; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=w4UxaDAZiOb9fpNy8f8kUZXalDxARmEFobxTzwPkg2E=; b=aqLxRRD75bKB4Ymh9waTB7FQMUtXMi6zMYksBla5mr0FYs9wXOxu/g49MN9AJ0TUBO nU2pV/uHyfBkxLmESbhk506gdfAoHN7XfLuyRX2KMVCZYAG7r6hrdhyaBu4+9tYWSZWm IcjH1dSLlbjIq3DvRJcT1K/QBhW9aTj1Jbyt5TFlOOICpKzOwgDmNc6MoxdM9h4Wly28 Tb5tt3Zd8lI+uxUN/GXlLJOLg1lJR8CLGdYiSMKT/D7IC6rHjxVQZqCwGxxv1OgRfMzd gdZJwXAlIOshRKWnW/0twQbPcNTfAx8mJxx0ffxZqRCP2i9mf3SNhQDBt0H48bQ9PNwA GiNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715960488; x=1716565288; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w4UxaDAZiOb9fpNy8f8kUZXalDxARmEFobxTzwPkg2E=; b=HlM2tt73meb4V45LXII2xa7U0cPnnr77+u4hmAbBsd/l0+vmIypAR0pRDBXWd//k8W uVEAH70uw0NxRHHtCUa2TjUqUarAG8lnYJzBe0UgzwwzoD3KuuwI1RnrpNf/oPux6ojE tJycgEsityCdhhw9bKWTFM43i6X/yKosG+rMk/9gYa65SJVTEj4XSrwOEEEVTNJlq6p8 cr++m+0OSpZaRIH+qkHVIJCX03rO22EBW31OnWMotgO2gBXCJzJfjpDk5LbDN2Ee8eF4 ePUz9O4raY2MgALoVpxDQEUN8f9b7rXWCRt8Qb3bggSuFAdky46+30Jxqc1vFvNPsmFw ppLA== X-Gm-Message-State: AOJu0YxWBztn4+X6xqSJS1Or/7nipeL7WruwQp8JgJPtpClEuCcblFm5 uXcb5j5PjNAqZ+Regx4kwcIyUtTlABOnEJzmtnPZIm0vBw35aKLIjcAVoA== X-Google-Smtp-Source: AGHT+IE3gmxXyECRDb4xQD9udGU+yk1UVyGQLxN4rpYMDJaP2pZ2LgdBO8kyn5bzYeDlKImJU+3j6A== X-Received: by 2002:ac2:530c:0:b0:51f:d989:18f6 with SMTP id 2adb3069b0e04-5220fb7686emr15339762e87.13.1715960488386; Fri, 17 May 2024 08:41:28 -0700 (PDT) Received: from [192.168.178.30] (dynamic-2a01-0c22-a5bd-6600-58e8-b28e-8af1-2ac1.c22.pool.telefonica.de. [2a01:c22:a5bd:6600:58e8:b28e:8af1:2ac1]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a179c7da8sm1135749066b.99.2024.05.17.08.41.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2024 08:41:27 -0700 (PDT) From: epirat07@gmail.com To: FFmpeg development discussions and patches Date: Fri, 17 May 2024 17:41:26 +0200 X-Mailer: MailMate (1.14r6022) Message-ID: <001EA02E-CE53-4895-9B53-38CD3B2A4C1B@gmail.com> In-Reply-To: References: MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 5/6] avcodec/lib*, avformat/tee: Simplify iterating over AVDictionary X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 17 May 2024, at 17:25, Andreas Rheinhardt wrote: > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/libaomenc.c | 4 ++-- > libavcodec/libkvazaar.c | 4 ++-- > libavcodec/libsvtav1.c | 6 +++--- > libavcodec/libx264.c | 4 ++-- > libavcodec/libx265.c | 4 ++-- > libavformat/tee.c | 4 ++-- > 6 files changed, 13 insertions(+), 13 deletions(-) > > diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c > index c39853c20f..dec74ebecd 100644 > --- a/libavcodec/libaomenc.c > +++ b/libavcodec/libaomenc.c > @@ -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); > diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c > index 0711d9ab38..cd731ae9d0 100644 > --- a/libavcodec/libkvazaar.c > +++ b/libavcodec/libkvazaar.c > @@ -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); > diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c > index 9bc165f0cf..2fef8c8971 100644 > --- a/libavcodec/libsvtav1.c > +++ b/libavcodec/libsvtav1.c > @@ -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"); > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c > index 2715f277f1..29d1a7ccbc 100644 > --- a/libavcodec/libx264.c > +++ b/libavcodec/libx264.c > @@ -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)) { Missing pair of braces to make the compiler not warn about assignment in check, no? > if ((ret = x264_param_parse(&x4->params, en->key, en->value)) < 0) { > av_log(avctx, AV_LOG_WARNING, > "Error parsing option '%s = %s'.\n", > diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c > index c4ceffff5d..ac1dbc4f97 100644 > --- a/libavcodec/libx265.c > +++ b/libavcodec/libx265.c > @@ -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) { > diff --git a/libavformat/tee.c b/libavformat/tee.c > index 0c0543fa65..1a2a8ead82 100644 > --- a/libavformat/tee.c > +++ b/libavformat/tee.c > @@ -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)) { Same as above > 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; > -- > 2.40.1 Otherwise LGTM, thanks! > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".