1 /*****************************************************************************
2 * video_fifo.c : video FIFO management
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
6 * Authors: Christophe Massiot <massiot@via.ecp.fr>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
21 *****************************************************************************/
23 /*****************************************************************************
25 *****************************************************************************/
28 #include <sys/types.h> /* on BSD, uio.h needs types.h */
29 #include <sys/uio.h> /* "input.h */
38 #include "debug.h" /* XXX?? temporaire, requis par netlist.h */
40 #include "stream_control.h"
41 #include "input_ext-dec.h"
44 #include "video_output.h"
46 #include "vdec_idct.h"
47 #include "video_decoder.h"
48 #include "vdec_motion.h"
50 #include "vpar_blocks.h"
51 #include "vpar_headers.h"
52 #include "vpar_synchro.h"
53 #include "video_parser.h"
54 #include "video_fifo.h"
56 /*****************************************************************************
57 * vpar_InitFIFO : initialize the video FIFO
58 *****************************************************************************/
59 void vpar_InitFIFO( vpar_thread_t * p_vpar )
65 p_vpar->vfifo.p_vpar = p_vpar;
68 /* Initialize mutex and cond */
69 vlc_mutex_init( &p_vpar->vfifo.lock );
70 vlc_cond_init( &p_vpar->vfifo.wait );
71 vlc_mutex_init( &p_vpar->vbuffer.lock );
73 /* Initialize FIFO properties */
74 p_vpar->vfifo.i_start = p_vpar->vfifo.i_end = 0;
76 /* Initialize buffer properties */
77 p_vpar->vbuffer.i_index = VFIFO_SIZE; /* all structures are available */
78 for( i_dummy = 0; i_dummy < VFIFO_SIZE + 1; i_dummy++ )
80 p_vpar->vbuffer.pp_mb_free[i_dummy] = p_vpar->vbuffer.p_macroblocks