From patchwork Fri May 17 15:25:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48952 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a48:b0:1af:fc2d:ff5a with SMTP id zu8csp2951144pzb; Fri, 17 May 2024 08:26:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXD94cEoeia8XtZ/pqOTYvghzB9M+TaOvnBe6nOzXVWQkYgbZI7TkntLdfU08qKv5XpNAnnzcKwQHeYC35x2hLH2FE7eu4KevxZmg== X-Google-Smtp-Source: AGHT+IGAzMrxy4t6WVfyIhHuePhRiOEg94qkpVKhgBz6AnLiX8RjkkKk7olY7BXed+r7bCQmCF7b X-Received: by 2002:a2e:980e:0:b0:2e6:b36e:434 with SMTP id 38308e7fff4ca-2e6b36e0479mr95203261fa.31.1715959600634; Fri, 17 May 2024 08:26:40 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 38308e7fff4ca-2e6f3780493si20157811fa.20.2024.05.17.08.26.40; Fri, 17 May 2024 08:26:40 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=opLUwx3w; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4D6FF68D396; Fri, 17 May 2024 18:26:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2084.outbound.protection.outlook.com [40.92.74.84]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F317F68D32A for ; Fri, 17 May 2024 18:26:10 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EPE3a9QnC+oxw4dGXtLRE2+yKt46C30snBnB+EkYjPDRf9cR0Yq+VHpXb4a3RzWCOO3IlW1dKR4BEPYJppEsD68lDp7QpLAswjX9WrbO6jsszng4Ef7meEJQCt8md1irf1X37uvDNDVOoxbHALQZdbNBsw7ainIpaQZEEwsUlWbvuvNr4OQrPnvTxlT/Thji/FCzsGo9k+bzPxJaR0X5IHwFcyxHYV8biNVZEdsHvwegm+vzB846Z0IkQytDoABWNSAtBFFx6xMYZQCPn3K/Z7ipjafbHKH35DojCnLgr1l0KIYlMULbM8tVTBGYtarUslqWvCbnyGCrwvjUe39dAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jUhEZ3k9Hy9ts9nHl7RNL4ZdeuccjjQGpGp+bY9FaXs=; b=NFNZkRJCE5g+3TPQWF1hP01QMJEBNqFGy/MkMsfN4o1waifUgbnljKiTLS1Q0HnhArDZdea0+CYZlHMwm5/Gf7VjnJl+jXpz87tYOFvOdb0beMABslEeBvXgh77s0wRQfXv7cphIUgdxThQN6PKOWSiX8/3PbUVznYG2kGFdOaRrxQzo1pgyTP3kkuQhy7nKFRtUUlNwJd9KV7mtNtatL2hoT1AfswHN2Ci/g1z7huLTbNC6ff8bG02KuypgjL9ImtUrvE0OmtS2cqs5HX1Krp55kBJ3+2QgmwC8DzpNAM9AaXWYXWgkmipGTs0YGh+ZZBd6m/7nULOsbkCGQwIxOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jUhEZ3k9Hy9ts9nHl7RNL4ZdeuccjjQGpGp+bY9FaXs=; b=opLUwx3wb95RNq+0WPgM6WfDF6LCDDGhWTKa/JxYwfoSuMadepZ+WV5PA6MlqRtbA4mm0BpOKTIx6zxyxgw6xIvxKZYpsaR2ngb/sejPyLJ07jWnHP2WEGHEEFqFgjlg9IulP+g5F0ofLTGvx87uJ83GoKsI075ZOF8IR7XjaTNZtnLZD5nKdr6EyO0aPq0KuluhrlJ5VSOJflt81rQ6cjxTYyQqHbrMqhhV5J3zBtEK7hka95ILgvg8C+RaawdMoRBuwCUHtdJR/+LZLkHDikOX4D/Mte+HRl2OHmm/2o/gOg7ZszaPI6g34T5PF7k6GGrfcvn+LA3DWQnXsE4e7g== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DU2P250MB0048.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:23b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Fri, 17 May 2024 15:26:02 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::384d:40d4:ecb7:1c9]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::384d:40d4:ecb7:1c9%4]) with mapi id 15.20.7544.052; Fri, 17 May 2024 15:26:02 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 17 May 2024 17:25:40 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [U4/iSuawf27cIaBEiB6gmlf+kAZvNS9HFWe9nCf7WhU=] X-ClientProxiedBy: FR0P281CA0269.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:b5::7) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240517152540.3794055-5-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DU2P250MB0048:EE_ X-MS-Office365-Filtering-Correlation-Id: 1b1e725b-bbdb-4e41-ebd9-08dc7685a92a X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: OruVpsssZqmHZSKSTOitG5X8wPQ3zv2t70Y6N214G5+cj905BBwT/CAYRQ7tUw5vBlcZBBFf+b8E6SKBnafxNg11Qrtexl+Jr/oU+7ARz7BPbux1dNBsg1mt7DB2Q27j7vhy/rnMWQ+fTwxslwQNe2tSbKL/Ap4Xr2+bWsIFjx730zq/CJ9GruQx0GC+Ux4C/XmI5MkDuzhOWhU5gt6nWe/qmXELtlfKfYzsL7ePGXuWXN5VPGnby4NNATi5TZ6KoPnzsI3LttbxWMy2Bwht/qOOnBfVBjCKhO2uHi+4MHXdTIvX+nZMycEwdxgOW+HhJlZuD9+jYZRsxXn/poNOEgSVxKTpooGji8K/ABDZjjqp6uGfX2kYh0Vxo6GXEgvMz5xYWRBasexfV2TONAnOZO/I/rO8E0ByQvu7/askfCDDPmhSGeKmnaJ2xdJ01Yix9ZAzbNW4Cngz/9Mapho2i6CWNdg3/+6lKRrrNdrzTHPGh2JpxKt03RL85BQH0zY8e5CsSv4JZislcyvl7qEVaVe/7kzbL5iIUs8bgCFLAEqbPIlYG96v7aqUPl9FMb6KmR763gp0ZEbrcKsIFWadJ1xcvY+7YVspB57VV9ERjJVPbdKcoP3LOIv2hA4DgxX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faE7b3PRSujhes3NMj4VIuMyAZkZRDyHJCAaw+nDD9ohKhTJCCE56iCmWpw8gbloVASzpV+e0Gep0aExyjg0PQm5ru1XGHyKETSi/ke/ayQsFxjjLMXAHBbCPcWA93ZvVIwHtbtg0/PK+BiGbLhUaOgEIFMhmrRq5P1a0og7ldnvS/mmXUEq6piXj8qQMrmehRpJn22pX3lXvmphA/HaxVOdSI8Tv6Kk9Y45pCNHHClIoiKf4jiv0XpJewQhgNnjEdwg0O1+sFKRKG/bUCDKwyNMBZsbXkA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b1e725b-bbdb-4e41-ebd9-08dc7685a92a X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2024 15:26:02.2752 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2P250MB0048 Subject: [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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: omOkybcsywty 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); }