From patchwork Mon Oct 18 21:31:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chad Fraleigh X-Patchwork-Id: 31147 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2084:0:0:0:0 with SMTP id a4csp3749847ioa; Mon, 18 Oct 2021 14:32:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuzXja+2L2XOIIjzd0PlQ1ZxK26+Bufwvv/1IQTShHcE/8iaVpL+2pA0YYZUmA9VzTD++F X-Received: by 2002:a05:6402:1547:: with SMTP id p7mr49222044edx.371.1634592735811; Mon, 18 Oct 2021 14:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634592735; cv=none; d=google.com; s=arc-20160816; b=bpArX8Ufj1Qxh979R7AjETVZbuP79ZOSG4B37wpFSy3kP0JdoS9TaI6iA53+ynXcGb D1V40j3VM+8FYaIqIQD3+ZidhI8EUx7+2pIBb3k4UWd3d6wNNpk9+46ET8Nuar6YVLb3 FnqzvyL72gLB2ZONZOTMWSLn53Zh1n55FLPU7B76XcDMQ38ipBGHhY+3IQxXpNZ90Kpe oPJP0tcJb5isIKdkwkOpRSXCclabCC+/YdoY9L0d9dvdMuIfVnixC3onhy1VPZLTpSS2 wDG3+eRvwnS07H0IPPAd86DpNTSRS/EcJoYAAfrEBLERx2JychL6o6vlw3CDANgWRslb 9Qgg== 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=j8T6wEOEJP7NlpuCgPQgsCZosvJHKkUFreZLYNyYes4=; b=k350d/2tWAOL4mz8EaoKZpDR8/R0msVHkaMwf404f01fLuVANL1J6+ZflLnCtXMV6S b3Iyot6uJmU9h1rGRl6k0SjZPC3EE2hl3Y2cf8YCVnVOlJH+sUejL0qhyC/wRCFx18Lj 8qxDUZGjex++3t+MgTRvGZtf9M0VZ5/I4v0diGrugZGadPcpwXWMGizIEuWl0mV0Z5JP yu9ftVTKIjLeUY2GhuDKAm+C8amX1MU1xRB3yu9gHsKc/hx+XZsOEBL5zzUlN0ZnzC4w 2L+j+ijNzS+FaYBBviSR7HF/n01vwQQGP6fIaWN4pYAul20/I9uzwz+3jne5NcoNg+oe DdJg== 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=U5Mz+nBl; 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 o6si28620607edi.516.2021.10.18.14.32.08; Mon, 18 Oct 2021 14:32:15 -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=U5Mz+nBl; 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 3445968A618; Tue, 19 Oct 2021 00:32:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E541A688113 for ; Tue, 19 Oct 2021 00:31:59 +0300 (EEST) Received: by mail-pj1-f44.google.com with SMTP id lk8-20020a17090b33c800b001a0a284fcc2so425326pjb.2 for ; Mon, 18 Oct 2021 14:31:59 -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=OrqvsHzu6NK+vxiRQH6PfFEJ2LBSvRUzr4dTbo2vfxA=; b=U5Mz+nBlJk125w0G6sur0dTZ9w0e8OPlxVrrgh+nTCoN8rzGnFNpFB2tpCj3yf+Ov5 XlkViBcoaAJh1py3EKoW7xPFaBu890ECBC459OpSKqkSUe/26x1iJH3ZDEVL5mqUm0KB /oDdfT6GAbLnZ4zqq0y7GW1vQGOrXT08ME855TJ0sRFwXLarBdFOyJKJGDYpPfhYEd8f nP4BbrELs1TURQQkit0dFB1xsIEOAVptd57M1dxcfsRhMPm4jJ7hpmx0EeIemAQ7qGjl +AlFqvrCxEAjKPuny+2FukXPtwyhPxcdKAYjQjDKg/SjVsG+w0g+0CNQQzeEAoHaZPrU t6Ow== 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=OrqvsHzu6NK+vxiRQH6PfFEJ2LBSvRUzr4dTbo2vfxA=; b=M/dPzfNyvs8wH+zfPf+iZSse0lTdD6mluRkf03LbLOoNe1EyDsrvtZ3KB0jh3ihLu7 Gh8HWhAqYCPYFtFzdkeH6xbUFReilI9iUi36i9mZ2ST8lLWwS2J9lhHc1/gMjPTc9kDK FTL8GY6smsKUU53xSdjo90FC95xK26Q3pW83mPIfsIlrdlxTWRGM3rz4UkfHKO3oaZ2D u/iNvca1JFfMPraSc3JCKpWjStJDDDEbaqLZ+hTIVYOsOG92NkNgaM/zpDXJvjuGqP7U RkQ0OS8F3LkraW11arb3B7KRrQgV0LzWWDl8uXfbjUExUuGHAfatxCE9iFrU0KD0st3J bfUg== X-Gm-Message-State: AOAM532iVl4w2HTq5HA63Woux9j6LKelQn733gBVJ2LVtvabZ+hBH+42 CwoeZpgzfJXpU3qzeBXOp3XADcUb6nVevAAGjtE= X-Received: by 2002:a17:90b:1112:: with SMTP id gi18mr1629648pjb.136.1634592717876; Mon, 18 Oct 2021 14:31:57 -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 x13sm14122991pgt.80.2021.10.18.14.31.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Oct 2021 14:31:57 -0700 (PDT) Message-ID: <011d2d7b-79fa-60d9-68ba-64c2087b79d3@triularity.org> Date: Mon, 18 Oct 2021 14:31:56 -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: J5X3HHecvhWX 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 98c2421938..edbf3ac52a 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); @@ -3243,7 +3243,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 1d6d29cfc9..147048e914 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))) { @@ -1069,7 +1069,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", @@ -1105,7 +1105,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; @@ -2204,7 +2204,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; int format_flags = 0; if (o->stop_time != INT64_MAX && o->recording_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();