From 0d821edb40d27848304a7354b1c64c2e30e00e7d Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 18 Oct 2022 12:45:42 +0200 Subject: fftools/ffmpeg_mux_init: stop modifying OptionsContext.*_disable The current code will override the *_disable fields (set by -vn/-an options) when creating output streams for unlabeled complex filtergraph outputs, in order to disable automatic mapping for the corresponding media type. However, this will apply not only to automatic mappings, but to manual ones as well, which should not happen. Avoid this by adding local variables that are used only for automatic mappings. --- fftools/ffmpeg_mux_init.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'fftools') diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index 0f61fb2e4b..f40622750f 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -1064,6 +1064,11 @@ loop_end: static void create_streams(Muxer *mux, OptionsContext *o) { + int auto_disable_v = o->video_disable; + int auto_disable_a = o->audio_disable; + int auto_disable_s = o->subtitle_disable; + int auto_disable_d = o->data_disable; + /* create streams for all unlabeled output pads */ for (int i = 0; i < nb_filtergraphs; i++) { FilterGraph *fg = filtergraphs[i]; @@ -1074,9 +1079,9 @@ static void create_streams(Muxer *mux, OptionsContext *o) continue; switch (ofilter->type) { - case AVMEDIA_TYPE_VIDEO: o->video_disable = 1; break; - case AVMEDIA_TYPE_AUDIO: o->audio_disable = 1; break; - case AVMEDIA_TYPE_SUBTITLE: o->subtitle_disable = 1; break; + case AVMEDIA_TYPE_VIDEO: auto_disable_v = 1; break; + case AVMEDIA_TYPE_AUDIO: auto_disable_a = 1; break; + case AVMEDIA_TYPE_SUBTITLE: auto_disable_s = 1; break; } init_output_filter(ofilter, o, mux); } @@ -1084,13 +1089,13 @@ static void create_streams(Muxer *mux, OptionsContext *o) if (!o->nb_stream_maps) { /* pick the "best" stream of each type */ - if (!o->video_disable) + if (!auto_disable_v) map_auto_video(mux, o); - if (!o->audio_disable) + if (!auto_disable_a) map_auto_audio(mux, o); - if (!o->subtitle_disable) + if (!auto_disable_s) map_auto_subtitle(mux, o); - if (!o->data_disable) + if (!auto_disable_d) map_auto_data(mux, o); } else { for (int i = 0; i < o->nb_stream_maps; i++) -- cgit v1.2.3