[FFmpeg-cvslog] avconv: get rid of the arbitrary MAX_FILES limit.

Anton Khirnov git at videolan.org
Thu Aug 18 11:48:05 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Aug 17 10:27:17 2011 +0200| [b0c9e8e0249d9aec66e38e172649c643bb30a267] | committer: Anton Khirnov

avconv: get rid of the arbitrary MAX_FILES limit.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b0c9e8e0249d9aec66e38e172649c643bb30a267
---

 avconv.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/avconv.c b/avconv.c
index 182535d..80924c1 100644
--- a/avconv.c
+++ b/avconv.c
@@ -97,8 +97,6 @@ typedef struct MetadataMap {
 
 static const OptionDef options[];
 
-#define MAX_FILES 100
-
 static const char *last_asked_format = NULL;
 static AVDictionary *ts_scale;
 
@@ -1839,9 +1837,12 @@ static int transcode(OutputFile *output_files,
     InputStream *ist;
     char error[1024];
     int want_sdp = 1;
-    uint8_t no_packet[MAX_FILES]={0};
+    uint8_t *no_packet;
     int no_packet_count=0;
 
+    if (!(no_packet = av_mallocz(nb_input_files)))
+        exit_program(1);
+
     if (rate_emu)
         for (i = 0; i < nb_input_streams; i++)
             input_streams[i].start = av_gettime();
@@ -2266,7 +2267,7 @@ static int transcode(OutputFile *output_files,
         if (file_index < 0) {
             if(no_packet_count){
                 no_packet_count=0;
-                memset(no_packet, 0, sizeof(no_packet));
+                memset(no_packet, 0, nb_input_files);
                 usleep(10000);
                 continue;
             }
@@ -2294,7 +2295,7 @@ static int transcode(OutputFile *output_files,
         }
 
         no_packet_count=0;
-        memset(no_packet, 0, sizeof(no_packet));
+        memset(no_packet, 0, nb_input_files);
 
         if (do_pkt_dump) {
             av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump,
@@ -2407,6 +2408,7 @@ static int transcode(OutputFile *output_files,
 
  fail:
     av_freep(&bit_buffer);
+    av_freep(&no_packet);
 
     if (output_streams) {
         for (i = 0; i < nb_output_streams; i++) {
@@ -3563,8 +3565,6 @@ static void opt_output_file(const char *filename)
     av_dict_free(&metadata);
 
 
-    if (nb_output_files == MAX_FILES)
-        exit_program(1);                /* a temporary hack until all the other MAX_FILES-sized arrays are removed */
     output_files = grow_array(output_files, sizeof(*output_files), &nb_output_files, nb_output_files + 1);
     output_files[nb_output_files - 1].ctx       = oc;
     output_files[nb_output_files - 1].ost_index = nb_output_streams - oc->nb_streams;



More information about the ffmpeg-cvslog mailing list