From patchwork Tue Apr 28 08:36:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 19300 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 1308344B819 for ; Tue, 28 Apr 2020 11:40:13 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F0D7068BDF2; Tue, 28 Apr 2020 11:40:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EF2AF68BDFA for ; Tue, 28 Apr 2020 11:40:05 +0300 (EEST) Received: by mail-wm1-f65.google.com with SMTP id z6so1881483wml.2 for ; Tue, 28 Apr 2020 01:40:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cilQ+RYBpMsAbRn/+MOCrVomGgcGUmUxFOafDs5EX6E=; b=Scm0Y/FUVuSIH1wI6o+35bFdl5aV8hyyrvzUV4DHxZAE+U6OrX2lwxMFch5CP8oFO/ 7HbMT9Ve/ia23cdoVS0Dm+U5c/Rwkc1cKp70atm6GdVmDBRaQxBlsQvupTwapjn3BNU9 psl3JkuTM6uNnkjCw6eHhG2KfvBUE9AGWV+Jfl/FKyiWgUlUY35hj6PZ73g7pKFNZqBH 4JNxQov9JeUPPbaKuhsxtH2GVXl1tpIaq03HRLvJyB6FEvO/sxV/kssrc/33qPjcMmZv bcPs/oPojjeNxO+5unlbTCnOeFzlKciQJWxfHsc8RrCfVHbYgQfSKjfQ2NUmdCFOlbIh NRJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cilQ+RYBpMsAbRn/+MOCrVomGgcGUmUxFOafDs5EX6E=; b=M/qiQd1J690e0Zz9nEQbRPgr/SeAr8jMz9xdo3PPr3FDu2yo+xiHBcsGO+vT0LyDDv UqNgV0rNA40t+zsfSQjonBGqaCSjKlszU+uxJwCQRFL6BtLxhGpQEfvq+kDf2BC3qVmK IFt8eZnpyHFvMsE+EvbeE5RZ2+XIAmecaprt2HofBjwGnnPptprukqGreajOatw3LdPY +OK3zHxL7tPnKoLtV/tiesShPDzBcSDrbl0iC4dioeBHVqvq/AJGDDE0Pbz39b0I6o1V fCd9bYTo26lxnhlUtvcqysWRkeBa94RvH0QaD02vNQ8ioVrIcZ3QPODmCDp8U1lUAVAt 3G5g== X-Gm-Message-State: AGi0PuZSJkzc9tygh7qvw3qN1HUP/u42EYovapk5AW0DgszeWK0cEKZz exVzE82lV4FSW62KTKUk9DAOK8Yq X-Google-Smtp-Source: APiQypI3v6aZRdd+xPi21x/K4DqD/GmBliiMNBAuMcxYcwnYVqaWzXF4lyoD3OJPrnCxfMq2YGkXEA== X-Received: by 2002:a7b:c0d5:: with SMTP id s21mr3249100wmh.107.1588063204952; Tue, 28 Apr 2020 01:40:04 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1ab57.dynamic.kabel-deutschland.de. [188.193.171.87]) by smtp.gmail.com with ESMTPSA id w11sm2258351wmi.32.2020.04.28.01.40.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2020 01:40:04 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 28 Apr 2020 10:36:41 +0200 Message-Id: <20200428083645.4909-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428083645.4909-1-andreas.rheinhardt@gmail.com> References: <20200428083645.4909-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/7] avformat/vorbiscomment: Replace AVDictionary ** by const AVDictionary * X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" ff_vorbiscomment_write() used an AVDictionary ** parameter for a dictionary whose contents ought to be written; yet this can be replaced by AVDictionary * since commit 042ca05f0fdc5f4d56a3e9b94bc9cd67bca9a4bc; and this in turn can be replaced by const AVDictionary * to indicate that the dictionary isn't modified; the latter also applies to ff_vorbiscomment_length(). Signed-off-by: Andreas Rheinhardt --- libavformat/flacenc.c | 2 +- libavformat/matroskaenc.c | 2 +- libavformat/oggenc.c | 2 +- libavformat/vorbiscomment.c | 10 +++++----- libavformat/vorbiscomment.h | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index a043274df6..0e88e18355 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -76,7 +76,7 @@ static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m, bytestream_put_byte(&p, last_block ? 0x84 : 0x04); bytestream_put_be24(&p, len); - ff_vorbiscomment_write(&p, m, vendor, NULL, 0); + ff_vorbiscomment_write(&p, *m, vendor, NULL, 0); avio_write(pb, p0, len+4); av_freep(&p0); diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 018108b96b..58bcdb904f 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -643,7 +643,7 @@ static int put_flac_codecpriv(AVFormatContext *s, AVIOContext *pb, AV_WB24(data + 1, len); p = data + 4; - ff_vorbiscomment_write(&p, &dict, vendor, NULL, 0); + ff_vorbiscomment_write(&p, dict, vendor, NULL, 0); avio_write(pb, data, len + 4); diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index fbd14fedf9..cc9a899a4c 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -308,7 +308,7 @@ static uint8_t *ogg_write_vorbiscomment(int64_t offset, int bitexact, p0 = p; p += offset; - ff_vorbiscomment_write(&p, m, vendor, chapters, nb_chapters); + ff_vorbiscomment_write(&p, *m, vendor, chapters, nb_chapters); if (framing_bit) bytestream_put_byte(&p, 1); diff --git a/libavformat/vorbiscomment.c b/libavformat/vorbiscomment.c index fb5c655a23..edaeae2772 100644 --- a/libavformat/vorbiscomment.c +++ b/libavformat/vorbiscomment.c @@ -38,7 +38,7 @@ const AVMetadataConv ff_vorbiscomment_metadata_conv[] = { { 0 } }; -int64_t ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string, +int64_t ff_vorbiscomment_length(const AVDictionary *m, const char *vendor_string, AVChapter **chapters, unsigned int nb_chapters) { int64_t len = 8; @@ -62,7 +62,7 @@ int64_t ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string, return len; } -int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m, +int ff_vorbiscomment_write(uint8_t **p, const AVDictionary *m, const char *vendor_string, AVChapter **chapters, unsigned int nb_chapters) { @@ -74,11 +74,11 @@ int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m, cm_count += av_dict_count(chapters[i]->metadata) + 1; } } - if (*m) { - int count = av_dict_count(*m) + cm_count; + if (m) { + int count = av_dict_count(m) + cm_count; AVDictionaryEntry *tag = NULL; bytestream_put_le32(p, count); - while ((tag = av_dict_get(*m, "", tag, AV_DICT_IGNORE_SUFFIX))) { + while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) { int64_t len1 = strlen(tag->key); int64_t len2 = strlen(tag->value); if (len1+1+len2 > UINT32_MAX) diff --git a/libavformat/vorbiscomment.h b/libavformat/vorbiscomment.h index 4ff3dd6c27..af9bd75cd7 100644 --- a/libavformat/vorbiscomment.h +++ b/libavformat/vorbiscomment.h @@ -34,7 +34,7 @@ * For no string, set to an empty string. * @return The length in bytes. */ -int64_t ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string, +int64_t ff_vorbiscomment_length(const AVDictionary *m, const char *vendor_string, AVChapter **chapters, unsigned int nb_chapters); /** @@ -49,7 +49,7 @@ int64_t ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string, * @param chapters The chapters to write. * @param nb_chapters The number of chapters to write. */ -int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m, +int ff_vorbiscomment_write(uint8_t **p, const AVDictionary *m, const char *vendor_string, AVChapter **chapters, unsigned int nb_chapters);