Mercurial > audlegacy-plugins
annotate src/aac/libfaad2/decoder.c @ 3174:8106e1b31115
alsa-ng: alsaplug_written_time(), alsaplug_output_time(): Lock pcm_state_mutex.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Fri, 15 May 2009 16:12:30 -0500 |
parents | 169f6ee38cad |
children |
rev | line source |
---|---|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
3 ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
4 ** |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
5 ** This program is free software; you can redistribute it and/or modify |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
6 ** it under the terms of the GNU General Public License as published by |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
7 ** the Free Software Foundation; either version 2 of the License, or |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 ** (at your option) any later version. |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
9 ** |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 ** This program is distributed in the hope that it will be useful, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
13 ** GNU General Public License for more details. |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
14 ** |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
15 ** You should have received a copy of the GNU General Public License |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
16 ** along with this program; if not, write to the Free Software |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
18 ** |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
19 ** Any non-GPL usage of this software or parts of this software is strictly |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
20 ** forbidden. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
21 ** |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
22 ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
23 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
24 ** |
691 | 25 ** Commercial non-GPL licensing of this software is possible. |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
26 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. |
681 | 27 ** |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
28 ** $Id: decoder.c,v 1.117 2009/02/05 00:51:03 menno Exp $ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
29 **/ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
30 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
31 #include "common.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 #include "structs.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 #include <stdlib.h> |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
35 #include <stdio.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 #include <string.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 #include "mp4.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
39 #include "syntax.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
40 #include "error.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
41 #include "output.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
42 #include "filtbank.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
43 #include "drc.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
44 #ifdef SBR_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
45 #include "sbr_dec.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
46 #include "sbr_syntax.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
47 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
48 #ifdef SSR_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
49 #include "ssr.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
50 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
51 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
52 #ifdef ANALYSIS |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
53 uint16_t dbg_count; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
54 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
55 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
56 /* static function declarations */ |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
57 static void* aac_frame_decode(NeAACDecStruct *hDecoder, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
58 NeAACDecFrameInfo *hInfo, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
59 unsigned char *buffer, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
60 unsigned long buffer_size, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
61 void **sample_buffer2, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
62 unsigned long sample_buffer_size); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
63 static void create_channel_config(NeAACDecStruct *hDecoder, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
64 NeAACDecFrameInfo *hInfo); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
65 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
66 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
67 char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
68 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
69 if (errcode >= NUM_ERROR_MESSAGES) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
70 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 return err_msg[errcode]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
72 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
73 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
74 unsigned long NEAACDECAPI NeAACDecGetCapabilities(void) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
75 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
76 uint32_t cap = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
77 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
78 /* can't do without it */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
79 cap += LC_DEC_CAP; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
80 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 #ifdef MAIN_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
82 cap += MAIN_DEC_CAP; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
83 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
84 #ifdef LTP_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
85 cap += LTP_DEC_CAP; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
86 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
87 #ifdef LD_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
88 cap += LD_DEC_CAP; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
89 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
90 #ifdef ERROR_RESILIENCE |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
91 cap += ERROR_RESILIENCE_CAP; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
92 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
93 #ifdef FIXED_POINT |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
94 cap += FIXED_POINT_CAP; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
95 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
96 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
97 return cap; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
98 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
99 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
100 const unsigned char mes[] = { 0x67,0x20,0x61,0x20,0x20,0x20,0x6f,0x20,0x72,0x20,0x65,0x20,0x6e,0x20,0x20,0x20,0x74,0x20,0x68,0x20,0x67,0x20,0x69,0x20,0x72,0x20,0x79,0x20,0x70,0x20,0x6f,0x20,0x63 }; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
101 NeAACDecHandle NEAACDECAPI NeAACDecOpen(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
102 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
103 uint8_t i; |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
104 NeAACDecStruct *hDecoder = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
105 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
106 if ((hDecoder = (NeAACDecStruct*)faad_malloc(sizeof(NeAACDecStruct))) == NULL) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
107 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
108 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
109 memset(hDecoder, 0, sizeof(NeAACDecStruct)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
110 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
111 hDecoder->cmes = mes; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
112 hDecoder->config.outputFormat = FAAD_FMT_16BIT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
113 hDecoder->config.defObjectType = MAIN; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
114 hDecoder->config.defSampleRate = 44100; /* Default: 44.1kHz */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
115 hDecoder->config.downMatrix = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
116 hDecoder->adts_header_present = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
117 hDecoder->adif_header_present = 0; |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
118 hDecoder->latm_header_present = 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
119 #ifdef ERROR_RESILIENCE |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
120 hDecoder->aacSectionDataResilienceFlag = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
121 hDecoder->aacScalefactorDataResilienceFlag = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
122 hDecoder->aacSpectralDataResilienceFlag = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
123 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
124 hDecoder->frameLength = 1024; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
125 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
126 hDecoder->frame = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
127 hDecoder->sample_buffer = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
128 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
129 hDecoder->__r1 = 1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
130 hDecoder->__r2 = 1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
131 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
132 for (i = 0; i < MAX_CHANNELS; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
133 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
134 hDecoder->window_shape_prev[i] = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
135 hDecoder->time_out[i] = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
136 hDecoder->fb_intermed[i] = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
137 #ifdef SSR_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
138 hDecoder->ssr_overlap[i] = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
139 hDecoder->prev_fmd[i] = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
140 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
141 #ifdef MAIN_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
142 hDecoder->pred_stat[i] = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
143 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
144 #ifdef LTP_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
145 hDecoder->ltp_lag[i] = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
146 hDecoder->lt_pred_stat[i] = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
147 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
148 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
149 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
150 #ifdef SBR_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
151 for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
152 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
153 hDecoder->sbr[i] = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
154 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
155 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
156 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
157 hDecoder->drc = drc_init(REAL_CONST(1.0), REAL_CONST(1.0)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
158 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
159 return hDecoder; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
160 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
161 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
162 NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hpDecoder) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
163 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
164 NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
165 if (hDecoder) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
166 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
167 NeAACDecConfigurationPtr config = &(hDecoder->config); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
168 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
169 return config; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
170 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
171 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
172 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
173 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
174 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
175 unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hpDecoder, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
176 NeAACDecConfigurationPtr config) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
177 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
178 NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
179 if (hDecoder && config) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
180 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
181 /* check if we can decode this object type */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
182 if (can_decode_ot(config->defObjectType) < 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
183 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
184 hDecoder->config.defObjectType = config->defObjectType; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
185 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
186 /* samplerate: anything but 0 should be possible */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
187 if (config->defSampleRate == 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
188 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
189 hDecoder->config.defSampleRate = config->defSampleRate; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
190 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
191 /* check output format */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
192 #ifdef FIXED_POINT |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
193 if ((config->outputFormat < 1) || (config->outputFormat > 4)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
194 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
195 #else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
196 if ((config->outputFormat < 1) || (config->outputFormat > 5)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
197 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
198 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
199 hDecoder->config.outputFormat = config->outputFormat; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
200 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
201 if (config->downMatrix > 1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
202 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
203 hDecoder->config.downMatrix = config->downMatrix; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
204 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
205 /* OK */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
206 return 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
207 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
208 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
209 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
210 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
211 |
3006
169f6ee38cad
Defining C functions in headers is awkward, move to the one C file that actually uses it.
Tony Vroon <chainsaw@gentoo.org>
parents:
3005
diff
changeset
|
212 #if 0 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
213 static int latmCheck(latm_header *latm, bitfile *ld) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
214 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
215 uint32_t good=0, bad=0, bits, m; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
216 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
217 while (ld->bytes_left) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
218 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
219 bits = faad_latm_frame(latm, ld); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
220 if(bits==-1U) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
221 bad++; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
222 else |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
223 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
224 good++; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
225 while(bits>0) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
226 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
227 m = min(bits, 8); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
228 faad_getbits(ld, m); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
229 bits -= m; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
230 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
231 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
232 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
233 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
234 return (good>0); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
235 } |
3006
169f6ee38cad
Defining C functions in headers is awkward, move to the one C file that actually uses it.
Tony Vroon <chainsaw@gentoo.org>
parents:
3005
diff
changeset
|
236 #endif |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
237 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
238 long NEAACDECAPI NeAACDecInit(NeAACDecHandle hpDecoder, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
239 unsigned char *buffer, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
240 unsigned long buffer_size, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
241 unsigned long *samplerate, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
242 unsigned char *channels) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
243 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
244 uint32_t bits = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
245 bitfile ld; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
246 adif_header adif; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
247 adts_header adts; |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
248 NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
249 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
250 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 if ((hDecoder == NULL) || (samplerate == NULL) || (channels == NULL)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
253 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
254 hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
255 hDecoder->object_type = hDecoder->config.defObjectType; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
256 *samplerate = get_sample_rate(hDecoder->sf_index); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
257 *channels = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
258 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
259 if (buffer != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
260 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
261 #if 0 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
262 int is_latm; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
263 latm_header *l = &hDecoder->latm_config; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
264 #endif |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
265 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
266 faad_initbits(&ld, buffer, buffer_size); |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
267 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
268 #if 0 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
269 memset(l, 0, sizeof(latm_header)); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
270 is_latm = latmCheck(l, &ld); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
271 l->inited = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
272 l->frameLength = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
273 faad_rewindbits(&ld); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
274 if(is_latm && l->ASCbits>0) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
275 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
276 int32_t x; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
277 hDecoder->latm_header_present = 1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
278 x = NeAACDecInit2(hDecoder, l->ASC, (l->ASCbits+7)/8, samplerate, channels); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
279 if(x!=0) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
280 hDecoder->latm_header_present = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
281 return x; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
282 } else |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
283 #endif |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
284 /* Check if an ADIF header is present */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
285 if ((buffer[0] == 'A') && (buffer[1] == 'D') && |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
286 (buffer[2] == 'I') && (buffer[3] == 'F')) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
287 { |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
288 hDecoder->adif_header_present = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
289 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
290 get_adif_header(&adif, &ld); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
291 faad_byte_align(&ld); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
292 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
293 hDecoder->sf_index = adif.pce[0].sf_index; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
294 hDecoder->object_type = adif.pce[0].object_type + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
296 *samplerate = get_sample_rate(hDecoder->sf_index); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
297 *channels = adif.pce[0].channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
298 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
299 memcpy(&(hDecoder->pce), &(adif.pce[0]), sizeof(program_config)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
300 hDecoder->pce_set = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
302 bits = bit2byte(faad_get_processed_bits(&ld)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
303 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
304 /* Check if an ADTS header is present */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
305 } else if (faad_showbits(&ld, 12) == 0xfff) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
306 hDecoder->adts_header_present = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
307 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
308 adts.old_format = hDecoder->config.useOldADTSFormat; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
309 adts_frame(&adts, &ld); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
310 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
311 hDecoder->sf_index = adts.sf_index; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
312 hDecoder->object_type = adts.profile + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
313 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
314 *samplerate = get_sample_rate(hDecoder->sf_index); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
315 *channels = (adts.channel_configuration > 6) ? |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
316 2 : adts.channel_configuration; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
317 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
318 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
319 if (ld.error) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
320 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
321 faad_endbits(&ld); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
322 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
323 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
324 faad_endbits(&ld); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
325 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
326 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
327 #if (defined(PS_DEC) || defined(DRM_PS)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
328 /* check if we have a mono file */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
329 if (*channels == 1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
330 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
331 /* upMatrix to 2 channels for implicit signalling of PS */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
332 *channels = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
333 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
334 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
335 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
336 hDecoder->channelConfiguration = *channels; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
337 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
338 #ifdef SBR_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
339 /* implicit signalling */ |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
340 if (*samplerate <= 24000 && (hDecoder->config.dontUpSampleImplicitSBR == 0)) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
341 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
342 *samplerate *= 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
343 hDecoder->forceUpSampling = 1; |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
344 } else if (*samplerate > 24000 && (hDecoder->config.dontUpSampleImplicitSBR == 0)) { |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
345 hDecoder->downSampledSBR = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
346 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
347 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
348 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
349 /* must be done before frameLength is divided by 2 for LD */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
350 #ifdef SSR_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
351 if (hDecoder->object_type == SSR) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
352 hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
353 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
354 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
355 hDecoder->fb = filter_bank_init(hDecoder->frameLength); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
356 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
357 #ifdef LD_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
358 if (hDecoder->object_type == LD) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
359 hDecoder->frameLength >>= 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
360 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
361 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
362 if (can_decode_ot(hDecoder->object_type) < 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
363 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
364 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
365 return bits; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
366 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
367 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
368 /* Init the library using a DecoderSpecificInfo */ |
3005
3d6a2732f26a
Update mp4ff as well. Eternal glory for the one who finds the hidden PACKAGE in the about dialog.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
369 signed char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hpDecoder, |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
370 unsigned char *pBuffer, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
371 unsigned long SizeOfDecoderSpecificInfo, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
372 unsigned long *samplerate, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
373 unsigned char *channels) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
374 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
375 NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
376 int8_t rc; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
377 mp4AudioSpecificConfig mp4ASC; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
378 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
379 if((hDecoder == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
380 || (pBuffer == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
381 || (SizeOfDecoderSpecificInfo < 2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
382 || (samplerate == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
383 || (channels == NULL)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
384 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
385 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
386 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
387 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
388 hDecoder->adif_header_present = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
389 hDecoder->adts_header_present = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
390 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
391 /* decode the audio specific config */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
392 rc = AudioSpecificConfig2(pBuffer, SizeOfDecoderSpecificInfo, &mp4ASC, |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
393 &(hDecoder->pce), hDecoder->latm_header_present); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
394 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
395 /* copy the relevant info to the decoder handle */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
396 *samplerate = mp4ASC.samplingFrequency; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
397 if (mp4ASC.channelsConfiguration) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
398 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
399 *channels = mp4ASC.channelsConfiguration; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
400 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
401 *channels = hDecoder->pce.channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
402 hDecoder->pce_set = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
403 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
404 #if (defined(PS_DEC) || defined(DRM_PS)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
405 /* check if we have a mono file */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
406 if (*channels == 1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
407 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
408 /* upMatrix to 2 channels for implicit signalling of PS */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
409 *channels = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
410 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
411 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
412 hDecoder->sf_index = mp4ASC.samplingFrequencyIndex; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
413 hDecoder->object_type = mp4ASC.objectTypeIndex; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
414 #ifdef ERROR_RESILIENCE |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
415 hDecoder->aacSectionDataResilienceFlag = mp4ASC.aacSectionDataResilienceFlag; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
416 hDecoder->aacScalefactorDataResilienceFlag = mp4ASC.aacScalefactorDataResilienceFlag; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
417 hDecoder->aacSpectralDataResilienceFlag = mp4ASC.aacSpectralDataResilienceFlag; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
418 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
419 #ifdef SBR_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
420 hDecoder->sbr_present_flag = mp4ASC.sbr_present_flag; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
421 hDecoder->downSampledSBR = mp4ASC.downSampledSBR; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
422 if (hDecoder->config.dontUpSampleImplicitSBR == 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
423 hDecoder->forceUpSampling = mp4ASC.forceUpSampling; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
424 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
425 hDecoder->forceUpSampling = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
426 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
427 /* AAC core decoder samplerate is 2 times as low */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
428 if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || hDecoder->forceUpSampling == 1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
429 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
430 hDecoder->sf_index = get_sr_index(mp4ASC.samplingFrequency / 2); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
431 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
432 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
433 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
434 if (rc != 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
435 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
436 return rc; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
437 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
438 hDecoder->channelConfiguration = mp4ASC.channelsConfiguration; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
439 if (mp4ASC.frameLengthFlag) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
440 #ifdef ALLOW_SMALL_FRAMELENGTH |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
441 hDecoder->frameLength = 960; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
442 #else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
443 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
444 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
445 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
446 /* must be done before frameLength is divided by 2 for LD */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
447 #ifdef SSR_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
448 if (hDecoder->object_type == SSR) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
449 hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
450 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
451 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
452 hDecoder->fb = filter_bank_init(hDecoder->frameLength); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
453 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
454 #ifdef LD_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
455 if (hDecoder->object_type == LD) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
456 hDecoder->frameLength >>= 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
457 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
458 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
459 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
460 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
461 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
462 #ifdef DRM |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
463 char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hpDecoder, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
464 unsigned long samplerate, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
465 unsigned char channels) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
466 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
467 NeAACDecStruct** hDecoder = (NeAACDecStruct**)hpDecoder; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
468 if (hDecoder == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
469 return 1; /* error */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
470 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
471 NeAACDecClose(*hDecoder); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
472 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
473 *hDecoder = NeAACDecOpen(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
474 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
475 /* Special object type defined for DRM */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
476 (*hDecoder)->config.defObjectType = DRM_ER_LC; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
477 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
478 (*hDecoder)->config.defSampleRate = samplerate; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
479 #ifdef ERROR_RESILIENCE // This shoudl always be defined for DRM |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
480 (*hDecoder)->aacSectionDataResilienceFlag = 1; /* VCB11 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
481 (*hDecoder)->aacScalefactorDataResilienceFlag = 0; /* no RVLC */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
482 (*hDecoder)->aacSpectralDataResilienceFlag = 1; /* HCR */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
483 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
484 (*hDecoder)->frameLength = 960; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
485 (*hDecoder)->sf_index = get_sr_index((*hDecoder)->config.defSampleRate); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
486 (*hDecoder)->object_type = (*hDecoder)->config.defObjectType; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
487 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
488 if ((channels == DRMCH_STEREO) || (channels == DRMCH_SBR_STEREO)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
489 (*hDecoder)->channelConfiguration = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
490 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
491 (*hDecoder)->channelConfiguration = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
492 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
493 #ifdef SBR_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
494 if ((channels == DRMCH_MONO) || (channels == DRMCH_STEREO)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
495 (*hDecoder)->sbr_present_flag = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
496 else |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
497 (*hDecoder)->sbr_present_flag = 1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
498 #endif |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
499 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
500 (*hDecoder)->fb = filter_bank_init((*hDecoder)->frameLength); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
501 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
502 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
503 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
504 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
505 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
506 void NEAACDECAPI NeAACDecClose(NeAACDecHandle hpDecoder) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
507 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
508 uint8_t i; |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
509 NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
510 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
511 if (hDecoder == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
512 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
513 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
514 #ifdef PROFILE |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
515 printf("AAC decoder total: %I64d cycles\n", hDecoder->cycles); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
516 printf("requant: %I64d cycles\n", hDecoder->requant_cycles); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
517 printf("spectral_data: %I64d cycles\n", hDecoder->spectral_cycles); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
518 printf("scalefactors: %I64d cycles\n", hDecoder->scalefac_cycles); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
519 printf("output: %I64d cycles\n", hDecoder->output_cycles); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
520 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
521 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
522 for (i = 0; i < MAX_CHANNELS; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
523 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
524 if (hDecoder->time_out[i]) faad_free(hDecoder->time_out[i]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
525 if (hDecoder->fb_intermed[i]) faad_free(hDecoder->fb_intermed[i]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
526 #ifdef SSR_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
527 if (hDecoder->ssr_overlap[i]) faad_free(hDecoder->ssr_overlap[i]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
528 if (hDecoder->prev_fmd[i]) faad_free(hDecoder->prev_fmd[i]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
529 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
530 #ifdef MAIN_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
531 if (hDecoder->pred_stat[i]) faad_free(hDecoder->pred_stat[i]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
532 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
533 #ifdef LTP_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
534 if (hDecoder->lt_pred_stat[i]) faad_free(hDecoder->lt_pred_stat[i]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
535 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
536 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
537 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
538 #ifdef SSR_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
539 if (hDecoder->object_type == SSR) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
540 ssr_filter_bank_end(hDecoder->fb); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
541 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
542 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
543 filter_bank_end(hDecoder->fb); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
544 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
545 drc_end(hDecoder->drc); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
546 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
547 if (hDecoder->sample_buffer) faad_free(hDecoder->sample_buffer); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
548 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
549 #ifdef SBR_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
550 for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
551 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
552 if (hDecoder->sbr[i]) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
553 sbrDecodeEnd(hDecoder->sbr[i]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
554 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
555 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
556 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
557 if (hDecoder) faad_free(hDecoder); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
558 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
559 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
560 void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hpDecoder, long frame) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
561 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
562 NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
563 if (hDecoder) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
564 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
565 hDecoder->postSeekResetFlag = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
566 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
567 if (frame != -1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
568 hDecoder->frame = frame; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
569 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
570 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
571 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
572 static void create_channel_config(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
573 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
574 hInfo->num_front_channels = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
575 hInfo->num_side_channels = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
576 hInfo->num_back_channels = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
577 hInfo->num_lfe_channels = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
578 memset(hInfo->channel_position, 0, MAX_CHANNELS*sizeof(uint8_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
579 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
580 if (hDecoder->downMatrix) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
581 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
582 hInfo->num_front_channels = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
583 hInfo->channel_position[0] = FRONT_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
584 hInfo->channel_position[1] = FRONT_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
585 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
586 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
587 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
588 /* check if there is a PCE */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
589 if (hDecoder->pce_set) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
590 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
591 uint8_t i, chpos = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
592 uint8_t chdir, back_center = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
593 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
594 hInfo->num_front_channels = hDecoder->pce.num_front_channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
595 hInfo->num_side_channels = hDecoder->pce.num_side_channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
596 hInfo->num_back_channels = hDecoder->pce.num_back_channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
597 hInfo->num_lfe_channels = hDecoder->pce.num_lfe_channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
598 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
599 chdir = hInfo->num_front_channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
600 if (chdir & 1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
601 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
602 #if (defined(PS_DEC) || defined(DRM_PS)) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
603 /* When PS is enabled output is always stereo */ |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
604 hInfo->channel_position[chpos++] = FRONT_CHANNEL_LEFT; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
605 hInfo->channel_position[chpos++] = FRONT_CHANNEL_RIGHT; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
606 #else |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
607 hInfo->channel_position[chpos++] = FRONT_CHANNEL_CENTER; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
608 chdir--; |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
609 #endif |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
610 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
611 for (i = 0; i < chdir; i += 2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
612 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
613 hInfo->channel_position[chpos++] = FRONT_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
614 hInfo->channel_position[chpos++] = FRONT_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
615 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
616 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
617 for (i = 0; i < hInfo->num_side_channels; i += 2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
618 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
619 hInfo->channel_position[chpos++] = SIDE_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
620 hInfo->channel_position[chpos++] = SIDE_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
621 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
622 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
623 chdir = hInfo->num_back_channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
624 if (chdir & 1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
625 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
626 back_center = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
627 chdir--; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
628 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
629 for (i = 0; i < chdir; i += 2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
630 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
631 hInfo->channel_position[chpos++] = BACK_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
632 hInfo->channel_position[chpos++] = BACK_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
633 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
634 if (back_center) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
635 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
636 hInfo->channel_position[chpos++] = BACK_CHANNEL_CENTER; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
637 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
638 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
639 for (i = 0; i < hInfo->num_lfe_channels; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
640 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
641 hInfo->channel_position[chpos++] = LFE_CHANNEL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
642 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
643 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
644 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
645 switch (hDecoder->channelConfiguration) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
646 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
647 case 1: |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
648 #if (defined(PS_DEC) || defined(DRM_PS)) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
649 /* When PS is enabled output is always stereo */ |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
650 hInfo->num_front_channels = 2; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
651 hInfo->channel_position[0] = FRONT_CHANNEL_LEFT; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
652 hInfo->channel_position[1] = FRONT_CHANNEL_RIGHT; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
653 #else |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
654 hInfo->num_front_channels = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
655 hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
656 #endif |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
657 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
658 case 2: |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
659 hInfo->num_front_channels = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
660 hInfo->channel_position[0] = FRONT_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
661 hInfo->channel_position[1] = FRONT_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
662 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
663 case 3: |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
664 hInfo->num_front_channels = 3; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
665 hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
666 hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
667 hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
668 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
669 case 4: |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
670 hInfo->num_front_channels = 3; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
671 hInfo->num_back_channels = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
672 hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
673 hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
674 hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
675 hInfo->channel_position[3] = BACK_CHANNEL_CENTER; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
676 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
677 case 5: |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
678 hInfo->num_front_channels = 3; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
679 hInfo->num_back_channels = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
680 hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
681 hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
682 hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
683 hInfo->channel_position[3] = BACK_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
684 hInfo->channel_position[4] = BACK_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
685 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
686 case 6: |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
687 hInfo->num_front_channels = 3; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
688 hInfo->num_back_channels = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
689 hInfo->num_lfe_channels = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
690 hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
691 hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
692 hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
693 hInfo->channel_position[3] = BACK_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
694 hInfo->channel_position[4] = BACK_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
695 hInfo->channel_position[5] = LFE_CHANNEL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
696 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
697 case 7: |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
698 hInfo->num_front_channels = 3; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
699 hInfo->num_side_channels = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
700 hInfo->num_back_channels = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
701 hInfo->num_lfe_channels = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
702 hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
703 hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
704 hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
705 hInfo->channel_position[3] = SIDE_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
706 hInfo->channel_position[4] = SIDE_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
707 hInfo->channel_position[5] = BACK_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
708 hInfo->channel_position[6] = BACK_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
709 hInfo->channel_position[7] = LFE_CHANNEL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
710 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
711 default: /* channelConfiguration == 0 || channelConfiguration > 7 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
712 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
713 uint8_t i; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
714 uint8_t ch = hDecoder->fr_channels - hDecoder->has_lfe; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
715 if (ch & 1) /* there's either a center front or a center back channel */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
716 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
717 uint8_t ch1 = (ch-1)/2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
718 if (hDecoder->first_syn_ele == ID_SCE) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
719 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
720 hInfo->num_front_channels = ch1 + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
721 hInfo->num_back_channels = ch1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
722 hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
723 for (i = 1; i <= ch1; i+=2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
724 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
725 hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
726 hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
727 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
728 for (i = ch1+1; i < ch; i+=2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
729 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
730 hInfo->channel_position[i] = BACK_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
731 hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
732 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
733 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
734 hInfo->num_front_channels = ch1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
735 hInfo->num_back_channels = ch1 + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
736 for (i = 0; i < ch1; i+=2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
737 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
738 hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
739 hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
740 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
741 for (i = ch1; i < ch-1; i+=2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
742 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
743 hInfo->channel_position[i] = BACK_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
744 hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
745 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
746 hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
747 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
748 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
749 uint8_t ch1 = (ch)/2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
750 hInfo->num_front_channels = ch1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
751 hInfo->num_back_channels = ch1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
752 if (ch1 & 1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
753 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
754 hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
755 for (i = 1; i <= ch1; i+=2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
756 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
757 hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
758 hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
759 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
760 for (i = ch1+1; i < ch-1; i+=2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
761 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
762 hInfo->channel_position[i] = BACK_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
763 hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
764 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
765 hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
766 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
767 for (i = 0; i < ch1; i+=2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
768 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
769 hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
770 hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
771 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
772 for (i = ch1; i < ch; i+=2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
773 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
774 hInfo->channel_position[i] = BACK_CHANNEL_LEFT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
775 hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
776 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
777 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
778 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
779 hInfo->num_lfe_channels = hDecoder->has_lfe; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
780 for (i = ch; i < hDecoder->fr_channels; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
781 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
782 hInfo->channel_position[i] = LFE_CHANNEL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
783 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
784 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
785 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
786 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
787 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
788 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
789 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
790 void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hpDecoder, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
791 NeAACDecFrameInfo *hInfo, |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
792 unsigned char *buffer, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
793 unsigned long buffer_size) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
794 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
795 NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
796 return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, NULL, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
797 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
798 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
799 void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hpDecoder, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
800 NeAACDecFrameInfo *hInfo, |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
801 unsigned char *buffer, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
802 unsigned long buffer_size, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
803 void **sample_buffer, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
804 unsigned long sample_buffer_size) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
805 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
806 NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
807 if ((sample_buffer == NULL) || (sample_buffer_size == 0)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
808 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
809 hInfo->error = 27; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
810 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
811 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
812 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
813 return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
814 sample_buffer, sample_buffer_size); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
815 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
816 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
817 #ifdef DRM |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
818 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
819 #define ERROR_STATE_INIT 6 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
820 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
821 static void conceal_output(NeAACDecStruct *hDecoder, uint16_t frame_len, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
822 uint8_t out_ch, void *sample_buffer) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
823 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
824 return; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
825 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
826 #endif |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
827 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
828 static void* aac_frame_decode(NeAACDecStruct *hDecoder, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
829 NeAACDecFrameInfo *hInfo, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
830 unsigned char *buffer, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
831 unsigned long buffer_size, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
832 void **sample_buffer2, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
833 unsigned long sample_buffer_size) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
834 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
835 uint16_t i; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
836 uint8_t channels = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
837 uint8_t output_channels = 0; |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
838 bitfile ld = {0}; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
839 uint32_t bitsconsumed; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
840 uint16_t frame_len; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
841 void *sample_buffer; |
3006
169f6ee38cad
Defining C functions in headers is awkward, move to the one C file that actually uses it.
Tony Vroon <chainsaw@gentoo.org>
parents:
3005
diff
changeset
|
842 #if 0 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
843 uint32_t startbit=0, endbit=0, payload_bits=0; |
3006
169f6ee38cad
Defining C functions in headers is awkward, move to the one C file that actually uses it.
Tony Vroon <chainsaw@gentoo.org>
parents:
3005
diff
changeset
|
844 #endif |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
845 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
846 #ifdef PROFILE |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
847 int64_t count = faad_get_ts(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
848 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
849 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
850 /* safety checks */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
851 if ((hDecoder == NULL) || (hInfo == NULL) || (buffer == NULL)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
852 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
853 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
854 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
855 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
856 #if 0 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
857 printf("%d\n", buffer_size*8); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
858 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
859 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
860 frame_len = hDecoder->frameLength; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
861 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
862 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
863 memset(hInfo, 0, sizeof(NeAACDecFrameInfo)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
864 memset(hDecoder->internal_channel, 0, MAX_CHANNELS*sizeof(hDecoder->internal_channel[0])); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
865 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
866 #ifdef USE_TIME_LIMIT |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
867 if ((TIME_LIMIT * get_sample_rate(hDecoder->sf_index)) > hDecoder->TL_count) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
868 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
869 hDecoder->TL_count += 1024; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
870 } else { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
871 hInfo->error = (NUM_ERROR_MESSAGES-1); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
872 goto error; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
873 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
874 #endif |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
875 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
876 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
877 /* check for some common metadata tag types in the bitstream |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
878 * No need to return an error |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
879 */ |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
880 /* ID3 */ |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
881 if (buffer_size >= 128) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
882 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
883 if (memcmp(buffer, "TAG", 3) == 0) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
884 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
885 /* found it */ |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
886 hInfo->bytesconsumed = 128; /* 128 bytes fixed size */ |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
887 /* no error, but no output either */ |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
888 return NULL; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
889 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
890 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
891 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
892 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
893 /* initialize the bitstream */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
894 faad_initbits(&ld, buffer, buffer_size); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
895 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
896 #if 0 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
897 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
898 int i; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
899 for (i = 0; i < ((buffer_size+3)>>2); i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
900 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
901 uint8_t *buf; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
902 uint32_t temp = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
903 buf = faad_getbitbuffer(&ld, 32); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
904 //temp = getdword((void*)buf); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
905 temp = *((uint32_t*)buf); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
906 printf("0x%.8X\n", temp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
907 free(buf); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
908 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
909 faad_endbits(&ld); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
910 faad_initbits(&ld, buffer, buffer_size); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
911 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
912 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
913 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
914 #if 0 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
915 if(hDecoder->latm_header_present) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
916 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
917 payload_bits = faad_latm_frame(&hDecoder->latm_config, &ld); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
918 startbit = faad_get_processed_bits(&ld); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
919 if(payload_bits == -1U) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
920 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
921 hInfo->error = 1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
922 goto error; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
923 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
924 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
925 #endif |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
926 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
927 #ifdef DRM |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
928 if (hDecoder->object_type == DRM_ER_LC) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
929 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
930 /* We do not support stereo right now */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
931 if (0) //(hDecoder->channelConfiguration == 2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
932 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
933 hInfo->error = 28; // Throw CRC error |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
934 goto error; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
935 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
936 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
937 faad_getbits(&ld, 8 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
938 DEBUGVAR(1,1,"NeAACDecDecode(): skip CRC")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
939 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
940 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
941 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
942 if (hDecoder->adts_header_present) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
943 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
944 adts_header adts; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
945 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
946 adts.old_format = hDecoder->config.useOldADTSFormat; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
947 if ((hInfo->error = adts_frame(&adts, &ld)) > 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
948 goto error; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
949 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
950 /* MPEG2 does byte_alignment() here, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
951 * but ADTS header is always multiple of 8 bits in MPEG2 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
952 * so not needed to actually do it. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
953 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
954 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
955 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
956 #ifdef ANALYSIS |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
957 dbg_count = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
958 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
959 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
960 /* decode the complete bitstream */ |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
961 #ifdef DRM |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
962 if (/*(hDecoder->object_type == 6) ||*/ (hDecoder->object_type == DRM_ER_LC)) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
963 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
964 DRM_aac_scalable_main_element(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
965 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
966 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
967 raw_data_block(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc); |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
968 #ifdef DRM |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
969 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
970 #endif |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
971 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
972 #if 0 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
973 if(hDecoder->latm_header_present) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
974 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
975 endbit = faad_get_processed_bits(&ld); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
976 if(endbit-startbit > payload_bits) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
977 fprintf(stderr, "\r\nERROR, too many payload bits read: %u > %d. Please. report with a link to a sample\n", |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
978 endbit-startbit, payload_bits); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
979 if(hDecoder->latm_config.otherDataLenBits > 0) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
980 faad_getbits(&ld, hDecoder->latm_config.otherDataLenBits); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
981 faad_byte_align(&ld); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
982 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
983 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
984 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
985 channels = hDecoder->fr_channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
986 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
987 if (hInfo->error > 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
988 goto error; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
989 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
990 /* safety check */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
991 if (channels == 0 || channels > MAX_CHANNELS) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
992 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
993 /* invalid number of channels */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
994 hInfo->error = 12; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
995 goto error; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
996 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
997 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
998 /* no more bit reading after this */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
999 bitsconsumed = faad_get_processed_bits(&ld); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1000 hInfo->bytesconsumed = bit2byte(bitsconsumed); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1001 if (ld.error) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1002 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1003 hInfo->error = 14; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1004 goto error; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1005 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1006 faad_endbits(&ld); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1007 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1008 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1009 if (!hDecoder->adts_header_present && !hDecoder->adif_header_present |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1010 #if 0 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1011 && !hDecoder->latm_header_present |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1012 #endif |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1013 ) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1014 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1015 if (hDecoder->channelConfiguration == 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1016 hDecoder->channelConfiguration = channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1017 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1018 if (channels == 8) /* 7.1 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1019 hDecoder->channelConfiguration = 7; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1020 if (channels == 7) /* not a standard channelConfiguration */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1021 hDecoder->channelConfiguration = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1022 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1023 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1024 if ((channels == 5 || channels == 6) && hDecoder->config.downMatrix) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1025 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1026 hDecoder->downMatrix = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1027 output_channels = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1028 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1029 output_channels = channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1030 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1031 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1032 #if (defined(PS_DEC) || defined(DRM_PS)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1033 hDecoder->upMatrix = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1034 /* check if we have a mono file */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1035 if (output_channels == 1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1036 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1037 /* upMatrix to 2 channels for implicit signalling of PS */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1038 hDecoder->upMatrix = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1039 output_channels = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1040 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1041 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1042 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1043 /* Make a channel configuration based on either a PCE or a channelConfiguration */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1044 create_channel_config(hDecoder, hInfo); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1045 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1046 /* number of samples in this frame */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1047 hInfo->samples = frame_len*output_channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1048 /* number of channels in this frame */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1049 hInfo->channels = output_channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1050 /* samplerate */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1051 hInfo->samplerate = get_sample_rate(hDecoder->sf_index); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1052 /* object type */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1053 hInfo->object_type = hDecoder->object_type; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1054 /* sbr */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1055 hInfo->sbr = NO_SBR; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1056 /* header type */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1057 hInfo->header_type = RAW; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1058 if (hDecoder->adif_header_present) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1059 hInfo->header_type = ADIF; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1060 if (hDecoder->adts_header_present) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1061 hInfo->header_type = ADTS; |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1062 #if 0 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1063 if (hDecoder->latm_header_present) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1064 hInfo->header_type = LATM; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1065 #endif |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1066 #if (defined(PS_DEC) || defined(DRM_PS)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1067 hInfo->ps = hDecoder->ps_used_global; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1068 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1069 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1070 /* check if frame has channel elements */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1071 if (channels == 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1072 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1073 hDecoder->frame++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1074 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1075 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1076 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1077 /* allocate the buffer for the final samples */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1078 if ((hDecoder->sample_buffer == NULL) || |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1079 (hDecoder->alloced_channels != output_channels)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1080 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1081 static const uint8_t str[] = { sizeof(int16_t), sizeof(int32_t), sizeof(int32_t), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1082 sizeof(float32_t), sizeof(double), sizeof(int16_t), sizeof(int16_t), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1083 sizeof(int16_t), sizeof(int16_t), 0, 0, 0 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1084 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1085 uint8_t stride = str[hDecoder->config.outputFormat-1]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1086 #ifdef SBR_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1087 if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || (hDecoder->forceUpSampling == 1)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1088 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1089 stride = 2 * stride; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1090 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1091 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1092 /* check if we want to use internal sample_buffer */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1093 if (sample_buffer_size == 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1094 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1095 if (hDecoder->sample_buffer) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1096 faad_free(hDecoder->sample_buffer); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1097 hDecoder->sample_buffer = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1098 hDecoder->sample_buffer = faad_malloc(frame_len*output_channels*stride); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1099 } else if (sample_buffer_size < frame_len*output_channels*stride) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1100 /* provided sample buffer is not big enough */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1101 hInfo->error = 27; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1102 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1103 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1104 hDecoder->alloced_channels = output_channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1105 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1106 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1107 if (sample_buffer_size == 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1108 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1109 sample_buffer = hDecoder->sample_buffer; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1110 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1111 sample_buffer = *sample_buffer2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1112 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1113 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1114 #ifdef SBR_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1115 if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1116 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1117 uint8_t ele; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1118 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1119 /* this data is different when SBR is used or when the data is upsampled */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1120 if (!hDecoder->downSampledSBR) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1121 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1122 frame_len *= 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1123 hInfo->samples *= 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1124 hInfo->samplerate *= 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1125 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1126 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1127 /* check if every element was provided with SBR data */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1128 for (ele = 0; ele < hDecoder->fr_ch_ele; ele++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1129 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1130 if (hDecoder->sbr[ele] == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1131 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1132 hInfo->error = 25; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1133 goto error; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1134 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1135 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1136 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1137 /* sbr */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1138 if (hDecoder->sbr_present_flag == 1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1139 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1140 hInfo->object_type = HE_AAC; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1141 hInfo->sbr = SBR_UPSAMPLED; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1142 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1143 hInfo->sbr = NO_SBR_UPSAMPLED; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1144 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1145 if (hDecoder->downSampledSBR) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1146 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1147 hInfo->sbr = SBR_DOWNSAMPLED; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1148 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1149 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1150 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1151 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1152 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1153 sample_buffer = output_to_PCM(hDecoder, hDecoder->time_out, sample_buffer, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1154 output_channels, frame_len, hDecoder->config.outputFormat); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1155 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1156 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1157 #ifdef DRM |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1158 //conceal_output(hDecoder, frame_len, output_channels, sample_buffer); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1159 #endif |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1160 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1161 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1162 hDecoder->postSeekResetFlag = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1163 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1164 hDecoder->frame++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1165 #ifdef LD_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1166 if (hDecoder->object_type != LD) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1167 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1168 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1169 if (hDecoder->frame <= 1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1170 hInfo->samples = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1171 #ifdef LD_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1172 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1173 /* LD encoders will give lower delay */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1174 if (hDecoder->frame <= 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1175 hInfo->samples = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1176 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1177 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1178 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1179 /* cleanup */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1180 #ifdef ANALYSIS |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1181 fflush(stdout); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1182 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1183 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1184 #ifdef PROFILE |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1185 count = faad_get_ts() - count; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1186 hDecoder->cycles += count; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1187 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1188 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1189 return sample_buffer; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1190 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1191 error: |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1192 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1193 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1194 #ifdef DRM |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1195 hDecoder->error_state = ERROR_STATE_INIT; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1196 #endif |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1197 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1198 /* reset filterbank state */ |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1199 for (i = 0; i < MAX_CHANNELS; i++) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1200 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1201 if (hDecoder->fb_intermed[i] != NULL) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1202 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1203 memset(hDecoder->fb_intermed[i], 0, hDecoder->frameLength*sizeof(real_t)); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1204 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1205 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1206 #ifdef SBR_DEC |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1207 for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1208 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1209 if (hDecoder->sbr[i] != NULL) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1210 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1211 sbrReset(hDecoder->sbr[i]); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1212 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1213 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1214 #endif |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1215 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
1216 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1217 faad_endbits(&ld); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1218 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1219 /* cleanup */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1220 #ifdef ANALYSIS |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1221 fflush(stdout); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1222 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1223 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1224 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1225 } |