summaryrefslogtreecommitdiffstats
path: root/ffplay.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2015-01-06 01:17:56 +0100
committerMarton Balint <cus@passwd.hu>2015-02-10 20:50:48 +0100
commitd6910c4b5ea97c7a81ee8fd1df1a558ee223f202 (patch)
tree660c67ad7b17f255a0b95b37109212ad46e6caf1 /ffplay.c
parent68850090b6d2effe3390a609a2cec8f16df88a77 (diff)
downloadffmpeg-streaming-d6910c4b5ea97c7a81ee8fd1df1a558ee223f202.zip
ffmpeg-streaming-d6910c4b5ea97c7a81ee8fd1df1a558ee223f202.tar.gz
ffplay: make eof part of videostate and signal it when opening a stream
Otherwise we may not flush a decoder when a new stream is opened during an already eof condition. Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ffplay.c b/ffplay.c
index 210bae5..51c3c54 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -280,6 +280,7 @@ typedef struct VideoState {
struct SwsContext *img_convert_ctx;
#endif
SDL_Rect last_display_rect;
+ int eof;
char filename[1024];
int width, height, xleft, ytop;
@@ -2687,6 +2688,7 @@ static int stream_component_open(VideoState *is, int stream_index)
goto fail;
}
+ is->eof = 0;
ic->streams[stream_index]->discard = AVDISCARD_DEFAULT;
switch (avctx->codec_type) {
case AVMEDIA_TYPE_AUDIO:
@@ -2873,7 +2875,6 @@ static int read_thread(void *arg)
int err, i, ret;
int st_index[AVMEDIA_TYPE_NB];
AVPacket pkt1, *pkt = &pkt1;
- int eof = 0;
int64_t stream_start_time;
int pkt_in_play_range = 0;
AVDictionaryEntry *t;
@@ -2887,6 +2888,7 @@ static int read_thread(void *arg)
is->last_video_stream = is->video_stream = -1;
is->last_audio_stream = is->audio_stream = -1;
is->last_subtitle_stream = is->subtitle_stream = -1;
+ is->eof = 0;
ic = avformat_alloc_context();
ic->interrupt_callback.callback = decode_interrupt_cb;
@@ -3084,7 +3086,7 @@ static int read_thread(void *arg)
}
is->seek_req = 0;
is->queue_attachments_req = 1;
- eof = 0;
+ is->eof = 0;
if (is->paused)
step_to_next_frame(is);
}
@@ -3124,14 +3126,14 @@ static int read_thread(void *arg)
}
ret = av_read_frame(ic, pkt);
if (ret < 0) {
- if ((ret == AVERROR_EOF || avio_feof(ic->pb)) && !eof) {
+ if ((ret == AVERROR_EOF || avio_feof(ic->pb)) && !is->eof) {
if (is->video_stream >= 0)
packet_queue_put_nullpacket(&is->videoq, is->video_stream);
if (is->audio_stream >= 0)
packet_queue_put_nullpacket(&is->audioq, is->audio_stream);
if (is->subtitle_stream >= 0)
packet_queue_put_nullpacket(&is->subtitleq, is->subtitle_stream);
- eof = 1;
+ is->eof = 1;
}
if (ic->pb && ic->pb->error)
break;
@@ -3140,7 +3142,7 @@ static int read_thread(void *arg)
SDL_UnlockMutex(wait_mutex);
continue;
} else {
- eof = 0;
+ is->eof = 0;
}
/* check if packet is in play range specified by user, then queue, otherwise discard */
stream_start_time = ic->streams[pkt->stream_index]->start_time;
OpenPOWER on IntegriCloud