[FFmpeg-devel] [PATCH 5/7] ffmpeg: dynamically allocate stream_maps

Aurélien Jacobs aurel
Fri Aug 13 20:24:18 CEST 2010


From: Aurelien Jacobs <aurel at gnuage.org>

---
 ffmpeg.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index dcaaecf..9e55f01 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -117,8 +117,8 @@ static AVCodec **output_codecs = NULL;
 static int nb_output_files = 0;
 static int nb_output_codecs = 0;
 
-static AVStreamMap stream_maps[MAX_FILES*MAX_STREAMS];
-static int nb_stream_maps;
+static AVStreamMap *stream_maps = NULL;
+static int nb_stream_maps = 0;
 
 static AVMetaDataMap meta_data_maps[MAX_FILES];
 static int nb_meta_data_maps;
@@ -622,6 +622,7 @@ static int ffmpeg_exit(int ret)
     av_free(streamid_map);
     av_free(input_codecs);
     av_free(output_codecs);
+    av_free(stream_maps);
 
     av_free(video_codec_name);
     av_free(audio_codec_name);
@@ -3027,7 +3028,8 @@ static void opt_map(const char *arg)
     AVStreamMap *m;
     char *p;
 
-    m = &stream_maps[nb_stream_maps++];
+    GROW_ARRAY(stream_maps, nb_stream_maps+1);
+    m = &stream_maps[nb_stream_maps-1];
 
     m->file_index = strtol(arg, &p, 0);
     if (*p)
-- 
1.7.1




More information about the ffmpeg-devel mailing list