From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id DB3C8425DB for ; Sat, 23 Jul 2022 14:14:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3A5F968B8F6; Sat, 23 Jul 2022 17:10:50 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 65BA768B82E for ; Sat, 23 Jul 2022 17:10:27 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id CBEB7240555 for ; Sat, 23 Jul 2022 16:10:23 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Vlm1wwohVWNn for ; Sat, 23 Jul 2022 16:10:23 +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 8AF28240512 for ; Sat, 23 Jul 2022 16:10:19 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 8CDB33A04A6; Sat, 23 Jul 2022 16:10:19 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Jul 2022 16:09:39 +0200 Message-Id: <20220723140952.31814-14-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220723140952.31814-1-anton@khirnov.net> References: <20220723140952.31814-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 14/27] fftools/ffmpeg: deprecate the -map_channel option 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: It is now entirely redundant with audio filters, and is in fact implemented by setting up a 'pan' filter instance. --- doc/ffmpeg.texi | 4 ++++ fftools/ffmpeg.c | 2 ++ fftools/ffmpeg.h | 7 +++++++ fftools/ffmpeg_filter.c | 2 ++ fftools/ffmpeg_opt.c | 19 ++++++++++++++++--- 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 974d1c108f..2fb0bc8ffa 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1492,6 +1492,10 @@ Allow input streams with unknown type to be copied instead of failing if copying such streams is attempted. @item -map_channel [@var{input_file_id}.@var{stream_specifier}.@var{channel_id}|-1][?][:@var{output_file_id}.@var{stream_specifier}] +This option is deprecated and will be removed. It can be replaced by the +@var{pan} filter. In some cases it may be easier to use some combination of the +@var{channelsplit}, @var{channelmap}, or @var{amerge} filters. + Map an audio channel from a given input to an output. If @var{output_file_id}.@var{stream_specifier} is not set, the audio channel will be mapped on all the audio streams. diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index ad20278aa2..19173c75e1 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -578,8 +578,10 @@ static void ffmpeg_cleanup(int ret) av_freep(&ost->avfilter); av_freep(&ost->logfile_prefix); +#if FFMPEG_OPT_MAP_CHANNEL av_freep(&ost->audio_channels_map); ost->audio_channels_mapped = 0; +#endif av_dict_free(&ost->sws_dict); av_dict_free(&ost->swr_opts); diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 66a49a0cb7..6417db03bd 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -51,6 +51,7 @@ // deprecated features #define FFMPEG_OPT_PSNR 1 +#define FFMPEG_OPT_MAP_CHANNEL 1 enum VideoSyncMethod { VSYNC_AUTO = -1, @@ -85,10 +86,12 @@ typedef struct StreamMap { char *linklabel; /* name of an output link, for mapping lavfi outputs */ } StreamMap; +#if FFMPEG_OPT_MAP_CHANNEL typedef struct { int file_idx, stream_idx, channel_idx; // input int ofile_idx, ostream_idx; // output } AudioChannelMap; +#endif typedef struct OptionsContext { OptionGroup *g; @@ -141,8 +144,10 @@ typedef struct OptionsContext { /* output options */ StreamMap *stream_maps; int nb_stream_maps; +#if FFMPEG_OPT_MAP_CHANNEL AudioChannelMap *audio_channel_maps; /* one info entry per -map_channel */ int nb_audio_channel_maps; /* number of (valid) -map_channel settings */ +#endif int metadata_global_manual; int metadata_streams_manual; int metadata_chapters_manual; @@ -516,8 +521,10 @@ typedef struct OutputStream { int dropped_keyframe; /* audio only */ +#if FFMPEG_OPT_MAP_CHANNEL int *audio_channels_map; /* list of the channels id to pick from the source stream */ int audio_channels_mapped; /* number of channels in audio_channels_map */ +#endif char *logfile_prefix; FILE *logfile; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 6807bf384a..5d00bfe056 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -560,6 +560,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, pad_idx = 0; \ } while (0) av_bprint_init(&args, 0, AV_BPRINT_SIZE_UNLIMITED); +#if FFMPEG_OPT_MAP_CHANNEL if (ost->audio_channels_mapped) { AVChannelLayout mapped_layout = { 0 }; int i; @@ -572,6 +573,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, AUTO_INSERT_FILTER("-map_channel", "pan", args.str); av_bprint_clear(&args); } +#endif if (codec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) av_channel_layout_default(&codec->ch_layout, codec->ch_layout.nb_channels); diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 444392fd45..e6f2fb597a 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -219,7 +219,9 @@ static void uninit_options(OptionsContext *o) for (i = 0; i < o->nb_stream_maps; i++) av_freep(&o->stream_maps[i].linklabel); av_freep(&o->stream_maps); +#if FFMPEG_OPT_MAP_CHANNEL av_freep(&o->audio_channel_maps); +#endif av_freep(&o->streamid_map); av_freep(&o->attachments); } @@ -534,6 +536,7 @@ static int opt_attach(void *optctx, const char *opt, const char *arg) return 0; } +#if FFMPEG_OPT_MAP_CHANNEL static int opt_map_channel(void *optctx, const char *opt, const char *arg) { OptionsContext *o = optctx; @@ -542,6 +545,12 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg) AudioChannelMap *m; char *allow_unused; char *mapchan; + + av_log(NULL, AV_LOG_WARNING, + "The -%s option is deprecated and will be removed. " + "It can be replaced by the 'pan' filter, or in some cases by " + "combinations of 'channelsplit', 'channelmap', 'amerge' filters.\n", opt); + mapchan = av_strdup(arg); if (!mapchan) return AVERROR(ENOMEM); @@ -610,6 +619,7 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg) av_free(mapchan); return 0; } +#endif static int opt_sdp_file(void *optctx, const char *opt, const char *arg) { @@ -2061,7 +2071,6 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, int source_index) { - int n; AVStream *st; OutputStream *ost; @@ -2121,8 +2130,9 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in if (!ost->avfilter) exit_program(1); +#if FFMPEG_OPT_MAP_CHANNEL /* check for channel mapping for this audio stream */ - for (n = 0; n < o->nb_audio_channel_maps; n++) { + for (int n = 0; n < o->nb_audio_channel_maps; n++) { AudioChannelMap *map = &o->audio_channel_maps[n]; if ((map->ofile_idx == -1 || ost->file_index == map->ofile_idx) && (map->ostream_idx == -1 || ost->st->index == map->ostream_idx)) { @@ -2149,6 +2159,7 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in } } } +#endif } if (ost->stream_copy) @@ -3759,8 +3770,10 @@ const OptionDef options[] = { OPT_OUTPUT, { .func_arg = opt_map }, "set input stream mapping", "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" }, +#if FFMPEG_OPT_MAP_CHANNEL { "map_channel", HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_map_channel }, - "map an audio channel from one stream to another", "file.stream.channel[:syncfile.syncstream]" }, + "map an audio channel from one stream to another (deprecated)", "file.stream.channel[:syncfile.syncstream]" }, +#endif { "map_metadata", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(metadata_map) }, "set metadata information of outfile from infile", -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".