]> git.sesse.net Git - vlc/blob - src/video_parser/video_fifo.c
aa7d81852914b9eb2ea70669df1799454be8ce5b
[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.30 2001/04/06 09:15:48 sam 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 <string.h>                                    /* memcpy(), memset() */
30
31 #include "config.h"
32 #include "common.h"
33 #include "threads.h"
34 #include "mtime.h"
35
36 #include "intf_msg.h"
37
38 #include "stream_control.h"
39 #include "input_ext-dec.h"
40
41 #include "video.h"
42 #include "video_output.h"
43
44 #include "video_decoder.h"
45 #include "vdec_motion.h"
46 #include "../video_decoder/vdec_idct.h"
47
48 #include "vpar_blocks.h"
49 #include "../video_decoder/vpar_headers.h"
50 #include "../video_decoder/vpar_synchro.h"
51 #include "../video_decoder/video_parser.h"
52 #include "../video_decoder/video_fifo.h"
53
54 /*****************************************************************************
55  * vpar_InitFIFO : initialize the video FIFO
56  *****************************************************************************/
57 void vpar_InitFIFO( vpar_thread_t * p_vpar )
58 {
59 #ifdef VDEC_SMP
60     int                 i_dummy;
61 #endif
62
63     p_vpar->vfifo.p_vpar = p_vpar;
64
65 #ifdef VDEC_SMP
66
67     /* Initialize mutex and cond */
68     vlc_mutex_init( &p_vpar->vfifo.lock );
69     vlc_cond_init( &p_vpar->vfifo.wait );
70     vlc_mutex_init( &p_vpar->vbuffer.lock );
71
72     /* Initialize FIFO properties */
73     p_vpar->vfifo.i_start = p_vpar->vfifo.i_end = 0;
74
75     /* Initialize buffer properties */
76     p_vpar->vbuffer.i_index = VFIFO_SIZE; /* all structures are available */
77     for( i_dummy = 0; i_dummy < VFIFO_SIZE + 1; i_dummy++ )
78     {
79         p_vpar->vbuffer.pp_mb_free[i_dummy] = p_vpar->vbuffer.p_macroblocks
80                                                + i_dummy;
81     }
82 #endif
83 }