[FFmpeg-cvslog] r17782 - trunk/ffmpeg.c

michael subversion
Tue Mar 3 20:50:06 CET 2009


Author: michael
Date: Tue Mar  3 20:50:04 2009
New Revision: 17782

Log:
If a demuxer returns EAGAIN, try another demuxer.

Modified:
   trunk/ffmpeg.c

Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c	Tue Mar  3 19:19:44 2009	(r17781)
+++ trunk/ffmpeg.c	Tue Mar  3 20:50:04 2009	(r17782)
@@ -1553,6 +1553,8 @@ static int av_encode(AVFormatContext **o
     AVInputFile *file_table;
     int key;
     int want_sdp = 1;
+    uint8_t no_packet[MAX_FILES]={0};
+    int no_packet_count=0;
 
     file_table= av_mallocz(nb_input_files * sizeof(AVInputFile));
     if (!file_table)
@@ -2057,6 +2059,8 @@ static int av_encode(AVFormatContext **o
             ost = ost_table[i];
             os = output_files[ost->file_index];
             ist = ist_table[ost->source_index];
+            if(no_packet[ist->file_index])
+                continue;
             if(ost->st->codec->codec_type == CODEC_TYPE_VIDEO)
                 opts = ost->sync_opts * av_q2d(ost->st->codec->time_base);
             else
@@ -2079,6 +2083,11 @@ static int av_encode(AVFormatContext **o
         }
         /* if none, if is finished */
         if (file_index < 0) {
+            if(no_packet_count){
+                no_packet_count=0;
+                memset(no_packet, 0, sizeof(no_packet));
+                continue;
+            }
             break;
         }
 
@@ -2093,8 +2102,11 @@ static int av_encode(AVFormatContext **o
         /* read a frame from it and output it in the fifo */
         is = input_files[file_index];
         ret= av_read_frame(is, &pkt);
-        if(ret == AVERROR(EAGAIN) && strcmp(is->iformat->name, "ffm"))
+        if(ret == AVERROR(EAGAIN) && strcmp(is->iformat->name, "ffm")){
+            no_packet[file_index]=1;
+            no_packet_count++;
             continue;
+        }
         if (ret < 0) {
             file_table[file_index].eof_reached = 1;
             if (opt_shortest)
@@ -2103,6 +2115,9 @@ static int av_encode(AVFormatContext **o
                 continue;
         }
 
+        no_packet_count=0;
+        memset(no_packet, 0, sizeof(no_packet));
+
         if (do_pkt_dump) {
             av_pkt_dump_log(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump);
         }




More information about the ffmpeg-cvslog mailing list