Mercurial > libavcodec.hg
annotate libfaad.c @ 11604:6bab1bfac3bb libavcodec
Rename ff_parse_eval() to ff_eval_expr().
The new name expresses better what the function does.
| author | stefano |
|---|---|
| date | Sun, 11 Apr 2010 22:32:01 +0000 |
| parents | 8a4984c5cacc |
| children | 7dd2a45249a9 |
| rev | line source |
|---|---|
| 1245 | 1 /* |
| 2 * Faad decoder | |
|
8629
04423b2f6e0b
cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents:
8590
diff
changeset
|
3 * Copyright (c) 2003 Zdenek Kabelac |
|
04423b2f6e0b
cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents:
8590
diff
changeset
|
4 * Copyright (c) 2004 Thomas Raivio |
| 1245 | 5 * |
|
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3164
diff
changeset
|
6 * This file is part of FFmpeg. |
|
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3164
diff
changeset
|
7 * |
|
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3164
diff
changeset
|
8 * FFmpeg is free software; you can redistribute it and/or |
| 1245 | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | |
|
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3164
diff
changeset
|
11 * version 2.1 of the License, or (at your option) any later version. |
| 1245 | 12 * |
|
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3164
diff
changeset
|
13 * FFmpeg is distributed in the hope that it will be useful, |
| 1245 | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 16 * Lesser General Public License for more details. | |
| 17 * | |
| 18 * You should have received a copy of the GNU Lesser General Public | |
|
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3164
diff
changeset
|
19 * License along with FFmpeg; if not, write to the Free Software |
|
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2979
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 1245 | 21 */ |
| 22 | |
| 23 /** | |
|
8718
e9d9d946f213
Use full internal pathname in doxygen @file directives.
diego
parents:
8673
diff
changeset
|
24 * @file libavcodec/libfaad.c |
| 1245 | 25 * AAC decoder. |
| 26 * | |
| 27 * still a bit unfinished - but it plays something | |
| 28 */ | |
| 29 | |
| 30 #include "avcodec.h" | |
| 31 #include "faad.h" | |
| 32 | |
|
2061
c28b03fea50f
Building with faad2-cvs fix by ("Steven M. Schultz" <sms at 2bsd dot com>)
michael
parents:
2059
diff
changeset
|
33 #ifndef FAADAPI |
|
c28b03fea50f
Building with faad2-cvs fix by ("Steven M. Schultz" <sms at 2bsd dot com>)
michael
parents:
2059
diff
changeset
|
34 #define FAADAPI |
|
c28b03fea50f
Building with faad2-cvs fix by ("Steven M. Schultz" <sms at 2bsd dot com>)
michael
parents:
2059
diff
changeset
|
35 #endif |
|
c28b03fea50f
Building with faad2-cvs fix by ("Steven M. Schultz" <sms at 2bsd dot com>)
michael
parents:
2059
diff
changeset
|
36 |
| 1245 | 37 /* |
| 8590 | 38 * when CONFIG_LIBFAADBIN is true libfaad will be opened at runtime |
| 1245 | 39 */ |
|
4336
b7caa9237018
Rename variables: faad --> libfaad, faac --> libfaac, faadbin --> libfaadbin
diego
parents:
4163
diff
changeset
|
40 //#undef CONFIG_LIBFAADBIN |
| 8590 | 41 //#define CONFIG_LIBFAADBIN 0 |
| 42 //#define CONFIG_LIBFAADBIN 1 | |
| 1245 | 43 |
| 8590 | 44 #if CONFIG_LIBFAADBIN |
| 1245 | 45 #include <dlfcn.h> |
| 7978 | 46 static const char* const libfaadname = "libfaad.so"; |
| 1245 | 47 #else |
| 48 #define dlopen(a) | |
| 49 #define dlclose(a) | |
| 50 #endif | |
| 51 | |
| 52 typedef struct { | |
| 2979 | 53 void* handle; /* dlopen handle */ |
| 54 void* faac_handle; /* FAAD library handle */ | |
| 1245 | 55 int sample_size; |
| 3097 | 56 int init; |
| 1245 | 57 |
| 58 /* faad calls */ | |
| 59 faacDecHandle FAADAPI (*faacDecOpen)(void); | |
| 60 faacDecConfigurationPtr FAADAPI (*faacDecGetCurrentConfiguration)(faacDecHandle hDecoder); | |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
61 #ifndef FAAD2_VERSION |
| 6175 | 62 int FAADAPI (*faacDecSetConfiguration)(faacDecHandle hDecoder, |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
63 faacDecConfigurationPtr config); |
| 6175 | 64 int FAADAPI (*faacDecInit)(faacDecHandle hDecoder, |
| 65 unsigned char *buffer, | |
| 66 unsigned long *samplerate, | |
| 67 unsigned long *channels); | |
| 68 int FAADAPI (*faacDecInit2)(faacDecHandle hDecoder, unsigned char *pBuffer, | |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
69 unsigned long SizeOfDecoderSpecificInfo, |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
70 unsigned long *samplerate, unsigned long *channels); |
| 6175 | 71 int FAADAPI (*faacDecDecode)(faacDecHandle hDecoder, |
| 72 unsigned char *buffer, | |
| 73 unsigned long *bytesconsumed, | |
| 74 short *sample_buffer, | |
| 75 unsigned long *samples); | |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
76 #else |
| 6175 | 77 unsigned char FAADAPI (*faacDecSetConfiguration)(faacDecHandle hDecoder, |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
78 faacDecConfigurationPtr config); |
| 6175 | 79 long FAADAPI (*faacDecInit)(faacDecHandle hDecoder, |
| 80 unsigned char *buffer, | |
| 81 unsigned long buffer_size, | |
| 82 unsigned long *samplerate, | |
| 83 unsigned char *channels); | |
| 84 char FAADAPI (*faacDecInit2)(faacDecHandle hDecoder, unsigned char *pBuffer, | |
| 1245 | 85 unsigned long SizeOfDecoderSpecificInfo, |
| 86 unsigned long *samplerate, unsigned char *channels); | |
| 6175 | 87 void *FAADAPI (*faacDecDecode)(faacDecHandle hDecoder, |
| 88 faacDecFrameInfo *hInfo, | |
| 89 unsigned char *buffer, | |
| 90 unsigned long buffer_size); | |
| 91 char* FAADAPI (*faacDecGetErrorMessage)(unsigned char errcode); | |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
92 #endif |
| 2967 | 93 |
| 1245 | 94 void FAADAPI (*faacDecClose)(faacDecHandle hDecoder); |
| 2967 | 95 |
| 96 | |
| 1245 | 97 } FAACContext; |
| 98 | |
| 99 static const unsigned long faac_srates[] = | |
| 100 { | |
| 101 96000, 88200, 64000, 48000, 44100, 32000, | |
| 102 24000, 22050, 16000, 12000, 11025, 8000 | |
| 103 }; | |
| 104 | |
| 6119 | 105 static void channel_setup(AVCodecContext *avctx) |
| 106 { | |
| 107 #ifdef FAAD2_VERSION | |
| 108 FAACContext *s = avctx->priv_data; | |
| 109 if (avctx->request_channels > 0 && avctx->request_channels == 2 && | |
| 6175 | 110 avctx->request_channels < avctx->channels) { |
| 6119 | 111 faacDecConfigurationPtr faac_cfg; |
| 112 avctx->channels = 2; | |
| 113 faac_cfg = s->faacDecGetCurrentConfiguration(s->faac_handle); | |
| 114 faac_cfg->downMatrix = 1; | |
| 115 s->faacDecSetConfiguration(s->faac_handle, faac_cfg); | |
| 116 } | |
| 117 #endif | |
| 118 } | |
| 119 | |
|
9007
043574c5c153
Add missing av_cold in static init/close functions.
stefano
parents:
8718
diff
changeset
|
120 static av_cold int faac_init_mp4(AVCodecContext *avctx) |
| 1245 | 121 { |
| 4827 | 122 FAACContext *s = avctx->priv_data; |
| 1245 | 123 unsigned long samplerate; |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
124 #ifndef FAAD2_VERSION |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
125 unsigned long channels; |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
126 #else |
| 1245 | 127 unsigned char channels; |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
128 #endif |
| 1245 | 129 int r = 0; |
| 130 | |
| 3097 | 131 if (avctx->extradata){ |
| 2979 | 132 r = s->faacDecInit2(s->faac_handle, (uint8_t*) avctx->extradata, |
| 133 avctx->extradata_size, | |
| 134 &samplerate, &channels); | |
| 3097 | 135 if (r < 0){ |
| 136 av_log(avctx, AV_LOG_ERROR, | |
| 137 "faacDecInit2 failed r:%d sr:%ld ch:%ld s:%d\n", | |
| 138 r, samplerate, (long)channels, avctx->extradata_size); | |
| 139 } else { | |
| 140 avctx->sample_rate = samplerate; | |
| 141 avctx->channels = channels; | |
| 6119 | 142 channel_setup(avctx); |
| 3097 | 143 s->init = 1; |
| 144 } | |
| 145 } | |
|
2059
ad972ab280bc
sample_rate and channels in aac audio patch by (Luca Abeni <lucabe72 at email dot it>)
michael
parents:
1929
diff
changeset
|
146 |
| 1245 | 147 return r; |
| 148 } | |
| 149 | |
| 150 static int faac_decode_frame(AVCodecContext *avctx, | |
| 151 void *data, int *data_size, | |
|
9355
54bc8a2727b0
Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents:
9117
diff
changeset
|
152 AVPacket *avpkt) |
| 1245 | 153 { |
|
9355
54bc8a2727b0
Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents:
9117
diff
changeset
|
154 const uint8_t *buf = avpkt->data; |
|
54bc8a2727b0
Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents:
9117
diff
changeset
|
155 int buf_size = avpkt->size; |
| 4827 | 156 FAACContext *s = avctx->priv_data; |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
157 #ifndef FAAD2_VERSION |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
158 unsigned long bytesconsumed; |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
159 short *sample_buffer = NULL; |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
160 unsigned long samples; |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
161 int out; |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
162 #else |
| 1245 | 163 faacDecFrameInfo frame_info; |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
164 void *out; |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
165 #endif |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
166 if(buf_size == 0) |
| 2979 | 167 return 0; |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
168 #ifndef FAAD2_VERSION |
| 2967 | 169 out = s->faacDecDecode(s->faac_handle, |
| 170 (unsigned char*)buf, | |
| 171 &bytesconsumed, | |
| 172 data, | |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
173 &samples); |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
174 samples *= s->sample_size; |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
175 if (data_size) |
| 2979 | 176 *data_size = samples; |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
177 return (buf_size < (int)bytesconsumed) |
| 2979 | 178 ? buf_size : (int)bytesconsumed; |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
179 #else |
| 2967 | 180 |
| 3097 | 181 if(!s->init){ |
| 182 unsigned long srate; | |
| 183 unsigned char channels; | |
| 3155 | 184 int r = s->faacDecInit(s->faac_handle, buf, buf_size, &srate, &channels); |
| 3097 | 185 if(r < 0){ |
| 10671 | 186 av_log(avctx, AV_LOG_ERROR, "libfaad: codec init failed.\n"); |
|
3164
d771383fbcb8
Make faac_decode_frame return -1 on error and not 0 which avoids
mru
parents:
3155
diff
changeset
|
187 return -1; |
| 3097 | 188 } |
| 189 avctx->sample_rate = srate; | |
| 190 avctx->channels = channels; | |
| 6119 | 191 channel_setup(avctx); |
| 3097 | 192 s->init = 1; |
| 193 } | |
| 194 | |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
195 out = s->faacDecDecode(s->faac_handle, &frame_info, (unsigned char*)buf, (unsigned long)buf_size); |
| 1245 | 196 |
| 197 if (frame_info.error > 0) { | |
| 10671 | 198 av_log(avctx, AV_LOG_ERROR, "libfaad: frame decoding failed: %s\n", |
| 6175 | 199 s->faacDecGetErrorMessage(frame_info.error)); |
|
3164
d771383fbcb8
Make faac_decode_frame return -1 on error and not 0 which avoids
mru
parents:
3155
diff
changeset
|
200 return -1; |
| 1245 | 201 } |
| 7158 | 202 if (!avctx->frame_size) |
| 203 avctx->frame_size = frame_info.samples/avctx->channels; | |
| 1245 | 204 frame_info.samples *= s->sample_size; |
| 205 memcpy(data, out, frame_info.samples); // CHECKME - can we cheat this one | |
| 206 | |
| 207 if (data_size) | |
| 2979 | 208 *data_size = frame_info.samples; |
| 1245 | 209 |
| 210 return (buf_size < (int)frame_info.bytesconsumed) | |
| 2979 | 211 ? buf_size : (int)frame_info.bytesconsumed; |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
212 #endif |
| 1245 | 213 } |
| 214 | |
|
6517
48759bfbd073
Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents:
6177
diff
changeset
|
215 static av_cold int faac_decode_end(AVCodecContext *avctx) |
| 1245 | 216 { |
| 4827 | 217 FAACContext *s = avctx->priv_data; |
| 1245 | 218 |
| 4753 | 219 s->faacDecClose(s->faac_handle); |
| 1245 | 220 |
| 221 dlclose(s->handle); | |
| 222 return 0; | |
| 223 } | |
| 224 | |
|
6517
48759bfbd073
Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents:
6177
diff
changeset
|
225 static av_cold int faac_decode_init(AVCodecContext *avctx) |
| 1245 | 226 { |
| 4827 | 227 FAACContext *s = avctx->priv_data; |
| 1245 | 228 faacDecConfigurationPtr faac_cfg; |
| 229 | |
| 8590 | 230 #if CONFIG_LIBFAADBIN |
| 1245 | 231 const char* err = 0; |
| 232 | |
| 233 s->handle = dlopen(libfaadname, RTLD_LAZY); | |
| 234 if (!s->handle) | |
| 235 { | |
| 2979 | 236 av_log(avctx, AV_LOG_ERROR, "FAAD library: %s could not be opened! \n%s\n", |
| 6175 | 237 libfaadname, dlerror()); |
| 1245 | 238 return -1; |
| 239 } | |
| 6177 | 240 |
| 241 #define dfaac(a) do { \ | |
| 242 const char* n = AV_STRINGIFY(faacDec ## a); \ | |
| 243 if (!err && !(s->faacDec ## a = dlsym(s->handle, n))) { \ | |
| 244 err = n; \ | |
| 245 } \ | |
| 246 } while(0) | |
|
4336
b7caa9237018
Rename variables: faad --> libfaad, faac --> libfaac, faadbin --> libfaadbin
diego
parents:
4163
diff
changeset
|
247 #else /* !CONFIG_LIBFAADBIN */ |
| 6177 | 248 #define dfaac(a) s->faacDec ## a = faacDec ## a |
|
4336
b7caa9237018
Rename variables: faad --> libfaad, faac --> libfaac, faadbin --> libfaadbin
diego
parents:
4163
diff
changeset
|
249 #endif /* CONFIG_LIBFAADBIN */ |
| 1245 | 250 |
| 6177 | 251 // resolve all needed function calls |
| 252 dfaac(Open); | |
| 253 dfaac(Close); | |
| 254 dfaac(GetCurrentConfiguration); | |
| 255 dfaac(SetConfiguration); | |
| 256 dfaac(Init); | |
| 257 dfaac(Init2); | |
| 258 dfaac(Decode); | |
| 259 #ifdef FAAD2_VERSION | |
| 260 dfaac(GetErrorMessage); | |
| 261 #endif | |
| 1245 | 262 |
| 6177 | 263 #undef dfaac |
| 1245 | 264 |
| 8590 | 265 #if CONFIG_LIBFAADBIN |
| 1245 | 266 if (err) { |
| 267 dlclose(s->handle); | |
| 2979 | 268 av_log(avctx, AV_LOG_ERROR, "FAAD library: cannot resolve %s in %s!\n", |
| 6175 | 269 err, libfaadname); |
| 1245 | 270 return -1; |
| 271 } | |
| 272 #endif | |
| 273 | |
| 274 s->faac_handle = s->faacDecOpen(); | |
| 275 if (!s->faac_handle) { | |
|
1602
fdb8244da1e5
av_log patch(2 of ?) by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1245
diff
changeset
|
276 av_log(avctx, AV_LOG_ERROR, "FAAD library: cannot create handler!\n"); |
| 1245 | 277 faac_decode_end(avctx); |
| 278 return -1; | |
| 279 } | |
| 280 | |
| 281 | |
| 282 faac_cfg = s->faacDecGetCurrentConfiguration(s->faac_handle); | |
| 283 | |
| 284 if (faac_cfg) { | |
|
7823
4525dcd81357
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
7451
diff
changeset
|
285 switch (avctx->bits_per_coded_sample) { |
|
4525dcd81357
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
7451
diff
changeset
|
286 case 8: av_log(avctx, AV_LOG_ERROR, "FAADlib unsupported bps %d\n", avctx->bits_per_coded_sample); break; |
| 2979 | 287 default: |
| 288 case 16: | |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
289 #ifdef FAAD2_VERSION |
| 2979 | 290 faac_cfg->outputFormat = FAAD_FMT_16BIT; |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
291 #endif |
| 2979 | 292 s->sample_size = 2; |
| 293 break; | |
| 294 case 24: | |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
295 #ifdef FAAD2_VERSION |
| 2979 | 296 faac_cfg->outputFormat = FAAD_FMT_24BIT; |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
297 #endif |
| 2979 | 298 s->sample_size = 3; |
| 299 break; | |
| 300 case 32: | |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
301 #ifdef FAAD2_VERSION |
| 2979 | 302 faac_cfg->outputFormat = FAAD_FMT_32BIT; |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
303 #endif |
| 2979 | 304 s->sample_size = 4; |
| 305 break; | |
| 306 } | |
| 1245 | 307 |
| 2979 | 308 faac_cfg->defSampleRate = (!avctx->sample_rate) ? 44100 : avctx->sample_rate; |
| 309 faac_cfg->defObjectType = LC; | |
| 1245 | 310 } |
| 311 | |
| 312 s->faacDecSetConfiguration(s->faac_handle, faac_cfg); | |
| 313 | |
| 314 faac_init_mp4(avctx); | |
| 315 | |
| 6119 | 316 if(!s->init && avctx->channels > 0) |
| 317 channel_setup(avctx); | |
| 318 | |
|
7451
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7158
diff
changeset
|
319 avctx->sample_fmt = SAMPLE_FMT_S16; |
| 1245 | 320 return 0; |
| 321 } | |
| 322 | |
|
9113
21f500327e5c
Do not use a macro to generate a single AVCodec declaration.
diego
parents:
9007
diff
changeset
|
323 AVCodec libfaad_decoder = { |
| 9117 | 324 "libfaad", |
|
11560
8a4984c5cacc
Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents:
10671
diff
changeset
|
325 AVMEDIA_TYPE_AUDIO, |
|
9113
21f500327e5c
Do not use a macro to generate a single AVCodec declaration.
diego
parents:
9007
diff
changeset
|
326 CODEC_ID_AAC, |
|
21f500327e5c
Do not use a macro to generate a single AVCodec declaration.
diego
parents:
9007
diff
changeset
|
327 sizeof(FAACContext), |
|
21f500327e5c
Do not use a macro to generate a single AVCodec declaration.
diego
parents:
9007
diff
changeset
|
328 faac_decode_init, |
|
21f500327e5c
Do not use a macro to generate a single AVCodec declaration.
diego
parents:
9007
diff
changeset
|
329 NULL, |
|
21f500327e5c
Do not use a macro to generate a single AVCodec declaration.
diego
parents:
9007
diff
changeset
|
330 faac_decode_end, |
|
21f500327e5c
Do not use a macro to generate a single AVCodec declaration.
diego
parents:
9007
diff
changeset
|
331 faac_decode_frame, |
|
21f500327e5c
Do not use a macro to generate a single AVCodec declaration.
diego
parents:
9007
diff
changeset
|
332 .long_name = NULL_IF_CONFIG_SMALL("libfaad AAC (Advanced Audio Codec)"), |
| 9117 | 333 }; |
