1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
|
/*****************************************************************************
* dynamicoverlay_queue.c : dynamic overlay plugin commands
*****************************************************************************
* Copyright (C) 2008-2009 VLC authors and VideoLAN
* $Id$
*
* Author: Søren Bøg <avacore@videolan.org>
* Jean-Paul Saman <jpsaman@videolan.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include "dynamicoverlay.h"
/*****************************************************************************
* queue_t: Command queue
*****************************************************************************/
int QueueInit( queue_t *p_queue )
{
memset( p_queue, 0, sizeof( queue_t ) );
p_queue->p_head = NULL;
p_queue->p_tail = NULL;
return VLC_SUCCESS;
}
int QueueDestroy( queue_t *p_queue )
{
command_t *p_cur = p_queue->p_head, *p_temp;
while( p_cur != NULL )
{
p_temp = p_cur;
p_cur = p_cur->p_next;
free( p_temp );
}
p_queue->p_head = NULL;
p_queue->p_tail = NULL;
return VLC_SUCCESS;
}
int QueueEnqueue( queue_t *p_queue, command_t *p_cmd )
{
if( p_queue->p_tail != NULL )
{
p_queue->p_tail->p_next = p_cmd;
}
if( p_queue->p_head == NULL )
{
p_queue->p_head = p_cmd;
}
p_queue->p_tail = p_cmd;
p_cmd->p_next = NULL;
return VLC_SUCCESS;
}
command_t *QueueDequeue( queue_t *p_queue )
{
if( p_queue->p_head == NULL )
{
return NULL;
}
else
{
command_t *p_ret = p_queue->p_head;
if( p_queue->p_head == p_queue->p_tail )
{
p_queue->p_head = p_queue->p_tail = NULL;
}
else
{
p_queue->p_head = p_queue->p_head->p_next;
}
return p_ret;
}
}
int QueueTransfer( queue_t *p_sink, queue_t *p_source )
{
if( p_source->p_head == NULL ) {
return VLC_SUCCESS;
}
if( p_sink->p_head == NULL ) {
p_sink->p_head = p_source->p_head;
p_sink->p_tail = p_source->p_tail;
} else {
p_sink->p_tail->p_next = p_source->p_head;
p_sink->p_tail = p_source->p_tail;
}
p_source->p_head = p_source->p_tail = NULL;
return VLC_SUCCESS;
}
|