From patchwork Mon Oct 18 22:27:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chad Fraleigh X-Patchwork-Id: 31153 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2084:0:0:0:0 with SMTP id a4csp3791472ioa; Mon, 18 Oct 2021 15:27:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfKuaB3nChAQTOgODbi33k3JSGBB8HER2/4IOLyg6g2BHyP1WNrT9Dqfr4wzi54XVwQoz8 X-Received: by 2002:a05:6402:354a:: with SMTP id f10mr47506098edd.365.1634596044892; Mon, 18 Oct 2021 15:27:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634596044; cv=none; d=google.com; s=arc-20160816; b=SiFc6cfct+aZuGeM0mUCgCQsK1gn/0LHRib06sHxgOFp0OmjrCc/2liv4HWDtWg57D iw8uTegUaWBp5dW7+uu0oVAH4G5yuURafwfGKm5LqzRBTsVjfGDw5oTVgZ3NK6RStjWa sZ9ihFMeSFx6CRjx0tUuU+YIVRbkRh5kWgEkbAuLh4RH+/bje5fzP7sLrCjsQSKSRiX7 B6OnZCEAmYcyYSlninZMRm76u01etjXT85IiHcPdWSvqEit7Je7lpc9yCaaRxCh4Nk6N hmYyqYxpnOiEkRfj3qf9BHlXNaJbXHVsyTf0bDEh8ghvLE+X25jpTJIwBQai31AI+xDs LNtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:content-language:to:from:user-agent:mime-version :date:message-id:dkim-signature:delivered-to; bh=SsLCqem3d1ad+uC7gamOf8+5dyGhC9VsDOGa6Y/ToUc=; b=kicEmWAUaHjzQr3LZPTS0RSEmsFczzoxoAhh9fEkQrcpxoyJBAOBOim+jPypd/vwrK Zg8gJrYpXutsu4nWN0OGyCQN0z1Q+RkniYvpcpfnSWuC1THjhQMZPfQG4dPR2l/7Tayw JKMOuyQVhqOe2SxLEoaidXSdcAExE1y3ORMq/wRFR8JeE612mlxdMaF1I7/0I63d7Pxf uUKvXloAbSnYERCI2D0nBSRp4e+8cyuPywpENtxWAMTGDejAVTv8eiRn5BUNgbGtolT1 jVmrG+UtCsCwT1QGLRI+6AvE5U4qZEKXGwojaClNRByY48pOyYZVTnBS88619u55qEtg TVow== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@triularity-org.20210112.gappssmtp.com header.s=20210112 header.b="DHSwi/AA"; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id gc4si20507772ejc.410.2021.10.18.15.27.23; Mon, 18 Oct 2021 15:27:24 -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=@triularity-org.20210112.gappssmtp.com header.s=20210112 header.b="DHSwi/AA"; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4FEBD68A64A; Tue, 19 Oct 2021 01:27:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E358768A4CA for ; Tue, 19 Oct 2021 01:27:05 +0300 (EEST) Received: by mail-pj1-f48.google.com with SMTP id oa4so13225913pjb.2 for ; Mon, 18 Oct 2021 15:27:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=triularity-org.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:from:subject:to :content-language:content-transfer-encoding; bh=qlRWM/8qBxzL8xW8f2dB/NRQ6Ceza05Qtz1qnu4KGyU=; b=DHSwi/AAsKjipf17nCoif86Pn25/4W2zDekF5MaDI4eQQsiZk51Tn0qvnIPDK2K5GH jr0YOrozdRS+PkTaHkb3KS5Ay6bSKFoIoHSmWlQeMM4DTCmPF9Cf67QVRrTemJb6YGdh IQguHZkar6AVmuZnhpHEODOE/d/s+flk1kpWZXmc3tEy/+tNdBE8B5b3b5oA9iQ5IT8P ukpbsFA/QzJ9pSiN1KiOV5rfaD3c1NCuVEF3ZSUJI6wbGnE4MFMrQHv7+JfuXbodlkZT 0RzOqVphjJ3Xy/9oG+DR4xiBJNEvBH9mOc5iedu7GoawvP0cVpp7GaOkkc0rXkua0KFg JIMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from :subject:to:content-language:content-transfer-encoding; bh=qlRWM/8qBxzL8xW8f2dB/NRQ6Ceza05Qtz1qnu4KGyU=; b=o9AeCZ+jJrNp0IGj4ENX9C7UsQiHdSmk0pxeD/SKQMxw8BHWEv/weuJrsEFMZD4QgM OAo5bc0fpAgW5QxImWaaVi9tJmnZDgV51A7QKk4AGp5+tboF/5RqyrWnWy0cw4Ot8B/E lTpVKK5slQy0DUT38KV3G/0OqXeoyqQqB1LBUjhmuiE3l33aJzy1mdm3aDzWB7uDVcr4 3ynXSyd6JtxjjhL8h5JbO7P79yapsAOWgxTn7WWMOlevxX5yQFTirSbEA9ffk39/zlbS sjc6PLXKbacIqDPuKpS3frDesnIc5h5wRDftSGOJxCTyDqzSzCH5+kbenuzc+VMrzuP5 r9rg== X-Gm-Message-State: AOAM532c3+hUdC3i4LYHZcfPmQbdPOcGxBvuym3Ys1n5O0QqoN2NSiLE kG36YZLi24ow/8zp7qWSQsjKS+/m5BF7o0bS X-Received: by 2002:a17:90a:e2c7:: with SMTP id fr7mr1955866pjb.140.1634596023504; Mon, 18 Oct 2021 15:27:03 -0700 (PDT) Received: from ?IPV6:2601:603:5000:f89:5947:de06:6c2c:d8c6? ([2601:603:5000:f89:5947:de06:6c2c:d8c6]) by smtp.gmail.com with ESMTPSA id k14sm14144967pfh.154.2021.10.18.15.27.02 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Oct 2021 15:27:02 -0700 (PDT) Message-ID: <6dd2c119-ab9f-2d8a-328a-37ee86ee1824@triularity.org> Date: Mon, 18 Oct 2021 15:27:01 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 From: Chad Fraleigh To: ffmpeg-devel@ffmpeg.org Content-Language: en-US Subject: [FFmpeg-devel] [PATCH 2/6] fftools/: constify values from av_dict_get(). 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 9N7KwtX7zA7s Treat values returned from av_dict_get() as const, since they are internal to AVDictionary. Signed-off-by: Chad Fraleigh --- fftools/cmdutils.c | 2 +- fftools/ffmpeg.c | 6 +++--- fftools/ffmpeg_filter.c | 6 +++--- fftools/ffmpeg_opt.c | 8 ++++---- fftools/ffplay.c | 8 ++++---- fftools/ffprobe.c | 8 ++++---- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 2c8e98982f..d351ceb7fa 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -2106,7 +2106,7 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, const AVCodec *codec) { AVDictionary *ret = NULL; - AVDictionaryEntry *t = NULL; + const AVDictionaryEntry *t = NULL; int flags = s->oformat ? AV_OPT_FLAG_ENCODING_PARAM : AV_OPT_FLAG_DECODING_PARAM; char prefix = 0; diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 9d4f9d7a2b..d46d154af1 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -677,7 +677,7 @@ static void ffmpeg_cleanup(int ret) void remove_avoptions(AVDictionary **a, AVDictionary *b) { - AVDictionaryEntry *t = NULL; + const AVDictionaryEntry *t = NULL; while ((t = av_dict_get(b, "", t, AV_DICT_IGNORE_SUFFIX))) { av_dict_set(a, t->key, NULL, AV_DICT_MATCH_CASE); @@ -686,7 +686,7 @@ void remove_avoptions(AVDictionary **a, AVDictionary *b) void assert_avoptions(AVDictionary *m) { - AVDictionaryEntry *t; + const AVDictionaryEntry *t; if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) { av_log(NULL, AV_LOG_FATAL, "Option %s not found.\n", t->key); exit_program(1); @@ -3228,7 +3228,7 @@ static int init_output_stream_streamcopy(OutputStream *ost) static void set_encoder_id(OutputFile *of, OutputStream *ost) { - AVDictionaryEntry *e; + const AVDictionaryEntry *e; uint8_t *encoder_string; int encoder_string_len; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index b798459946..c70903295f 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -86,7 +86,7 @@ static enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *enc_ctx static char *choose_pix_fmts(OutputFilter *ofilter) { OutputStream *ost = ofilter->ost; - AVDictionaryEntry *strict_dict = av_dict_get(ost->encoder_opts, "strict", NULL, 0); + const AVDictionaryEntry *strict_dict = av_dict_get(ost->encoder_opts, "strict", NULL, 0); if (strict_dict) // used by choose_pixel_fmt() and below av_opt_set(ost->enc_ctx, "strict", strict_dict->value, 0); @@ -437,7 +437,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, if ((ofilter->width || ofilter->height) && ofilter->ost->autoscale) { char args[255]; AVFilterContext *filter; - AVDictionaryEntry *e = NULL; + const AVDictionaryEntry *e = NULL; snprintf(args, sizeof(args), "%d:%d", ofilter->width, ofilter->height); @@ -994,7 +994,7 @@ int configure_filtergraph(FilterGraph *fg) if (simple) { OutputStream *ost = fg->outputs[0]->ost; char args[512]; - AVDictionaryEntry *e = NULL; + const AVDictionaryEntry *e = NULL; if (filter_nbthreads) { ret = av_opt_set(fg->graph, "threads", filter_nbthreads, 0); diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 7aff43d917..d034ff2a5b 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -249,7 +249,7 @@ static int show_hwaccels(void *optctx, const char *opt, const char *arg) /* return a copy of the input with the stream specifiers removed from the keys */ static AVDictionary *strip_specifiers(AVDictionary *dict) { - AVDictionaryEntry *e = NULL; + const AVDictionaryEntry *e = NULL; AVDictionary *ret = NULL; while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))) { @@ -1073,7 +1073,7 @@ static void dump_attachment(AVStream *st, const char *filename) { int ret; AVIOContext *out = NULL; - AVDictionaryEntry *e; + const AVDictionaryEntry *e; if (!st->codecpar->extradata_size) { av_log(NULL, AV_LOG_WARNING, "No extradata to dump in stream #%d:%d.\n", @@ -1109,7 +1109,7 @@ static int open_input_file(OptionsContext *o, const char *filename) int err, i, ret; int64_t timestamp; AVDictionary *unused_opts = NULL; - AVDictionaryEntry *e = NULL; + const AVDictionaryEntry *e = NULL; char * video_codec_name = NULL; char * audio_codec_name = NULL; char *subtitle_codec_name = NULL; @@ -2212,7 +2212,7 @@ static int open_output_file(OptionsContext *o, const char *filename) OutputStream *ost; InputStream *ist; AVDictionary *unused_opts = NULL; - AVDictionaryEntry *e = NULL; + const AVDictionaryEntry *e = NULL; if (o->stop_time != INT64_MAX && o->recording_time != INT64_MAX) { o->stop_time = INT64_MAX; diff --git a/fftools/ffplay.c b/fftools/ffplay.c index ccea0e4578..1183235624 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -1856,7 +1856,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c AVFilterContext *filt_src = NULL, *filt_out = NULL, *last_filter = NULL; AVCodecParameters *codecpar = is->video_st->codecpar; AVRational fr = av_guess_frame_rate(is->ic, is->video_st, NULL); - AVDictionaryEntry *e = NULL; + const AVDictionaryEntry *e = NULL; int nb_pix_fmts = 0; int i, j; @@ -1960,7 +1960,7 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for int channels[2] = { 0, -1 }; AVFilterContext *filt_asrc = NULL, *filt_asink = NULL; char aresample_swr_opts[512] = ""; - AVDictionaryEntry *e = NULL; + const AVDictionaryEntry *e = NULL; char asrc_args[256]; int ret; @@ -2575,7 +2575,7 @@ static int stream_component_open(VideoState *is, int stream_index) const AVCodec *codec; const char *forced_codec_name = NULL; AVDictionary *opts = NULL; - AVDictionaryEntry *t = NULL; + const AVDictionaryEntry *t = NULL; int sample_rate, nb_channels; int64_t channel_layout; int ret = 0; @@ -2760,7 +2760,7 @@ static int read_thread(void *arg) AVPacket *pkt = NULL; int64_t stream_start_time; int pkt_in_play_range = 0; - AVDictionaryEntry *t; + const AVDictionaryEntry *t; SDL_mutex *wait_mutex = SDL_CreateMutex(); int scan_all_pmts_set = 0; int64_t pkt_ts; diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index 90e895bbf9..169c26b65c 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -580,7 +580,7 @@ static int writer_open(WriterContext **wctx, const Writer *writer, const char *a /* convert options to dictionary */ if (args) { AVDictionary *opts = NULL; - AVDictionaryEntry *opt = NULL; + const AVDictionaryEntry *opt = NULL; if ((ret = av_dict_parse_string(&opts, args, "=", ":", 0)) < 0) { av_log(*wctx, AV_LOG_ERROR, "Failed to parse option string '%s' provided to writer context\n", args); @@ -1836,7 +1836,7 @@ static void writer_register_all(void) static inline int show_tags(WriterContext *w, AVDictionary *tags, int section_id) { - AVDictionaryEntry *tag = NULL; + const AVDictionaryEntry *tag = NULL; int ret = 0; if (!tags) @@ -2364,7 +2364,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, print_int("max_content", metadata->MaxCLL); print_int("max_average", metadata->MaxFALL); } else if (sd->type == AV_FRAME_DATA_ICC_PROFILE) { - AVDictionaryEntry *tag = av_dict_get(sd->metadata, "name", NULL, AV_DICT_MATCH_CASE); + const AVDictionaryEntry *tag = av_dict_get(sd->metadata, "name", NULL, AV_DICT_MATCH_CASE); if (tag) print_str(tag->key, tag->value); print_int("size", sd->size); @@ -2957,7 +2957,7 @@ static int open_input_file(InputFile *ifile, const char *filename, { int err, i; AVFormatContext *fmt_ctx = NULL; - AVDictionaryEntry *t = NULL; + const AVDictionaryEntry *t = NULL; int scan_all_pmts_set = 0; fmt_ctx = avformat_alloc_context();