From patchwork Tue Oct 18 12:37:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 38792 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp2083469pzb; Tue, 18 Oct 2022 05:40:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6degB9ceeE/nyvUtNjjHgVbHpidQTeQ+QYpVUpVNt14RhK+30wuGmKF35Peb8MzJXb9yTx X-Received: by 2002:a17:906:8a48:b0:78d:acdc:b7d9 with SMTP id gx8-20020a1709068a4800b0078dacdcb7d9mr2311192ejc.500.1666096828172; Tue, 18 Oct 2022 05:40:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666096828; cv=none; d=google.com; s=arc-20160816; b=MwB9/H/RbazNuPnRgGMBiIZOpegiuANHJ4AZNsMwAGBanQ+Szol92ZDZEbeM00nlPA yCDuP3yeBPWhCqcUASXqvGNWaPYZkn6pn0yziI052sbhv88H8rf470cS6ePQ6I4Vsaeb fR4JSQGXsCIwP0gTc7/mX5+m6EV332+d3fMEKOjOB2N//pBjcvxz+bmbXEVXTw4ZNSBv calScA4LTZdTX6pyfPOmxZ16kuLz5pAC9uEjY6fhkXArTZe6e7wyLzjJcf6IR+FpP3oc TiXkezQbWE9l48rCKABfi3qXceaGJCtqn+ltVggX6dL3FE8iZ0J2ZPn7Ur3mOLs7I6hu X05Q== 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:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=t+Rxqi5UvSZV11dzdwkuquCQM6PJYAbFLZMb7qYn1EI=; b=cuO19mNCE5LHHC8cSCPmvG1EEdDbMkSz7ANY1dqDYYHd/qVenPykvNOiJX7m8qrUuU tzxQX/h6Dj3JrqRjbF97d+HMZPNMm5zQlV6Pg5KCa0La3XstXazcrjTrhosmrQvs+ZSk k1BU+jD2b/bn0392updo6dJvNG73qDhpmr73j0o3AIaJscEw/9YB9QLevkWNBJradXrh T5C6nQMqU9/ibiKWbDm+wjcgaYks/skIipQD4EUHCociGuD9tGqILu93sNqY0OR9lHfl eSX/4qW/0r8c8SoGo19TU2dhREsWLLzQSUz2+5JkuyU/Ee5YFMd0GkbUf1VFcjq5ZjFb 6w5g== ARC-Authentication-Results: i=1; mx.google.com; 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 x11-20020a05640226cb00b0045d46f28533si10453160edd.377.2022.10.18.05.40.27; Tue, 18 Oct 2022 05:40:28 -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; 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 7705D68BDB2; Tue, 18 Oct 2022 15:38:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5CA7068BD15 for ; Tue, 18 Oct 2022 15:38:21 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id DD0AD2404E4 for ; Tue, 18 Oct 2022 14:38:20 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id N4qCAD3iJ0PX for ; Tue, 18 Oct 2022 14:38:20 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id E2BD0240D03 for ; Tue, 18 Oct 2022 14:38:13 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id E85373A13D9 for ; Tue, 18 Oct 2022 14:38:13 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 18 Oct 2022 14:37:01 +0200 Message-Id: <20221018123701.25002-20-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221018123701.25002-1-anton@khirnov.net> References: <20221018123701.25002-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 20/20] fftools/ffmpeg_[de]mux: constify all uses of OptionsContext 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: HDCzwyGsbADS --- fftools/ffmpeg.h | 4 ++-- fftools/ffmpeg_demux.c | 6 +++--- fftools/ffmpeg_mux_init.c | 42 +++++++++++++++++++-------------------- fftools/ffmpeg_opt.c | 2 +- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 8a50cd8d4b..0724914f27 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -715,7 +715,7 @@ int hwaccel_decode_init(AVCodecContext *avctx); */ int of_stream_init(OutputFile *of, OutputStream *ost); int of_write_trailer(OutputFile *of); -int of_open(OptionsContext *o, const char *filename); +int of_open(const OptionsContext *o, const char *filename); void of_close(OutputFile **pof); /* @@ -734,7 +734,7 @@ int64_t of_filesize(OutputFile *of); AVChapter * const * of_get_chapters(OutputFile *of, unsigned int *nb_chapters); -int ifile_open(OptionsContext *o, const char *filename); +int ifile_open(const OptionsContext *o, const char *filename); void ifile_close(InputFile **f); /** diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 4ce92862cb..eb9fa9132b 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -452,7 +452,7 @@ void ifile_close(InputFile **pf) av_freep(pf); } -static const AVCodec *choose_decoder(OptionsContext *o, AVFormatContext *s, AVStream *st, +static const AVCodec *choose_decoder(const OptionsContext *o, AVFormatContext *s, AVStream *st, enum HWAccelID hwaccel_id, enum AVHWDeviceType hwaccel_device_type) { @@ -514,7 +514,7 @@ static int guess_input_channel_layout(InputStream *ist) /* Add all the streams from the given input file to the global * list of input streams. */ -static void add_input_streams(OptionsContext *o, AVFormatContext *ic) +static void add_input_streams(const OptionsContext *o, AVFormatContext *ic) { int i, ret; @@ -756,7 +756,7 @@ static void dump_attachment(AVStream *st, const char *filename) avio_close(out); } -int ifile_open(OptionsContext *o, const char *filename) +int ifile_open(const OptionsContext *o, const char *filename) { Demuxer *d; InputFile *f; diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index 7c19cb7442..0ddb7b94dc 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -97,7 +97,7 @@ static int check_opt_bitexact(void *ctx, const AVDictionary *opts, return 0; } -static int choose_encoder(OptionsContext *o, AVFormatContext *s, +static int choose_encoder(const OptionsContext *o, AVFormatContext *s, OutputStream *ost, const AVCodec **enc) { enum AVMediaType type = ost->st->codecpar->codec_type; @@ -170,7 +170,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV return ret; } -static OutputStream *new_output_stream(Muxer *mux, OptionsContext *o, +static OutputStream *new_output_stream(Muxer *mux, const OptionsContext *o, enum AVMediaType type, int source_index) { AVFormatContext *oc = mux->fc; @@ -368,7 +368,7 @@ static OutputStream *new_output_stream(Muxer *mux, OptionsContext *o, return ost; } -static char *get_ost_filters(OptionsContext *o, AVFormatContext *oc, +static char *get_ost_filters(const OptionsContext *o, AVFormatContext *oc, OutputStream *ost) { AVStream *st = ost->st; @@ -388,7 +388,7 @@ static char *get_ost_filters(OptionsContext *o, AVFormatContext *oc, "null" : "anull"); } -static void check_streamcopy_filters(OptionsContext *o, AVFormatContext *oc, +static void check_streamcopy_filters(const OptionsContext *o, AVFormatContext *oc, const OutputStream *ost, enum AVMediaType type) { if (ost->filters_script || ost->filters) { @@ -419,7 +419,7 @@ static void parse_matrix_coeffs(uint16_t *dest, const char *str) } } -static OutputStream *new_video_stream(Muxer *mux, OptionsContext *o, int source_index) +static OutputStream *new_video_stream(Muxer *mux, const OptionsContext *o, int source_index) { AVFormatContext *oc = mux->fc; AVStream *st; @@ -658,7 +658,7 @@ static OutputStream *new_video_stream(Muxer *mux, OptionsContext *o, int source_ return ost; } -static OutputStream *new_audio_stream(Muxer *mux, OptionsContext *o, int source_index) +static OutputStream *new_audio_stream(Muxer *mux, const OptionsContext *o, int source_index) { AVFormatContext *oc = mux->fc; AVStream *st; @@ -756,7 +756,7 @@ static OutputStream *new_audio_stream(Muxer *mux, OptionsContext *o, int source_ return ost; } -static OutputStream *new_data_stream(Muxer *mux, OptionsContext *o, int source_index) +static OutputStream *new_data_stream(Muxer *mux, const OptionsContext *o, int source_index) { OutputStream *ost; @@ -769,7 +769,7 @@ static OutputStream *new_data_stream(Muxer *mux, OptionsContext *o, int source_i return ost; } -static OutputStream *new_unknown_stream(Muxer *mux, OptionsContext *o, int source_index) +static OutputStream *new_unknown_stream(Muxer *mux, const OptionsContext *o, int source_index) { OutputStream *ost; @@ -782,14 +782,14 @@ static OutputStream *new_unknown_stream(Muxer *mux, OptionsContext *o, int sourc return ost; } -static OutputStream *new_attachment_stream(Muxer *mux, OptionsContext *o, int source_index) +static OutputStream *new_attachment_stream(Muxer *mux, const OptionsContext *o, int source_index) { OutputStream *ost = new_output_stream(mux, o, AVMEDIA_TYPE_ATTACHMENT, source_index); ost->finished = 1; return ost; } -static OutputStream *new_subtitle_stream(Muxer *mux, OptionsContext *o, int source_index) +static OutputStream *new_subtitle_stream(Muxer *mux, const OptionsContext *o, int source_index) { AVStream *st; OutputStream *ost; @@ -811,7 +811,7 @@ static OutputStream *new_subtitle_stream(Muxer *mux, OptionsContext *o, int sour return ost; } -static void init_output_filter(OutputFilter *ofilter, OptionsContext *o, +static void init_output_filter(OutputFilter *ofilter, const OptionsContext *o, Muxer *mux) { OutputStream *ost; @@ -852,7 +852,7 @@ static void init_output_filter(OutputFilter *ofilter, OptionsContext *o, avfilter_inout_free(&ofilter->out_tmp); } -static void map_auto_video(Muxer *mux, OptionsContext *o) +static void map_auto_video(Muxer *mux, const OptionsContext *o) { AVFormatContext *oc = mux->fc; InputStream *ist; @@ -898,7 +898,7 @@ static void map_auto_video(Muxer *mux, OptionsContext *o) new_video_stream(mux, o, idx); } -static void map_auto_audio(Muxer *mux, OptionsContext *o) +static void map_auto_audio(Muxer *mux, const OptionsContext *o) { AVFormatContext *oc = mux->fc; InputStream *ist; @@ -937,7 +937,7 @@ static void map_auto_audio(Muxer *mux, OptionsContext *o) new_audio_stream(mux, o, idx); } -static void map_auto_subtitle(Muxer *mux, OptionsContext *o) +static void map_auto_subtitle(Muxer *mux, const OptionsContext *o) { AVFormatContext *oc = mux->fc; char *subtitle_codec_name = NULL; @@ -975,7 +975,7 @@ static void map_auto_subtitle(Muxer *mux, OptionsContext *o) } } -static void map_auto_data(Muxer *mux, OptionsContext *o) +static void map_auto_data(Muxer *mux, const OptionsContext *o) { AVFormatContext *oc = mux->fc; /* Data only if codec id match */ @@ -989,7 +989,7 @@ static void map_auto_data(Muxer *mux, OptionsContext *o) } } -static void map_manual(Muxer *mux, OptionsContext *o, const StreamMap *map) +static void map_manual(Muxer *mux, const OptionsContext *o, const StreamMap *map) { InputStream *ist; @@ -1062,7 +1062,7 @@ loop_end: } } -static void create_streams(Muxer *mux, OptionsContext *o) +static void create_streams(Muxer *mux, const OptionsContext *o) { int auto_disable_v = o->video_disable; int auto_disable_a = o->audio_disable; @@ -1194,7 +1194,7 @@ static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, int64_t buf_size_u return 0; } -static void of_add_attachments(Muxer *mux, OptionsContext *o) +static void of_add_attachments(Muxer *mux, const OptionsContext *o) { OutputStream *ost; int err; @@ -1487,7 +1487,7 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, AVFormatContext *o static int copy_metadata(const char *outspec, const char *inspec, AVFormatContext *oc, AVFormatContext *ic, int *metadata_global_manual, int *metadata_streams_manual, - int *metadata_chapters_manual, OptionsContext *o) + int *metadata_chapters_manual, const OptionsContext *o) { AVDictionary **meta_in = NULL; AVDictionary **meta_out = NULL; @@ -1567,7 +1567,7 @@ static int copy_metadata(const char *outspec, const char *inspec, return 0; } -static void copy_meta(Muxer *mux, OptionsContext *o) +static void copy_meta(Muxer *mux, const OptionsContext *o) { OutputFile *of = &mux->of; AVFormatContext *oc = mux->fc; @@ -1703,7 +1703,7 @@ static int set_dispositions(OutputFile *of, AVFormatContext *ctx) return 0; } -int of_open(OptionsContext *o, const char *filename) +int of_open(const OptionsContext *o, const char *filename) { Muxer *mux; AVFormatContext *oc; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 38916304bc..d8de283fc2 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1186,7 +1186,7 @@ static const OptionGroupDef groups[] = { }; static int open_files(OptionGroupList *l, const char *inout, - int (*open_file)(OptionsContext*, const char*)) + int (*open_file)(const OptionsContext*, const char*)) { int i, ret;