[FFmpeg-cvslog] ffplay: factor out putting null packet into the queue

Marton Balint git at videolan.org
Sun Oct 13 19:42:23 CEST 2013


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sun Oct  6 19:09:49 2013 +0200| [b118d3e24d3544afb54b8b8a1d7de386287a851a] | committer: Marton Balint

ffplay: factor out putting null packet into the queue

Signed-off-by: Marton Balint <cus at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b118d3e24d3544afb54b8b8a1d7de386287a851a
---

 ffplay.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index 42522b8..f383229 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -407,6 +407,16 @@ static int packet_queue_put(PacketQueue *q, AVPacket *pkt)
     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 */
 static void packet_queue_init(PacketQueue *q)
 {
@@ -2922,20 +2932,10 @@ static int read_thread(void *arg)
             }
         }
         if (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);
-            }
-            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);
-            }
+            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);
             SDL_Delay(10);
             eof=0;
             continue;



More information about the ffmpeg-cvslog mailing list