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 EC87649FF9 for ; Fri, 17 May 2024 15:40:06 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DFBED68C904; Fri, 17 May 2024 18:40:03 +0300 (EEST) Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0F8CD68D120 for ; Fri, 17 May 2024 18:39:57 +0300 (EEST) Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a5a2c05006aso257434666b.0 for ; Fri, 17 May 2024 08:39:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715960396; x=1716565196; 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=JV5MpTEhYBHOvOSSGbekCxTxx3CPPyTfAKiUZwtjKPg=; b=OtEUftrSD1wv38wBi691hqZbrYv/HlnoIFbHIV6v2L3yCEZd2qL1Qyg6TZ+y1AIbxs kEi7w2NqbZn3uVOYEHwgDEOj812O1a2XTliznx3cXSPKnkBD1CTL+DW4Ar9UrmnVJzD2 69wPgKgMks1aSF0gvt0wQMCe9iD/woiQ1fm1fXNwjaGE0ETMXOKoV6thNkZj3yhHROyD uyiSWkT90MPU20enjYOdg6W7ZBbCQQmplThGI0AxH3LQcxYOVwAYToeHmmcaq1ZDqZMK rx5mz/Zj+oiNN9V3e5Zer/DPkUmj5P9Q95Su6aXgdB2JVWCkwhs1llJpGBHksYFOabtQ Mrfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715960396; x=1716565196; 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=JV5MpTEhYBHOvOSSGbekCxTxx3CPPyTfAKiUZwtjKPg=; b=eMZgOj2fXjIGe6XY/AKNqpNeDwaKAtTekoXRu7vvgmoL89/9j4zYtiUsmUlmp5dMj8 i63zsdTFPl2NuwdfafsfTSDGKs/rLSYvLD0e3Di3SXxbtoeBOGIXChbsn3AK8UpV3gj9 p9LlpVjEl7dS5ALsk6Esxmf8vzbADf/njN3Pzr2+ibico7vWBynsSg25K1MD1lFKa45w qb8ODFWIDIg8gKDz4Uk16wV81K4ahWGBhkxqLBSGcU7kKESwYbppd/njiPccvnuWXuhv DAx3JcvQAcvyJwHjwUlDF27g5BB8te/1GZaAqJ7gab+SjLOi+LijB+Sg3ir1FkAdwzS6 wEVQ== X-Gm-Message-State: AOJu0Yy0oB8tpI3DzusYUitv0DeEPiuWQiHGtu/s9RiR4rcy8F/PzhwK 3IuG5N8UhMc5vyozDZS/1j9+k6oxk1LJA8Kw1wm8XNzSzWTZOiLV+jFEqg== X-Google-Smtp-Source: AGHT+IGBIJHPe7QBsH12GFp+ocNNZmUTajttFk/8uzHDAK5PYLJ/CLKvjg+pCPEjzA1ePOEHfafpFw== X-Received: by 2002:a05:6402:17d5:b0:574:d098:37af with SMTP id 4fb4d7f45d1cf-574d0983824mr11533637a12.7.1715960396122; Fri, 17 May 2024 08:39:56 -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 4fb4d7f45d1cf-5733bebb57asm11996112a12.26.2024.05.17.08.39.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2024 08:39:55 -0700 (PDT) From: epirat07@gmail.com To: FFmpeg development discussions and patches Date: Fri, 17 May 2024 17:39:53 +0200 X-Mailer: MailMate (1.14r6022) Message-ID: In-Reply-To: References: MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 6/6] fftools, avfilter, avformat: Simplify check for "is dictionary empty?" 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 > --- > fftools/ffmpeg.c | 4 ++-- > fftools/ffplay.c | 4 ++-- > fftools/ffprobe.c | 2 +- > libavfilter/avfilter.c | 4 ++-- > libavformat/aacdec.c | 2 +- > libavformat/http.c | 8 ++++---- > libavformat/mpc.c | 2 +- > libavformat/oggenc.c | 2 +- > libavformat/wvdec.c | 2 +- > 9 files changed, 15 insertions(+), 15 deletions(-) > > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > index 1f50ed6805..c86fd5065e 100644 > --- a/fftools/ffmpeg.c > +++ b/fftools/ffmpeg.c > @@ -484,8 +484,8 @@ void remove_avoptions(AVDictionary **a, AVDictionary *b) > > int check_avoptions(AVDictionary *m) > { > - const AVDictionaryEntry *t; > - if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) { > + const AVDictionaryEntry *t = av_dict_iterate(m, NULL); > + if (t) { > av_log(NULL, AV_LOG_FATAL, "Option %s not found.\n", t->key); > return AVERROR_OPTION_NOT_FOUND; > } > diff --git a/fftools/ffplay.c b/fftools/ffplay.c > index b9d11eecee..5a66bfa38d 100644 > --- a/fftools/ffplay.c > +++ b/fftools/ffplay.c > @@ -2694,7 +2694,7 @@ static int stream_component_open(VideoState *is, int stream_index) > if ((ret = avcodec_open2(avctx, codec, &opts)) < 0) { > goto fail; > } > - if ((t = av_dict_get(opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) { > + if ((t = av_dict_iterate(opts, NULL))) { > av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key); > ret = AVERROR_OPTION_NOT_FOUND; > goto fail; > @@ -2862,7 +2862,7 @@ static int read_thread(void *arg) > if (scan_all_pmts_set) > av_dict_set(&format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE); > > - if ((t = av_dict_get(format_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) { > + if ((t = av_dict_iterate(format_opts, NULL))) { > av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key); > ret = AVERROR_OPTION_NOT_FOUND; > goto fail; > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c > index 5b40dad527..2d38e5dfdc 100644 > --- a/fftools/ffprobe.c > +++ b/fftools/ffprobe.c > @@ -3951,7 +3951,7 @@ static int open_input_file(InputFile *ifile, const char *filename, > exit(1); > } > > - if ((t = av_dict_get(opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) { > + if ((t = av_dict_iterate(opts, NULL))) { > av_log(NULL, AV_LOG_ERROR, "Option %s for input stream %d not found\n", > t->key, stream->index); > return AVERROR_OPTION_NOT_FOUND; > diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c > index 049e4f62ca..2dc8820184 100644 > --- a/libavfilter/avfilter.c > +++ b/libavfilter/avfilter.c > @@ -941,7 +941,7 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) > int avfilter_init_str(AVFilterContext *filter, const char *args) > { > AVDictionary *options = NULL; > - AVDictionaryEntry *e; > + const AVDictionaryEntry *e; > int ret = 0; > > if (args && *args) { > @@ -954,7 +954,7 @@ int avfilter_init_str(AVFilterContext *filter, const char *args) > if (ret < 0) > goto fail; > > - if ((e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX))) { > + if ((e = av_dict_iterate(options, NULL))) { > av_log(filter, AV_LOG_ERROR, "No such option: %s.\n", e->key); > ret = AVERROR_OPTION_NOT_FOUND; > goto fail; > diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c > index e267886e1a..a8be251815 100644 > --- a/libavformat/aacdec.c > +++ b/libavformat/aacdec.c > @@ -119,7 +119,7 @@ static int adts_aac_read_header(AVFormatContext *s) > > ff_id3v1_read(s); > if ((s->pb->seekable & AVIO_SEEKABLE_NORMAL) && > - !av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) { > + !av_dict_count(s->metadata)) { > int64_t cur = avio_tell(s->pb); > ff_ape_parse_tag(s); > avio_seek(s->pb, cur, SEEK_SET); > diff --git a/libavformat/http.c b/libavformat/http.c > index 1a67068a44..ec60bc0b17 100644 > --- a/libavformat/http.c > +++ b/libavformat/http.c > @@ -990,7 +990,7 @@ static int parse_set_cookie(const char *set_cookie, AVDictionary **dict) > static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies) > { > AVDictionary *new_params = NULL; > - AVDictionaryEntry *e, *cookie_entry; > + const AVDictionaryEntry *e, *cookie_entry; > char *eql, *name; > > // ensure the cookie is parsable > @@ -998,7 +998,7 @@ static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies) > return -1; > > // if there is no cookie value there is nothing to parse > - cookie_entry = av_dict_get(new_params, "", NULL, AV_DICT_IGNORE_SUFFIX); > + cookie_entry = av_dict_iterate(new_params, NULL); > if (!cookie_entry || !cookie_entry->value) { > av_dict_free(&new_params); > return -1; > @@ -1300,7 +1300,7 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path, > *cookies = NULL; > while ((cookie = av_strtok(next, "\n", &saveptr)) && !ret) { > AVDictionary *cookie_params = NULL; > - AVDictionaryEntry *cookie_entry, *e; > + const AVDictionaryEntry *cookie_entry, *e; > > next = NULL; > // store the cookie in a dict in case it is updated in the response > @@ -1312,7 +1312,7 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path, > goto skip_cookie; > > // if the cookie has no value, skip it > - cookie_entry = av_dict_get(cookie_params, "", NULL, AV_DICT_IGNORE_SUFFIX); > + cookie_entry = av_dict_iterate(cookie_params, NULL); > if (!cookie_entry || !cookie_entry->value) > goto skip_cookie; > > diff --git a/libavformat/mpc.c b/libavformat/mpc.c > index 60cb768ab6..1e0e170c7d 100644 > --- a/libavformat/mpc.c > +++ b/libavformat/mpc.c > @@ -112,7 +112,7 @@ static int mpc_read_header(AVFormatContext *s) > if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) { > int64_t pos = avio_tell(s->pb); > ff_ape_parse_tag(s); > - if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) > + if (av_dict_count(s->metadata) == 0) > ff_id3v1_read(s); > avio_seek(s->pb, pos, SEEK_SET); > } > diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c > index f5782cb583..224519a4da 100644 > --- a/libavformat/oggenc.c > +++ b/libavformat/oggenc.c > @@ -432,7 +432,7 @@ static int ogg_build_vp8_headers(AVFormatContext *s, AVStream *st, > bytestream_put_be32(&p, st->time_base.num); > > /* optional second packet: VorbisComment */ > - if (av_dict_get(st->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) { > + if (av_dict_count(st->metadata)) { > p = ogg_write_vorbiscomment(7, bitexact, &oggstream->header_len[1], &st->metadata, 0, NULL, 0); > if (!p) > return AVERROR(ENOMEM); > diff --git a/libavformat/wvdec.c b/libavformat/wvdec.c > index b25c1eee83..e2a79957f7 100644 > --- a/libavformat/wvdec.c > +++ b/libavformat/wvdec.c > @@ -268,7 +268,7 @@ static int wv_read_header(AVFormatContext *s) > if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) { > int64_t cur = avio_tell(s->pb); > wc->apetag_start = ff_ape_parse_tag(s); > - if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) > + if (av_dict_count(s->metadata) == 0) > ff_id3v1_read(s); > avio_seek(s->pb, cur, SEEK_SET); > } > -- > 2.40.1 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".