]> git.sesse.net Git - vlc/blob - src/video_parser/video_fifo.c
BSD port, including :
[vlc] / src / video_parser / video_fifo.c
1 /*****************************************************************************
2  * video_fifo.c : video FIFO management
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  * $Id: video_fifo.c,v 1.25 2001/01/05 18:46:45 massiot Exp $
6  *
7  * Authors: Christophe Massiot <massiot@via.ecp.fr>
8  *
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.
13  * 
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.
18  *
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  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include "defs.h"
28
29 #include "config.h"
30 #include "common.h"
31 #include "threads.h"
32 #include "mtime.h"
33 #include "plugins.h"
34
35 #include "intf_msg.h"
36
37 #include "stream_control.h"
38 #include "input_ext-dec.h"
39
40 #include "video.h"
41 #include "video_output.h"
42
43 #include "../video_decoder/vdec_idct.h"
44 #include "../video_decoder/video_decoder.h"
45 #include "../video_decoder/vdec_motion.h"
46
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"
52
53 /*****************************************************************************
54  * vpar_InitFIFO : initialize the video FIFO
55  *****************************************************************************/
56 void vpar_InitFIFO( vpar_thread_t * p_vpar )
57 {
58 #ifdef VDEC_SMP
59     int                 i_dummy;
60 #endif
61
62     p_vpar->vfifo.p_vpar = p_vpar;
63
64 #ifdef VDEC_SMP
65     /* Initialize mutex and cond */
66     vlc_mutex_init( &p_vpar->vfifo.lock );
67     vlc_cond_init( &p_vpar->vfifo.wait );
68     vlc_mutex_init( &p_vpar->vbuffer.lock );
69
70     /* Initialize FIFO properties */
71     p_vpar->vfifo.i_start = p_vpar->vfifo.i_end = 0;
72
73     /* Initialize buffer properties */
74     p_vpar->vbuffer.i_index = VFIFO_SIZE; /* all structures are available */
75     for( i_dummy = 0; i_dummy < VFIFO_SIZE + 1; i_dummy++ )
76     {
77         p_vpar->vbuffer.pp_mb_free[i_dummy] = p_vpar->vbuffer.p_macroblocks
78                                                + i_dummy;
79     }
80 #endif
81 }