]> git.sesse.net Git - vlc/blob - src/ac3_decoder/ac3_decoder.c
Bon. On ne rit pas, je m'�tais juste plant� dans l'en-t�te des
[vlc] / src / ac3_decoder / ac3_decoder.c
1 /*****************************************************************************
2  * ac3_decoder.c: core ac3 decoder
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  *
6  * Authors:
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 #include "defs.h"
23
24 #include "int_types.h"
25 #include "ac3_decoder.h"
26 #include "ac3_internal.h"
27
28 int ac3_init (ac3dec_t * p_ac3dec)
29 {
30     //p_ac3dec->bit_stream.buffer = 0;
31     //p_ac3dec->bit_stream.i_available = 0;
32
33     return 0;
34 }
35
36 int ac3_decode_frame (ac3dec_t * p_ac3dec, s16 * buffer)
37 {
38     int i;
39
40     if (parse_bsi (p_ac3dec))
41         return 1;
42
43     for (i = 0; i < 6; i++) {
44         if (parse_audblk (p_ac3dec, i))
45             return 1;
46         if (exponent_unpack (p_ac3dec))
47             return 1;
48         bit_allocate (p_ac3dec);
49         mantissa_unpack (p_ac3dec);
50         if  (p_ac3dec->bsi.acmod == 0x2)
51             rematrix (p_ac3dec);
52         imdct (p_ac3dec);
53         downmix (p_ac3dec, buffer);
54
55         buffer += 2*256;
56     }
57
58     parse_auxdata (p_ac3dec);
59
60     return 0;
61 }