summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-03-03 19:50:04 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-03-03 19:50:04 +0000
commit545465ecaa05f60c431cc3c0ec5ff86f1c61a588 (patch)
tree46bbc38ba858070444b7db654f3ed61e8c0205af /ffmpeg.c
parent57f9a56051ee71f32dc4d3ceda581455411bc8b9 (diff)
If a demuxer returns EAGAIN, try another demuxer.
Originally committed as revision 17782 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 5181d614f9..a78c8c6a76 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1553,6 +1553,8 @@ static int av_encode(AVFormatContext **output_files,
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 **output_files,
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 **output_files,
}
/* 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 **output_files,
/* 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 **output_files,
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);
}