From patchwork Wed Feb 21 09:21:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 46408 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1b29:b0:19e:cdac:8cce with SMTP id ch41csp185021pzb; Wed, 21 Feb 2024 01:21:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVy9QUtGOqD7vps3PNJgxr+ONCsPz4UVPLneNLH2el+xa2nE8aDkgXCu7/+7dRpaoTtSb1PMqYDHDPoNpEVEfCCZxOOw5cE6+Ma8A== X-Google-Smtp-Source: AGHT+IGajCXFBfo1jqhL4CSVsdeqlgTF45yp/2l4rNwUJGNm7bWQSdUGZIk36jm3Ko4+pg8o09RL X-Received: by 2002:a19:e045:0:b0:512:ceae:93d4 with SMTP id g5-20020a19e045000000b00512ceae93d4mr1111262lfj.42.1708507296237; Wed, 21 Feb 2024 01:21:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708507296; cv=none; d=google.com; s=arc-20160816; b=Znh2EYSfEC8pJbEq1olVjgSrTSVv9TibB1eLXMwDDg2kwz8N08mcsVgfcpxMM5Jzrm FyfiCHmV18Wl6PWnK4co1tg+jLmN7PiEAGQIPn0cyqtViB08xz2DGiJzQjcffm6Q+s9M ilqw2JHdwCXPbVfUapQLza89tSqE/i4ybyE62BeV6Qrtsk+w+7hGtQ8VX5Rc4EwPzNbY hD6Z5KFoZgnqaosnv2K+myUOCfFSltssMkKCsfGtP82Hqw4JxoAiIrEfQHt3bGn42ryc pZ+To+fnNDU9gYaVcradGOmPfoaXYC1U80VPuyt7LlINVGw81p8fWngBeqdyl4Mmhemq N43A== 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:message-id:date:to:from :dkim-signature:delivered-to; bh=YbCEdY/OI6u1U04nPMokLOmsYNKO0DQ/VroobrdXxG8=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=n3uiDrI8BOpc7RObJ//ZCHK56pjnr8/EmMjgXQAC7U24Ajbugo2q0ArMXv1EB14N0J EkNM5q6hua9rknAQ0fEiiy3WLjzY7Ka49slsVT9lnT7/uUCGzVHfAcm9smN+oumJuLVi 2GW0sGw3oTOAKSgmaF6hs1thmJMF9kL6RPXKxxNd/cChCcejYQVAAS1h2SnCBPKnBoQy P+jxb0xUYUCuBwIdWb8JFwH/leTXyZilAcvtfKQqy7XYidNL+y/HiDA4VNV3yR0h936o UJiy4FTxRm8u/Ux2iB/7S0pSlZi7BM849wDVzIv5BplF0t9wuHsF5REWbT8awhx3xYS3 sOdQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=W391lm+w; 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 v17-20020a056402349100b00564bbfc405csi1683808edc.451.2024.02.21.01.21.35; Wed, 21 Feb 2024 01:21:36 -0800 (PST) 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=@khirnov.net header.s=mail header.b=W391lm+w; 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 6E87568D188; Wed, 21 Feb 2024 11:21:32 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 02C9368CAEC for ; Wed, 21 Feb 2024 11:21:26 +0200 (EET) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=W391lm+w; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id D785119C0 for ; Wed, 21 Feb 2024 10:21:24 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id sgCLCxo3eyNQ for ; Wed, 21 Feb 2024 10:21:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1708507283; bh=IV8RO738jX15s3lfDM3WJVPpZA54+IKiaxuXLDT44nM=; h=From:To:Subject:Date:From; b=W391lm+wyTuSfRpqpRehBmal9Cbt1pPepeLFPaX+B9ex/4syMo8db3/OgeeBZCZd+ uycMLKRCMdlJP6zAUwc/DapNOhikg4lYzeXUSiq+vEOTh9CGnCXh8BCDIBFGGVZBQG 53vTkX8/zjZIweofFw3VOesMeYZx1TnZ7mTL00tJ2GPPe1LUUgfDS9YElGVMCWu9ji 60ZWRgxlYc7IfmLYd5jD/tcMpnByHJUZqiTgWmO268IU7N0GCgpWKCRAGF7Vn6Wctl BQqg4+6D2Ci7IFrSKP/dj0KrIh78i7Qg/h2HTRlGjZopky+OT4JcqxhCbTPkn2hL0V tiyLHqnzQKihg== 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 mail1.khirnov.net (Postfix) with ESMTPS id AB8EEFE1 for ; Wed, 21 Feb 2024 10:21:23 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 852E53A0327 for ; Wed, 21 Feb 2024 10:21:23 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 21 Feb 2024 10:21:19 +0100 Message-ID: <20240221092119.27418-1-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] fftools/ffmpeg: remove options deprecated before 6.0 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: ACs214ck4iEI --- Changelog | 1 + doc/ffmpeg.texi | 75 ----------------------- fftools/ffmpeg.h | 31 ---------- fftools/ffmpeg_filter.c | 14 ----- fftools/ffmpeg_mux.c | 5 -- fftools/ffmpeg_mux_init.c | 75 +---------------------- fftools/ffmpeg_opt.c | 122 -------------------------------------- tests/fate/ffmpeg.mak | 25 -------- 8 files changed, 3 insertions(+), 345 deletions(-) diff --git a/Changelog b/Changelog index 610ee61dd6..ab95a4b730 100644 --- a/Changelog +++ b/Changelog @@ -27,6 +27,7 @@ version : - a C11-compliant compiler is now required; note that this requirement will be bumped to C17 in the near future, so consider updating your build environment if it lacks C17 support +- removed deprecated ffmpeg CLI options -psnr and -map_channel version 6.1: - libaribcaption decoder diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 5a214dd139..bee3cd4c70 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1230,10 +1230,6 @@ list separated with slashes. Two first values are the beginning and end frame numbers, last one is quantizer to use if positive, or quality factor if negative. -@item -psnr -Calculate PSNR of compressed frames. This option is deprecated, pass the -PSNR flag to the encoder instead, using @code{-flags +psnr}. - @item -vstats Dump video coding statistics to @file{vstats_HHMMSS.log}. See the @ref{vstats_file_format,,vstats file format} section for the format description. @@ -1806,77 +1802,6 @@ such streams is attempted. 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. - -Using "-1" instead of -@var{input_file_id}.@var{stream_specifier}.@var{channel_id} will map a muted -channel. - -A trailing @code{?} will allow the map_channel to be -optional: if the map_channel matches no channel the map_channel will be ignored instead -of failing. - -For example, assuming @var{INPUT} is a stereo audio file, you can switch the -two audio channels with the following command: -@example -ffmpeg -i INPUT -map_channel 0.0.1 -map_channel 0.0.0 OUTPUT -@end example - -If you want to mute the first channel and keep the second: -@example -ffmpeg -i INPUT -map_channel -1 -map_channel 0.0.1 OUTPUT -@end example - -The order of the "-map_channel" option specifies the order of the channels in -the output stream. The output channel layout is guessed from the number of -channels mapped (mono if one "-map_channel", stereo if two, etc.). Using "-ac" -in combination of "-map_channel" makes the channel gain levels to be updated if -input and output channel layouts don't match (for instance two "-map_channel" -options and "-ac 6"). - -You can also extract each channel of an input to specific outputs; the following -command extracts two channels of the @var{INPUT} audio stream (file 0, stream 0) -to the respective @var{OUTPUT_CH0} and @var{OUTPUT_CH1} outputs: -@example -ffmpeg -i INPUT -map_channel 0.0.0 OUTPUT_CH0 -map_channel 0.0.1 OUTPUT_CH1 -@end example - -The following example splits the channels of a stereo input into two separate -streams, which are put into the same output file: -@example -ffmpeg -i stereo.wav -map 0:0 -map 0:0 -map_channel 0.0.0:0.0 -map_channel 0.0.1:0.1 -y out.ogg -@end example - -Note that currently each output stream can only contain channels from a single -input stream; you can't for example use "-map_channel" to pick multiple input -audio channels contained in different streams (from the same or different files) -and merge them into a single output stream. It is therefore not currently -possible, for example, to turn two separate mono streams into a single stereo -stream. However splitting a stereo stream into two single channel mono streams -is possible. - -If you need this feature, a possible workaround is to use the @emph{amerge} -filter. For example, if you need to merge a media (here @file{input.mkv}) with 2 -mono audio streams into one single stereo channel audio stream (and keep the -video stream), you can use the following command: -@example -ffmpeg -i input.mkv -filter_complex "[0:1] [0:2] amerge" -c:a pcm_s16le -c:v copy output.mkv -@end example - -To map the first two audio channels from the first input, and using the -trailing @code{?}, ignore the audio channel mapping if the first input is -mono instead of stereo: -@example -ffmpeg -i INPUT -map_channel 0.0.0 -map_channel 0.0.1? OUTPUT -@end example - @item -map_metadata[:@var{metadata_spec_out}] @var{infile}[:@var{metadata_spec_in}] (@emph{output,per-metadata}) Set metadata information of the next output file from @var{infile}. Note that those are file indices (zero-based), not filenames. diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index c394f60962..ea86c09857 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -51,10 +51,6 @@ #include "libswresample/swresample.h" // deprecated features -#define FFMPEG_OPT_PSNR 1 -#define FFMPEG_OPT_MAP_CHANNEL 1 -#define FFMPEG_OPT_MAP_SYNC 1 -#define FFMPEG_ROTATION_METADATA 1 #define FFMPEG_OPT_QPHIST 1 #define FFMPEG_OPT_ADRIFT_THRESHOLD 1 #define FFMPEG_OPT_ENC_TIME_BASE_NUM 1 @@ -124,13 +120,6 @@ 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; @@ -170,10 +159,6 @@ 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 const char **attachments; int nb_attachments; @@ -524,27 +509,15 @@ typedef struct OutputStream { int force_fps; #if FFMPEG_OPT_TOP int top_field_first; -#endif -#if FFMPEG_ROTATION_METADATA - int rotate_overridden; #endif int autoscale; int bitexact; int bits_per_raw_sample; -#if FFMPEG_ROTATION_METADATA - double rotate_override_value; -#endif AVRational frame_aspect_ratio; KeyframeForceCtx kf; - /* 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; @@ -669,10 +642,6 @@ extern int recast_media; extern FILE *vstats_file; -#if FFMPEG_OPT_PSNR -extern int do_psnr; -#endif - void term_init(void); void term_exit(void); diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 38ddd1963a..44126d2e2c 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1351,20 +1351,6 @@ static int configure_output_audio_filter(FilterGraph *fg, AVFilterGraph *graph, 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; - av_channel_layout_default(&mapped_layout, ost->audio_channels_mapped); - av_channel_layout_describe_bprint(&mapped_layout, &args); - for (i = 0; i < ost->audio_channels_mapped; i++) - if (ost->audio_channels_map[i] != -1) - av_bprintf(&args, "|c%d=c%d", i, ost->audio_channels_map[i]); - - AUTO_INSERT_FILTER("-map_channel", "pan", args.str); - av_bprint_clear(&args); - } -#endif choose_sample_fmts(ofp, &args); choose_sample_rates(ofp, &args); diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index 5a648c0568..2dd65baf38 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -819,11 +819,6 @@ static void ost_free(OutputStream **post) av_freep(&ost->attachment_filename); -#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_mux_init.c b/fftools/ffmpeg_mux_init.c index 1abbb2d945..7fb67e22ea 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -707,13 +707,6 @@ static int new_stream_video(Muxer *mux, const OptionsContext *o, } video_enc->rc_override_count = i; -#if FFMPEG_OPT_PSNR - if (do_psnr) { - av_log(ost, AV_LOG_WARNING, "The -psnr option is deprecated, use -flags +psnr\n"); - video_enc->flags|= AV_CODEC_FLAG_PSNR; - } -#endif - /* two pass mode */ MATCH_PER_STREAM_OPT(pass, i, do_pass, oc, st); if (do_pass) { @@ -833,10 +826,7 @@ static int new_stream_audio(Muxer *mux, const OptionsContext *o, OutputStream *ost) { AVFormatContext *oc = mux->fc; - AVStream *st; - int ret = 0; - - st = ost->st; + AVStream *st = ost->st; if (ost->enc_ctx) { AVCodecContext *audio_enc = ost->enc_ctx; @@ -882,37 +872,6 @@ static int new_stream_audio(Muxer *mux, const OptionsContext *o, MATCH_PER_STREAM_OPT(apad, str, ost->apad, oc, st); ost->apad = av_strdup(ost->apad); - -#if FFMPEG_OPT_MAP_CHANNEL - /* check for channel mapping for this audio stream */ - 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)) { - InputStream *ist; - - if (map->channel_idx == -1) { - ist = NULL; - } else if (!ost->ist) { - av_log(ost, AV_LOG_FATAL, "Cannot determine input stream for channel mapping %d.%d\n", - ost->file->index, ost->st->index); - continue; - } else { - ist = ost->ist; - } - - if (!ist || (ist->file->index == map->file_idx && ist->index == map->stream_idx)) { - ret = av_reallocp_array(&ost->audio_channels_map, - ost->audio_channels_mapped + 1, - sizeof(*ost->audio_channels_map)); - if (ret < 0) - return ret; - - ost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx; - } - } - } -#endif } return 0; @@ -1050,17 +1009,6 @@ static int streamcopy_init(const Muxer *mux, OutputStream *ost) memcpy(sd_dst->data, sd_src->data, sd_src->size); } -#if FFMPEG_ROTATION_METADATA - if (ost->rotate_overridden) { - AVPacketSideData *sd = av_packet_side_data_new(&ost->st->codecpar->coded_side_data, - &ost->st->codecpar->nb_coded_side_data, - AV_PKT_DATA_DISPLAYMATRIX, - sizeof(int32_t) * 9, 0); - if (sd) - av_display_rotation_set((int32_t *)sd->data, -ost->rotate_override_value); - } -#endif - switch (par->codec_type) { case AVMEDIA_TYPE_AUDIO: if ((par->block_align == 1 || par->block_align == 1152 || par->block_align == 576) && @@ -2483,26 +2431,7 @@ static int of_add_metadata(OutputFile *of, AVFormatContext *oc, for (int j = 0; j < oc->nb_streams; j++) { OutputStream *ost = of->streams[j]; if ((ret = check_stream_specifier(oc, oc->streams[j], stream_spec)) > 0) { -#if FFMPEG_ROTATION_METADATA - if (!strcmp(o->metadata.opt[i].u.str, "rotate")) { - char *tail; - double theta = av_strtod(val, &tail); - if (!*tail) { - ost->rotate_overridden = 1; - ost->rotate_override_value = theta; - } - - av_log(ost, AV_LOG_WARNING, - "Conversion of a 'rotate' metadata key to a " - "proper display matrix rotation is deprecated. " - "See -display_rotation for setting rotation " - "instead."); - } else { -#endif - av_dict_set(&oc->streams[j]->metadata, o->metadata.opt[i].u.str, *val ? val : NULL, 0); -#if FFMPEG_ROTATION_METADATA - } -#endif + av_dict_set(&oc->streams[j]->metadata, o->metadata.opt[i].u.str, *val ? val : NULL, 0); } else if (ret < 0) return ret; } diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 7505b0cf90..a9a785a0ac 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -88,9 +88,6 @@ int64_t stats_period = 500000; static int file_overwrite = 0; static int no_file_overwrite = 0; -#if FFMPEG_OPT_PSNR -int do_psnr = 0; -#endif int ignore_unknown_streams = 0; int copy_unknown_streams = 0; int recast_media = 0; @@ -121,9 +118,6 @@ 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 for (i = 0; i < o->nb_attachments; i++) av_freep(&o->attachments[i]); @@ -403,19 +397,6 @@ static int opt_map(void *optctx, const char *opt, const char *arg) if (!map) return AVERROR(ENOMEM); -#if FFMPEG_OPT_MAP_SYNC - { - /* parse sync stream first, just pick first matching stream */ - char *sync = strchr(map, ','); - - if (sync) { - *sync = 0; - av_log(NULL, AV_LOG_WARNING, "Specifying a sync stream is deprecated and has no effect\n"); - } - } -#endif - - if (map[0] == '[') { /* this mapping refers to lavfi output */ const char *c = map + 1; @@ -505,99 +486,6 @@ 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; - int n, ret; - AVStream *st; - 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); - - ret = GROW_ARRAY(o->audio_channel_maps, o->nb_audio_channel_maps); - if (ret < 0) - goto end; - - m = &o->audio_channel_maps[o->nb_audio_channel_maps - 1]; - - /* muted channel syntax */ - n = sscanf(arg, "%d:%d.%d", &m->channel_idx, &m->ofile_idx, &m->ostream_idx); - if ((n == 1 || n == 3) && m->channel_idx == -1) { - m->file_idx = m->stream_idx = -1; - if (n == 1) - m->ofile_idx = m->ostream_idx = -1; - av_free(mapchan); - return 0; - } - - /* normal syntax */ - n = sscanf(arg, "%d.%d.%d:%d.%d", - &m->file_idx, &m->stream_idx, &m->channel_idx, - &m->ofile_idx, &m->ostream_idx); - - if (n != 3 && n != 5) { - av_log(NULL, AV_LOG_FATAL, "Syntax error, mapchan usage: " - "[file.stream.channel|-1][:syncfile:syncstream]\n"); - goto fail; - } - - if (n != 5) // only file.stream.channel specified - m->ofile_idx = m->ostream_idx = -1; - - /* check input */ - if (m->file_idx < 0 || m->file_idx >= nb_input_files) { - av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file index: %d\n", - m->file_idx); - goto fail; - } - if (m->stream_idx < 0 || - m->stream_idx >= input_files[m->file_idx]->nb_streams) { - av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file stream index #%d.%d\n", - m->file_idx, m->stream_idx); - goto fail; - } - st = input_files[m->file_idx]->ctx->streams[m->stream_idx]; - if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) { - av_log(NULL, AV_LOG_FATAL, "mapchan: stream #%d.%d is not an audio stream.\n", - m->file_idx, m->stream_idx); - goto fail; - } - /* allow trailing ? to map_channel */ - if (allow_unused = strchr(mapchan, '?')) - *allow_unused = 0; - if (m->channel_idx < 0 || m->channel_idx >= st->codecpar->ch_layout.nb_channels || - input_files[m->file_idx]->streams[m->stream_idx]->user_set_discard == AVDISCARD_ALL) { - if (allow_unused) { - av_log(NULL, AV_LOG_VERBOSE, "mapchan: invalid audio channel #%d.%d.%d\n", - m->file_idx, m->stream_idx, m->channel_idx); - } else { - av_log(NULL, AV_LOG_FATAL, "mapchan: invalid audio channel #%d.%d.%d\n" - "To ignore this, add a trailing '?' to the map_channel.\n", - m->file_idx, m->stream_idx, m->channel_idx); - goto fail; - } - - } - ret = 0; -end: - av_free(mapchan); - return ret; -fail: - ret = AVERROR(EINVAL); - goto end; -} -#endif - static int opt_sdp_file(void *optctx, const char *opt, const char *arg) { Scheduler *sch = optctx; @@ -2005,21 +1893,11 @@ const OptionDef options[] = { "set hardware device used when filtering", "device" }, // deprecated options -#if FFMPEG_OPT_MAP_CHANNEL - { "map_channel", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, - { .func_arg = opt_map_channel }, - "map an audio channel from one stream to another (deprecated)", "file.stream.channel[:syncfile.syncstream]" }, -#endif #if FFMPEG_OPT_ADRIFT_THRESHOLD { "adrift_threshold", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_adrift_threshold }, "deprecated, does nothing", "threshold" }, #endif -#if FFMPEG_OPT_PSNR - { "psnr", OPT_TYPE_BOOL, OPT_VIDEO | OPT_EXPERT, - { &do_psnr }, - "calculate PSNR of compressed frames (deprecated, use -flags +psnr)" }, -#endif #if FFMPEG_OPT_TOP { "top", OPT_TYPE_INT, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(top_field_first) }, diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak index 3f21815ba2..669c878c7f 100644 --- a/tests/fate/ffmpeg.mak +++ b/tests/fate/ffmpeg.mak @@ -1,28 +1,3 @@ -FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV, MD5_PROTOCOL) += fate-mapchan-6ch-extract-2 -fate-mapchan-6ch-extract-2: tests/data/asynth-22050-6.wav -fate-mapchan-6ch-extract-2: CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-22050-6.wav -map_channel 0.0.0 -fflags +bitexact -f wav md5: -map_channel 0.0.1 -fflags +bitexact -f wav md5: - -FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN ARESAMPLE, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-6ch-extract-2-downmix-mono -fate-mapchan-6ch-extract-2-downmix-mono: tests/data/asynth-22050-6.wav -fate-mapchan-6ch-extract-2-downmix-mono: CMD = md5 -auto_conversion_filters -i $(TARGET_PATH)/tests/data/asynth-22050-6.wav -map_channel 0.0.1 -map_channel 0.0.0 -ac 1 -fflags +bitexact -f wav - -FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-silent-mono -fate-mapchan-silent-mono: tests/data/asynth-22050-1.wav -fate-mapchan-silent-mono: CMD = md5 -i $(TARGET_PATH)/tests/data/asynth-22050-1.wav -map_channel -1 -map_channel 0.0.0 -fflags +bitexact -f wav - -FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-2ch-extract-ch0-ch2-trailing -fate-mapchan-2ch-extract-ch0-ch2-trailing: tests/data/asynth-44100-2.wav -fate-mapchan-2ch-extract-ch0-ch2-trailing: CMD = md5 -i $(TARGET_PATH)/tests/data/asynth-44100-2.wav -map_channel 0.0.0 -map_channel 0.0.2? -fflags +bitexact -f wav - -FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-3ch-extract-ch0-ch2-trailing -fate-mapchan-3ch-extract-ch0-ch2-trailing: tests/data/asynth-44100-3.wav -fate-mapchan-3ch-extract-ch0-ch2-trailing: CMD = md5 -i $(TARGET_PATH)/tests/data/asynth-44100-3.wav -map_channel 0.0.0 -map_channel 0.0.2? -fflags +bitexact -f wav - -FATE_MAPCHAN = $(FATE_MAPCHAN-yes) - -FATE_FFMPEG += $(FATE_MAPCHAN) -fate-mapchan: $(FATE_MAPCHAN) - FATE_FFMPEG-$(call FILTERFRAMECRC, COLOR) += fate-ffmpeg-filter_complex fate-ffmpeg-filter_complex: CMD = framecrc -filter_complex color=d=1:r=5 -fflags +bitexact