aboutsummaryrefslogtreecommitdiffstats
path: root/ffplay.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-04-12 01:31:42 +0200
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2011-04-12 01:37:00 +0200
commiteef169662891c633819f2017c096b6fdfb6c2517 (patch)
tree0ba40c23fe5754efc66b634112de2ff0e1ab5fa6 /ffplay.c
parent91b27e49d66b98d894506e653cbd5272fd776108 (diff)
downloadffmpeg-eef169662891c633819f2017c096b6fdfb6c2517.tar.gz
ffplay: avoid forward declaration for packet_queue_put()
Define the function before it is used. Simplify. Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it>
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c64
1 files changed, 31 insertions, 33 deletions
diff --git a/ffplay.c b/ffplay.c
index 4b6fe8bb3e..a365b1c94a 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -284,7 +284,37 @@ static AVPacket flush_pkt;
static SDL_Surface *screen;
-static int packet_queue_put(PacketQueue *q, AVPacket *pkt);
+static int packet_queue_put(PacketQueue *q, AVPacket *pkt)
+{
+ AVPacketList *pkt1;
+
+ /* duplicate the packet */
+ if (pkt!=&flush_pkt && av_dup_packet(pkt) < 0)
+ return -1;
+
+ pkt1 = av_malloc(sizeof(AVPacketList));
+ if (!pkt1)
+ return -1;
+ pkt1->pkt = *pkt;
+ pkt1->next = NULL;
+
+
+ SDL_LockMutex(q->mutex);
+
+ if (!q->last_pkt)
+
+ q->first_pkt = pkt1;
+ else
+ q->last_pkt->next = pkt1;
+ q->last_pkt = pkt1;
+ q->nb_packets++;
+ q->size += pkt1->pkt.size + sizeof(*pkt1);
+ /* XXX: should duplicate packet data in DV case */
+ SDL_CondSignal(q->cond);
+
+ SDL_UnlockMutex(q->mutex);
+ return 0;
+}
/* packet queue handling */
static void packet_queue_init(PacketQueue *q)
@@ -319,38 +349,6 @@ static void packet_queue_end(PacketQueue *q)
SDL_DestroyCond(q->cond);
}
-static int packet_queue_put(PacketQueue *q, AVPacket *pkt)
-{
- AVPacketList *pkt1;
-
- /* duplicate the packet */
- if (pkt!=&flush_pkt && av_dup_packet(pkt) < 0)
- return -1;
-
- pkt1 = av_malloc(sizeof(AVPacketList));
- if (!pkt1)
- return -1;
- pkt1->pkt = *pkt;
- pkt1->next = NULL;
-
-
- SDL_LockMutex(q->mutex);
-
- if (!q->last_pkt)
-
- q->first_pkt = pkt1;
- else
- q->last_pkt->next = pkt1;
- q->last_pkt = pkt1;
- q->nb_packets++;
- q->size += pkt1->pkt.size + sizeof(*pkt1);
- /* XXX: should duplicate packet data in DV case */
- SDL_CondSignal(q->cond);
-
- SDL_UnlockMutex(q->mutex);
- return 0;
-}
-
static void packet_queue_abort(PacketQueue *q)
{
SDL_LockMutex(q->mutex);