audio_decoder.h 4.19 KB
Newer Older
1
/*****************************************************************************
Michel Kaempf's avatar
Michel Kaempf committed
2
 * audio_decoder.h : audio decoder thread interface
3
 *****************************************************************************
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 * Copyright (C) 1999, 2000 VideoLAN
 *
 * Authors:
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *****************************************************************************/

/*****************************************************************************
Michel Kaempf's avatar
Michel Kaempf committed
25 26 27 28
 * = Prototyped functions are implemented in audio_decoder/audio_decoder.c
 *
 * = Required headers :
 *   - "common.h"                                    ( u32, byte_t, boolean_t )
29
 *   - "threads.h"                                             ( vlc_thread_t )
Michel Kaempf's avatar
Michel Kaempf committed
30 31 32 33 34 35 36 37 38
 *   - "input.h"                                ( ts_packet_t, input_thread_t )
 *   - "decoder_fifo.h"                                      ( decoder_fifo_t )
 *   - "audio_output.h"                          ( aout_fifo_t, aout_thread_t )
 *
 * = - LSb = Least Significant bit
 *   - LSB = Least Significant Byte
 *
 * = - MSb = Most Significant bit
 *   - MSB = Most Significant Byte
39
 *****************************************************************************/
Michel Kaempf's avatar
Michel Kaempf committed
40 41 42 43 44 45 46 47 48

/*
 * TODO :
 * - Etudier /usr/include/asm/bitops.h d'un peu plus prs, bien qu'il ne me
 *   semble pas tre possible d'utiliser ces fonctions ici
 * - N'y aurait-t-il pas moyen de se passer d'un buffer de bits, en travaillant
 *   directement sur le flux PES ?
 */

Michel Kaempf's avatar
Michel Kaempf committed
49 50
#define ADEC_FRAME_SIZE 384

51
/*****************************************************************************
Michel Kaempf's avatar
Michel Kaempf committed
52
 * adec_frame_t
53
 *****************************************************************************/
Michel Kaempf's avatar
Michel Kaempf committed
54 55
typedef s16 adec_frame_t[ ADEC_FRAME_SIZE ];

56
/*****************************************************************************
Michel Kaempf's avatar
Michel Kaempf committed
57
 * adec_bank_t
58
 *****************************************************************************/
Michel Kaempf's avatar
Michel Kaempf committed
59 60 61 62 63 64 65 66 67
typedef struct adec_bank_s
{
    float               v1[512];
    float               v2[512];
    float *             actual;
    int                 pos;

} adec_bank_t;

68
/*****************************************************************************
Michel Kaempf's avatar
Michel Kaempf committed
69
 * adec_thread_t : audio decoder thread descriptor
70
 *****************************************************************************
Michel Kaempf's avatar
Michel Kaempf committed
71
 * This type describes an audio decoder thread
72
 *****************************************************************************/
Michel Kaempf's avatar
Michel Kaempf committed
73 74 75 76 77
typedef struct adec_thread_s
{
    /*
     * Thread properties
     */
78 79 80
    vlc_thread_t        thread_id;                /* id for thread functions */
    boolean_t           b_die;                                 /* `die' flag */
    boolean_t           b_error;                             /* `error' flag */
Michel Kaempf's avatar
Michel Kaempf committed
81 82 83 84

    /*
     * Input properties
     */
85
    decoder_fifo_t      fifo;                  /* stores the PES stream data */
Michel Kaempf's avatar
Michel Kaempf committed
86 87 88 89 90 91 92 93 94 95 96 97
    /* The bit stream structure handles the PES stream at the bit level */
    bit_stream_t        bit_stream;

    /*
     * Decoder properties
     */
    adec_bank_t         bank_0;
    adec_bank_t         bank_1;

    /*
     * Output properties
     */
98 99
    aout_fifo_t *       p_aout_fifo; /* stores the decompressed audio frames */
    aout_thread_t *     p_aout;           /* needed to create the audio fifo */
Michel Kaempf's avatar
Michel Kaempf committed
100 101 102

} adec_thread_t;

103
/*****************************************************************************
Michel Kaempf's avatar
Michel Kaempf committed
104
 * Prototypes
105
 *****************************************************************************/
Michel Kaempf's avatar
Michel Kaempf committed
106 107
adec_thread_t * adec_CreateThread       ( input_thread_t * p_input /* !! , aout_thread_t * p_aout !! */ );
void            adec_DestroyThread      ( adec_thread_t * p_adec );