You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
fftools/ffmpeg: deprecate the -map_channel option
It is now entirely redundant with audio filters, and is in fact implemented by setting up a 'pan' filter instance.
This commit is contained in:
@@ -1492,6 +1492,10 @@ Allow input streams with unknown type to be copied instead of failing if copying
|
|||||||
such streams is attempted.
|
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}]
|
@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
|
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
|
@var{output_file_id}.@var{stream_specifier} is not set, the audio channel will
|
||||||
be mapped on all the audio streams.
|
be mapped on all the audio streams.
|
||||||
|
@@ -578,8 +578,10 @@ static void ffmpeg_cleanup(int ret)
|
|||||||
av_freep(&ost->avfilter);
|
av_freep(&ost->avfilter);
|
||||||
av_freep(&ost->logfile_prefix);
|
av_freep(&ost->logfile_prefix);
|
||||||
|
|
||||||
|
#if FFMPEG_OPT_MAP_CHANNEL
|
||||||
av_freep(&ost->audio_channels_map);
|
av_freep(&ost->audio_channels_map);
|
||||||
ost->audio_channels_mapped = 0;
|
ost->audio_channels_mapped = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
av_dict_free(&ost->sws_dict);
|
av_dict_free(&ost->sws_dict);
|
||||||
av_dict_free(&ost->swr_opts);
|
av_dict_free(&ost->swr_opts);
|
||||||
|
@@ -51,6 +51,7 @@
|
|||||||
|
|
||||||
// deprecated features
|
// deprecated features
|
||||||
#define FFMPEG_OPT_PSNR 1
|
#define FFMPEG_OPT_PSNR 1
|
||||||
|
#define FFMPEG_OPT_MAP_CHANNEL 1
|
||||||
|
|
||||||
enum VideoSyncMethod {
|
enum VideoSyncMethod {
|
||||||
VSYNC_AUTO = -1,
|
VSYNC_AUTO = -1,
|
||||||
@@ -85,10 +86,12 @@ typedef struct StreamMap {
|
|||||||
char *linklabel; /* name of an output link, for mapping lavfi outputs */
|
char *linklabel; /* name of an output link, for mapping lavfi outputs */
|
||||||
} StreamMap;
|
} StreamMap;
|
||||||
|
|
||||||
|
#if FFMPEG_OPT_MAP_CHANNEL
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int file_idx, stream_idx, channel_idx; // input
|
int file_idx, stream_idx, channel_idx; // input
|
||||||
int ofile_idx, ostream_idx; // output
|
int ofile_idx, ostream_idx; // output
|
||||||
} AudioChannelMap;
|
} AudioChannelMap;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct OptionsContext {
|
typedef struct OptionsContext {
|
||||||
OptionGroup *g;
|
OptionGroup *g;
|
||||||
@@ -141,8 +144,10 @@ typedef struct OptionsContext {
|
|||||||
/* output options */
|
/* output options */
|
||||||
StreamMap *stream_maps;
|
StreamMap *stream_maps;
|
||||||
int nb_stream_maps;
|
int nb_stream_maps;
|
||||||
|
#if FFMPEG_OPT_MAP_CHANNEL
|
||||||
AudioChannelMap *audio_channel_maps; /* one info entry per -map_channel */
|
AudioChannelMap *audio_channel_maps; /* one info entry per -map_channel */
|
||||||
int nb_audio_channel_maps; /* number of (valid) -map_channel settings */
|
int nb_audio_channel_maps; /* number of (valid) -map_channel settings */
|
||||||
|
#endif
|
||||||
int metadata_global_manual;
|
int metadata_global_manual;
|
||||||
int metadata_streams_manual;
|
int metadata_streams_manual;
|
||||||
int metadata_chapters_manual;
|
int metadata_chapters_manual;
|
||||||
@@ -516,8 +521,10 @@ typedef struct OutputStream {
|
|||||||
int dropped_keyframe;
|
int dropped_keyframe;
|
||||||
|
|
||||||
/* audio only */
|
/* 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_map; /* list of the channels id to pick from the source stream */
|
||||||
int audio_channels_mapped; /* number of channels in audio_channels_map */
|
int audio_channels_mapped; /* number of channels in audio_channels_map */
|
||||||
|
#endif
|
||||||
|
|
||||||
char *logfile_prefix;
|
char *logfile_prefix;
|
||||||
FILE *logfile;
|
FILE *logfile;
|
||||||
|
@@ -560,6 +560,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
|
|||||||
pad_idx = 0; \
|
pad_idx = 0; \
|
||||||
} while (0)
|
} while (0)
|
||||||
av_bprint_init(&args, 0, AV_BPRINT_SIZE_UNLIMITED);
|
av_bprint_init(&args, 0, AV_BPRINT_SIZE_UNLIMITED);
|
||||||
|
#if FFMPEG_OPT_MAP_CHANNEL
|
||||||
if (ost->audio_channels_mapped) {
|
if (ost->audio_channels_mapped) {
|
||||||
AVChannelLayout mapped_layout = { 0 };
|
AVChannelLayout mapped_layout = { 0 };
|
||||||
int i;
|
int i;
|
||||||
@@ -572,6 +573,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
|
|||||||
AUTO_INSERT_FILTER("-map_channel", "pan", args.str);
|
AUTO_INSERT_FILTER("-map_channel", "pan", args.str);
|
||||||
av_bprint_clear(&args);
|
av_bprint_clear(&args);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (codec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
|
if (codec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
|
||||||
av_channel_layout_default(&codec->ch_layout, codec->ch_layout.nb_channels);
|
av_channel_layout_default(&codec->ch_layout, codec->ch_layout.nb_channels);
|
||||||
|
@@ -219,7 +219,9 @@ static void uninit_options(OptionsContext *o)
|
|||||||
for (i = 0; i < o->nb_stream_maps; i++)
|
for (i = 0; i < o->nb_stream_maps; i++)
|
||||||
av_freep(&o->stream_maps[i].linklabel);
|
av_freep(&o->stream_maps[i].linklabel);
|
||||||
av_freep(&o->stream_maps);
|
av_freep(&o->stream_maps);
|
||||||
|
#if FFMPEG_OPT_MAP_CHANNEL
|
||||||
av_freep(&o->audio_channel_maps);
|
av_freep(&o->audio_channel_maps);
|
||||||
|
#endif
|
||||||
av_freep(&o->streamid_map);
|
av_freep(&o->streamid_map);
|
||||||
av_freep(&o->attachments);
|
av_freep(&o->attachments);
|
||||||
}
|
}
|
||||||
@@ -534,6 +536,7 @@ static int opt_attach(void *optctx, const char *opt, const char *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FFMPEG_OPT_MAP_CHANNEL
|
||||||
static int opt_map_channel(void *optctx, const char *opt, const char *arg)
|
static int opt_map_channel(void *optctx, const char *opt, const char *arg)
|
||||||
{
|
{
|
||||||
OptionsContext *o = optctx;
|
OptionsContext *o = optctx;
|
||||||
@@ -542,6 +545,12 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg)
|
|||||||
AudioChannelMap *m;
|
AudioChannelMap *m;
|
||||||
char *allow_unused;
|
char *allow_unused;
|
||||||
char *mapchan;
|
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);
|
mapchan = av_strdup(arg);
|
||||||
if (!mapchan)
|
if (!mapchan)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
@@ -610,6 +619,7 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg)
|
|||||||
av_free(mapchan);
|
av_free(mapchan);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
|
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)
|
static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
|
||||||
{
|
{
|
||||||
int n;
|
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
OutputStream *ost;
|
OutputStream *ost;
|
||||||
|
|
||||||
@@ -2121,8 +2130,9 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in
|
|||||||
if (!ost->avfilter)
|
if (!ost->avfilter)
|
||||||
exit_program(1);
|
exit_program(1);
|
||||||
|
|
||||||
|
#if FFMPEG_OPT_MAP_CHANNEL
|
||||||
/* check for channel mapping for this audio stream */
|
/* 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];
|
AudioChannelMap *map = &o->audio_channel_maps[n];
|
||||||
if ((map->ofile_idx == -1 || ost->file_index == map->ofile_idx) &&
|
if ((map->ofile_idx == -1 || ost->file_index == map->ofile_idx) &&
|
||||||
(map->ostream_idx == -1 || ost->st->index == map->ostream_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)
|
if (ost->stream_copy)
|
||||||
@@ -3759,8 +3770,10 @@ const OptionDef options[] = {
|
|||||||
OPT_OUTPUT, { .func_arg = opt_map },
|
OPT_OUTPUT, { .func_arg = opt_map },
|
||||||
"set input stream mapping",
|
"set input stream mapping",
|
||||||
"[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
|
"[-]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_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 |
|
{ "map_metadata", HAS_ARG | OPT_STRING | OPT_SPEC |
|
||||||
OPT_OUTPUT, { .off = OFFSET(metadata_map) },
|
OPT_OUTPUT, { .off = OFFSET(metadata_map) },
|
||||||
"set metadata information of outfile from infile",
|
"set metadata information of outfile from infile",
|
||||||
|
Reference in New Issue
Block a user