]> git.sesse.net Git - vlc/blob - include/video_fifo.h
Virationnement d'un warning avec l'ancien d�codeur (j'ai vraiment du temps �
[vlc] / include / video_fifo.h
1 /*****************************************************************************
2  * video_fifo.h : FIFO for the pool of video_decoders
3  * (c)1999 VideoLAN
4  *****************************************************************************
5  *****************************************************************************
6  * Requires:
7  *  "config.h"
8  *  "common.h"
9  *  "vlc_thread.h"
10  *  "video_parser.h"
11  *  "undec_picture.h"
12  *****************************************************************************/
13
14 /*****************************************************************************
15  * Macros
16  *****************************************************************************/
17
18 /* ?? move to inline functions */
19 #define VIDEO_FIFO_ISEMPTY( fifo )    ( (fifo).i_start == (fifo).i_end )
20 #define VIDEO_FIFO_ISFULL( fifo )     ( ( ( (fifo).i_end + 1 - (fifo).i_start ) \
21                                           & VFIFO_SIZE ) == 0 )
22 #define VIDEO_FIFO_START( fifo )      ( (fifo).buffer[ (fifo).i_start ] )
23 #define VIDEO_FIFO_INCSTART( fifo )   ( (fifo).i_start = ((fifo).i_start + 1) \
24                                                            & VFIFO_SIZE ) 
25 #define VIDEO_FIFO_END( fifo )        ( (fifo).buffer[ (fifo).i_end ] )
26 #define VIDEO_FIFO_INCEND( fifo )     ( (fifo).i_end = ((fifo).i_end + 1) \
27                                                          & VFIFO_SIZE )
28
29 /*****************************************************************************
30  * video_fifo_t
31  *****************************************************************************
32  * This rotative FIFO contains undecoded macroblocks that are to be decoded
33  *****************************************************************************/
34 struct vpar_thread_s;
35
36 typedef struct video_fifo_s
37 {
38     vlc_mutex_t         lock;                              /* fifo data lock */
39     vlc_cond_t          wait;              /* fifo data conditional variable */
40
41     /* buffer is an array of undec_picture_t pointers */
42     macroblock_t *              buffer[VFIFO_SIZE + 1];
43     int                         i_start;
44     int                         i_end;
45
46     struct vpar_thread_s *      p_vpar;
47 } video_fifo_t;
48
49 /*****************************************************************************
50  * video_buffer_t
51  *****************************************************************************
52  * This structure enables the parser to maintain a list of free
53  * macroblock_t structures
54  *****************************************************************************/
55 typedef struct video_buffer_s
56 {
57     vlc_mutex_t         lock;                            /* buffer data lock */
58
59     macroblock_t        p_macroblocks[VFIFO_SIZE + 1];
60     macroblock_t *      pp_mb_free[VFIFO_SIZE+1];          /* this is a LIFO */
61     int                 i_index;
62 } video_buffer_t;
63
64 /*****************************************************************************
65  * Prototypes
66  *****************************************************************************/
67 void vpar_InitFIFO( struct vpar_thread_s * p_vpar );
68 macroblock_t * vpar_GetMacroblock( video_fifo_t * p_fifo );
69 macroblock_t * vpar_NewMacroblock( video_fifo_t * p_fifo );
70 void vpar_DecodeMacroblock( video_fifo_t * p_fifo, macroblock_t * p_mb );
71 void vpar_ReleaseMacroblock( video_fifo_t * p_fifo, macroblock_t * p_mb );
72 void vpar_DestroyMacroblock( video_fifo_t * p_fifo, macroblock_t * p_mb );