]> git.sesse.net Git - vlc/blob - plugins/spudec/spu_decoder.h
24f3ca7aff39bd949ceccf3e5572d72241c8417c
[vlc] / plugins / spudec / spu_decoder.h
1 /*****************************************************************************
2  * spu_decoder.h : sub picture unit decoder thread interface
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  * $Id: spu_decoder.h,v 1.4 2002/05/18 17:47:47 sam Exp $
6  *
7  * Authors: Samuel Hocevar <sam@zoy.org>
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 typedef struct subpicture_sys_s
25 {
26     mtime_t i_pts;                                 /* presentation timestamp */
27
28     int   pi_offset[2];                              /* byte offsets to data */
29     void *p_data;
30
31     /* Color information */
32     boolean_t b_palette;
33     u8    pi_alpha[4];
34     u8    pi_yuv[4][3];
35
36 } subpicture_sys_t;
37
38 /*****************************************************************************
39  * spudec_thread_t : sub picture unit decoder thread descriptor
40  *****************************************************************************/
41 typedef struct spudec_thread_s
42 {
43     /*
44      * Thread properties and locks
45      */
46     vlc_thread_t        thread_id;                /* id for thread functions */
47
48     /*
49      * Input properties
50      */
51     decoder_fifo_t *    p_fifo;                /* stores the PES stream data */
52     /* The bit stream structure handles the PES stream at the bit level */
53     bit_stream_t        bit_stream;
54     decoder_config_t *  p_config;
55
56     /*
57      * Output properties
58      */
59     vout_thread_t *     p_vout;          /* needed to create the spu objects */
60
61     /*
62      * Private properties
63      */
64     int                 i_spu_size;            /* size of current SPU packet */
65     int                 i_rle_size;                  /* size of the RLE part */
66
67 } spudec_thread_t;
68
69 /*****************************************************************************
70  * Amount of bytes we GetChunk() in one go
71  *****************************************************************************/
72 #define SPU_CHUNK_SIZE              0x200
73
74 /*****************************************************************************
75  * SPU commands
76  *****************************************************************************/
77 #define SPU_CMD_FORCE_DISPLAY       0x00
78 #define SPU_CMD_START_DISPLAY       0x01
79 #define SPU_CMD_STOP_DISPLAY        0x02
80 #define SPU_CMD_SET_PALETTE         0x03
81 #define SPU_CMD_SET_ALPHACHANNEL    0x04
82 #define SPU_CMD_SET_COORDINATES     0x05
83 #define SPU_CMD_SET_OFFSETS         0x06
84 #define SPU_CMD_END                 0xff
85
86 /*****************************************************************************
87  * AddNibble: read a nibble from a source packet and add it to our integer.
88  *****************************************************************************/
89 static inline unsigned int AddNibble( unsigned int i_code,
90                                       u8 *p_src, int *pi_index )
91 {
92     if( *pi_index & 0x1 )
93     {
94         return( i_code << 4 | ( p_src[(*pi_index)++ >> 1] & 0xf ) );
95     }
96     else
97     {
98         return( i_code << 4 | p_src[(*pi_index)++ >> 1] >> 4 );
99     }
100 }
101
102 /*****************************************************************************
103  * Prototypes
104  *****************************************************************************/
105 vlc_thread_t       spudec_CreateThread( decoder_config_t * p_config );
106