Browse code

ffmpeg: dynamically allocate stream_maps

Originally committed as revision 25302 to svn://svn.ffmpeg.org/ffmpeg/trunk

Aurelien Jacobs authored on 2010/10/02 06:52:09
Showing 1 changed files
... ...
@@ -118,7 +118,7 @@ static AVCodec **output_codecs = NULL;
118 118
 static int nb_output_files = 0;
119 119
 static int nb_output_codecs = 0;
120 120
 
121
-static AVStreamMap stream_maps[MAX_FILES*MAX_STREAMS];
121
+static AVStreamMap *stream_maps = NULL;
122 122
 static int nb_stream_maps;
123 123
 
124 124
 static AVMetaDataMap meta_data_maps[MAX_FILES];
... ...
@@ -623,6 +623,7 @@ static int ffmpeg_exit(int ret)
623 623
     av_free(streamid_map);
624 624
     av_free(input_codecs);
625 625
     av_free(output_codecs);
626
+    av_free(stream_maps);
626 627
 
627 628
     av_free(video_codec_name);
628 629
     av_free(audio_codec_name);
... ...
@@ -3032,7 +3033,8 @@ static void opt_map(const char *arg)
3032 3032
     AVStreamMap *m;
3033 3033
     char *p;
3034 3034
 
3035
-    m = &stream_maps[nb_stream_maps++];
3035
+    stream_maps = grow_array(stream_maps, sizeof(*stream_maps), &nb_stream_maps, nb_stream_maps + 1);
3036
+    m = &stream_maps[nb_stream_maps-1];
3036 3037
 
3037 3038
     m->file_index = strtol(arg, &p, 0);
3038 3039
     if (*p)