1 /******************************************************************************
2 * audio_decoder.h : audio decoder thread interface
4 ******************************************************************************
5 * = Prototyped functions are implemented in audio_decoder/audio_decoder.c
8 * - <pthread.h> ( pthread_t )
9 * - "common.h" ( u32, byte_t, boolean_t )
10 * - "input.h" ( ts_packet_t, input_thread_t )
11 * - "decoder_fifo.h" ( decoder_fifo_t )
12 * - "audio_output.h" ( aout_fifo_t, aout_thread_t )
14 * = - LSb = Least Significant bit
15 * - LSB = Least Significant Byte
17 * = - MSb = Most Significant bit
18 * - MSB = Most Significant Byte
19 ******************************************************************************/
23 * - Etudier /usr/include/asm/bitops.h d'un peu plus près, bien qu'il ne me
24 * semble pas être possible d'utiliser ces fonctions ici
25 * - N'y aurait-t-il pas moyen de se passer d'un buffer de bits, en travaillant
26 * directement sur le flux PES ?
29 /******************************************************************************
30 * bit_fifo_t : bit fifo descriptor
31 ******************************************************************************
32 * This type describes a bit fifo used to store bits while working with the
33 * input stream at the bit level.
34 ******************************************************************************/
35 typedef struct bit_fifo_s
37 /* This unsigned integer allows us to work at the bit level. This buffer
38 * can contain 32 bits, and the used space can be found on the MSb's side
39 * and the available space on the LSb's side. */
42 /* Number of bits available in the bit buffer */
47 /******************************************************************************
48 * bit_stream_t : bit stream descriptor
49 ******************************************************************************
50 * This type, based on a PES stream, includes all the structures needed to
51 * handle the input stream like a bit stream.
52 ******************************************************************************/
53 typedef struct bit_stream_s
58 /* The input thread feeds the stream with fresh PES packets */
59 input_thread_t * p_input;
60 /* The decoder fifo contains the data of the PES stream */
61 decoder_fifo_t * p_decoder_fifo;
66 /* Current TS packet (in the current PES packet of the PES stream) */
68 /* Index of the next byte that is to be read (in the current TS packet) */
78 /******************************************************************************
80 ******************************************************************************/
81 typedef struct adec_bank_s
90 /******************************************************************************
91 * adec_thread_t : audio decoder thread descriptor
92 ******************************************************************************
93 * This type describes an audio decoder thread
94 ******************************************************************************/
95 typedef struct adec_thread_s
100 pthread_t thread_id; /* id for pthread functions */
101 boolean_t b_die; /* `die' flag */
102 boolean_t b_error; /* `error' flag */
107 decoder_fifo_t fifo; /* stores the PES stream data */
108 /* The bit stream structure handles the PES stream at the bit level */
109 bit_stream_t bit_stream;
120 aout_fifo_t * p_aout_fifo; /* stores the decompressed audio frames */
121 aout_thread_t * p_aout; /* needed to create the audio fifo */
125 /******************************************************************************
127 ******************************************************************************/
128 adec_thread_t * adec_CreateThread ( input_thread_t * p_input /* !! , aout_thread_t * p_aout !! */ );
129 void adec_DestroyThread ( adec_thread_t * p_adec );