1
/*****************************************************************************
2
* dynamicoverlay_commands.c : dynamic overlay plugin commands
3
*****************************************************************************
4
* Copyright (C) 2008 the VideoLAN team
7
* Author: Søren Bøg <avacore@videolan.org>
8
* Jean-Paul Saman <jpsaman@videolan.org>
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23
*****************************************************************************/
29
#include <vlc_common.h>
32
#include "dynamicoverlay.h"
34
/*****************************************************************************
35
* queue_t: Command queue
36
*****************************************************************************/
38
int QueueInit( queue_t *p_queue )
40
memset( p_queue, 0, sizeof( queue_t ) );
41
p_queue->p_head = NULL;
42
p_queue->p_tail = NULL;
47
int QueueDestroy( queue_t *p_queue )
49
command_t *p_cur = p_queue->p_head, *p_temp;
50
while( p_cur != NULL )
53
p_cur = p_cur->p_next;
56
p_queue->p_head = NULL;
57
p_queue->p_tail = NULL;
62
int QueueEnqueue( queue_t *p_queue, command_t *p_cmd )
64
if( p_queue->p_tail != NULL )
66
p_queue->p_tail->p_next = p_cmd;
68
if( p_queue->p_head == NULL )
70
p_queue->p_head = p_cmd;
72
p_queue->p_tail = p_cmd;
78
command_t *QueueDequeue( queue_t *p_queue )
80
if( p_queue->p_head == NULL )
86
command_t *p_ret = p_queue->p_head;
87
if( p_queue->p_head == p_queue->p_tail )
89
p_queue->p_head = p_queue->p_tail = NULL;
93
p_queue->p_head = p_queue->p_head->p_next;
99
int QueueTransfer( queue_t *p_sink, queue_t *p_source )
101
if( p_source->p_head == NULL ) {
105
if( p_sink->p_head == NULL ) {
106
p_sink->p_head = p_source->p_head;
107
p_sink->p_tail = p_source->p_tail;
109
p_sink->p_tail->p_next = p_source->p_head;
110
p_sink->p_tail = p_source->p_tail;
112
p_source->p_head = p_source->p_tail = NULL;