int err, i, ret, video_index, audio_index, subtitle_index;
AVPacket pkt1, *pkt = &pkt1;
AVFormatParameters params, *ap = ¶ms;
+ int eof=0;
video_index = -1;
audio_index = -1;
}
}
is->seek_req = 0;
+ eof= 0;
}
/* if the queue are full, no need to read more */
SDL_Delay(10);
continue;
}
- if(url_feof(ic->pb)) {
- av_init_packet(pkt);
- pkt->data=NULL;
- pkt->size=0;
- pkt->stream_index= is->video_stream;
- packet_queue_put(&is->videoq, pkt);
+ if(url_feof(ic->pb) || eof) {
+ if(is->video_stream >= 0){
+ av_init_packet(pkt);
+ pkt->data=NULL;
+ pkt->size=0;
+ pkt->stream_index= is->video_stream;
+ packet_queue_put(&is->videoq, pkt);
+ }
+ SDL_Delay(10);
continue;
}
ret = av_read_frame(ic, pkt);
if (ret < 0) {
- if (ret != AVERROR_EOF && url_ferror(ic->pb) == 0) {
- SDL_Delay(100); /* wait for user event */
- continue;
- } else
+ if (ret == AVERROR_EOF)
+ eof=1;
+ if (url_ferror(ic->pb))
break;
+ SDL_Delay(100); /* wait for user event */
+ continue;
}
if (pkt->stream_index == is->audio_stream) {
packet_queue_put(&is->audioq, pkt);