1 /*****************************************************************************
2 * video_fifo.c : video FIFO management
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: video_fifo.c,v 1.27 2001/01/13 12:57:21 sam Exp $
7 * Authors: Christophe Massiot <massiot@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
37 #include "stream_control.h"
38 #include "input_ext-dec.h"
41 #include "video_output.h"
43 #include "video_decoder.h"
44 #include "../video_decoder/vdec_idct.h"
45 #include "../video_decoder/vdec_motion.h"
47 #include "../video_decoder/vpar_blocks.h"
48 #include "../video_decoder/vpar_headers.h"
49 #include "../video_decoder/vpar_synchro.h"
50 #include "../video_decoder/video_parser.h"
51 #include "../video_decoder/video_fifo.h"
53 /*****************************************************************************
54 * vpar_InitFIFO : initialize the video FIFO
55 *****************************************************************************/
56 void vpar_InitFIFO( vpar_thread_t * p_vpar )
62 p_vpar->vfifo.p_vpar = p_vpar;
66 /* Initialize mutex and cond */
67 vlc_mutex_init( &p_vpar->vfifo.lock );
68 vlc_cond_init( &p_vpar->vfifo.wait );
69 vlc_mutex_init( &p_vpar->vbuffer.lock );
71 /* Initialize FIFO properties */
72 p_vpar->vfifo.i_start = p_vpar->vfifo.i_end = 0;
74 /* Initialize buffer properties */
75 p_vpar->vbuffer.i_index = VFIFO_SIZE; /* all structures are available */
76 for( i_dummy = 0; i_dummy < VFIFO_SIZE + 1; i_dummy++ )
78 p_vpar->vbuffer.pp_mb_free[i_dummy] = p_vpar->vbuffer.p_macroblocks