]> git.sesse.net Git - vlc/blob - src/spu_decoder/spu_decoder.h
966f09754f01ea46a2a2be7eac92111709a3d241
[vlc] / src / spu_decoder / spu_decoder.h
1 /*****************************************************************************
2  * spu_decoder.h : sub picture unit decoder thread interface
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  *
6  * Authors: Samuel Hocevar <sam@zoy.org>
7  *
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.
12  * 
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.
17  *
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  *****************************************************************************/
22
23 /*****************************************************************************
24  * spudec_thread_t : sub picture unit decoder thread descriptor
25  *****************************************************************************/
26 typedef struct spudec_thread_s
27 {
28     /*
29      * Thread properties and locks
30      */
31     vlc_thread_t        thread_id;                /* id for thread functions */
32
33     /*
34      * Input properties
35      */
36     decoder_fifo_t *    p_fifo;                /* stores the PES stream data */
37     /* The bit stream structure handles the PES stream at the bit level */
38     bit_stream_t        bit_stream;
39     vdec_config_t *     p_config;
40
41     /*
42      * Output properties
43      */
44     vout_thread_t *     p_vout;          /* needed to create the spu objects */
45
46     /*
47      * Private properties
48      */
49     int                 i_spu_size;            /* size of current SPU packet */
50     int                 i_rle_size;                  /* size of the RLE part */
51     subpicture_t *      p_spu;
52
53 } spudec_thread_t;
54
55 /*****************************************************************************
56  * SPU commands
57  *****************************************************************************/
58 #define SPU_CMD_FORCE_DISPLAY       0x00
59 #define SPU_CMD_START_DISPLAY       0x01
60 #define SPU_CMD_STOP_DISPLAY        0x02
61 #define SPU_CMD_SET_PALETTE         0x03
62 #define SPU_CMD_SET_ALPHACHANNEL    0x04
63 #define SPU_CMD_SET_COORDINATES     0x05
64 #define SPU_CMD_SET_OFFSETS         0x06
65 #define SPU_CMD_END                 0xff
66
67 /*****************************************************************************
68  * AddNibble: read a nibble from a source packet and add it to our integer.
69  *****************************************************************************/
70 static __inline__ unsigned int AddNibble( unsigned int i_code,
71                                           u8 *p_src, int *pi_index )
72 {
73     if( *pi_index & 0x1 )
74     {
75         return( i_code << 4 | ( p_src[(*pi_index)++ >> 1] & 0xf ) );
76     }
77     else
78     {
79         return( i_code << 4 | p_src[(*pi_index)++ >> 1] >> 4 );
80     }
81 }
82
83 /*****************************************************************************
84  * Prototypes
85  *****************************************************************************/
86 vlc_thread_t       spudec_CreateThread( vdec_config_t * p_config );
87