[FFmpeg-devel] [PATCH 2/4] ffmpeg: do not reset the map when adding an input.

Clément Bœsch ubitux at gmail.com
Thu Mar 22 16:50:39 CET 2012


From: Clément Bœsch <clement.boesch at smartjog.com>

The map array contains a reference to the input file and stream, so it
won't mix up with any following specified input; there is no reason to
drop them.

Also, keeping the maps allows to create new streams on the fly and not
break the map definitions.
---
 ffmpeg.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 5606f17..32286e2 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -456,11 +456,16 @@ static void reset_options(OptionsContext *o, int is_input)
         po++;
     }
 
-    av_freep(&o->stream_maps);
+    if (!is_input)
+        av_freep(&o->stream_maps);
     av_freep(&o->audio_channel_maps);
     av_freep(&o->streamid_map);
 
     memset(o, 0, sizeof(*o));
+    if (is_input) {
+        o->stream_maps    = bak.stream_maps;
+        o->nb_stream_maps = bak.nb_stream_maps;
+    }
 
     if(is_input) o->recording_time = bak.recording_time;
     else         o->recording_time = INT64_MAX;
-- 
1.7.9.1



More information about the ffmpeg-devel mailing list