ffplay: factor out putting null packet into the queue
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
parent
fa7e9f9401
commit
b118d3e24d
28
ffplay.c
28
ffplay.c
@ -407,6 +407,16 @@ static int packet_queue_put(PacketQueue *q, AVPacket *pkt)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int packet_queue_put_nullpacket(PacketQueue *q, int stream_index)
|
||||||
|
{
|
||||||
|
AVPacket pkt1, *pkt = &pkt1;
|
||||||
|
av_init_packet(pkt);
|
||||||
|
pkt->data = NULL;
|
||||||
|
pkt->size = 0;
|
||||||
|
pkt->stream_index = stream_index;
|
||||||
|
return packet_queue_put(q, pkt);
|
||||||
|
}
|
||||||
|
|
||||||
/* packet queue handling */
|
/* packet queue handling */
|
||||||
static void packet_queue_init(PacketQueue *q)
|
static void packet_queue_init(PacketQueue *q)
|
||||||
{
|
{
|
||||||
@ -2922,20 +2932,10 @@ static int read_thread(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (eof) {
|
if (eof) {
|
||||||
if (is->video_stream >= 0) {
|
if (is->video_stream >= 0)
|
||||||
av_init_packet(pkt);
|
packet_queue_put_nullpacket(&is->videoq, is->video_stream);
|
||||||
pkt->data = NULL;
|
if (is->audio_stream >= 0)
|
||||||
pkt->size = 0;
|
packet_queue_put_nullpacket(&is->audioq, is->audio_stream);
|
||||||
pkt->stream_index = is->video_stream;
|
|
||||||
packet_queue_put(&is->videoq, pkt);
|
|
||||||
}
|
|
||||||
if (is->audio_stream >= 0) {
|
|
||||||
av_init_packet(pkt);
|
|
||||||
pkt->data = NULL;
|
|
||||||
pkt->size = 0;
|
|
||||||
pkt->stream_index = is->audio_stream;
|
|
||||||
packet_queue_put(&is->audioq, pkt);
|
|
||||||
}
|
|
||||||
SDL_Delay(10);
|
SDL_Delay(10);
|
||||||
eof=0;
|
eof=0;
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user