Mercurial > libavcodec.hg
annotate libfaad.c @ 8897:fa198e44b199 libavcodec
Add Doxygen comment similar to ff_xvmc_field_start() to ff_xvmc_field_end().
| author | diego |
|---|---|
| date | Sat, 14 Feb 2009 23:13:32 +0000 |
| parents | e9d9d946f213 |
| children | 043574c5c153 |
| 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 | |
| 1245 | 120 static int faac_init_mp4(AVCodecContext *avctx) |
| 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, | |
| 152 uint8_t *buf, int buf_size) | |
| 153 { | |
| 4827 | 154 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
|
155 #ifndef FAAD2_VERSION |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
156 unsigned long bytesconsumed; |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
157 short *sample_buffer = NULL; |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
158 unsigned long samples; |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
159 int out; |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
160 #else |
| 1245 | 161 faacDecFrameInfo frame_info; |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
162 void *out; |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
163 #endif |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
164 if(buf_size == 0) |
| 2979 | 165 return 0; |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
166 #ifndef FAAD2_VERSION |
| 2967 | 167 out = s->faacDecDecode(s->faac_handle, |
| 168 (unsigned char*)buf, | |
| 169 &bytesconsumed, | |
| 170 data, | |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
171 &samples); |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
172 samples *= s->sample_size; |
|
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
173 if (data_size) |
| 2979 | 174 *data_size = samples; |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
175 return (buf_size < (int)bytesconsumed) |
| 2979 | 176 ? buf_size : (int)bytesconsumed; |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
177 #else |
| 2967 | 178 |
| 3097 | 179 if(!s->init){ |
| 180 unsigned long srate; | |
| 181 unsigned char channels; | |
| 3155 | 182 int r = s->faacDecInit(s->faac_handle, buf, buf_size, &srate, &channels); |
| 3097 | 183 if(r < 0){ |
|
6790
86ce080ea1e3
Do not use variable frame_info before its value is set.
cehoyos
parents:
6517
diff
changeset
|
184 av_log(avctx, AV_LOG_ERROR, "faac: codec init failed.\n"); |
|
3164
d771383fbcb8
Make faac_decode_frame return -1 on error and not 0 which avoids
mru
parents:
3155
diff
changeset
|
185 return -1; |
| 3097 | 186 } |
| 187 avctx->sample_rate = srate; | |
| 188 avctx->channels = channels; | |
| 6119 | 189 channel_setup(avctx); |
| 3097 | 190 s->init = 1; |
| 191 } | |
| 192 | |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
193 out = s->faacDecDecode(s->faac_handle, &frame_info, (unsigned char*)buf, (unsigned long)buf_size); |
| 1245 | 194 |
| 195 if (frame_info.error > 0) { | |
| 2979 | 196 av_log(avctx, AV_LOG_ERROR, "faac: frame decoding failed: %s\n", |
| 6175 | 197 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
|
198 return -1; |
| 1245 | 199 } |
| 7158 | 200 if (!avctx->frame_size) |
| 201 avctx->frame_size = frame_info.samples/avctx->channels; | |
| 1245 | 202 frame_info.samples *= s->sample_size; |
| 203 memcpy(data, out, frame_info.samples); // CHECKME - can we cheat this one | |
| 204 | |
| 205 if (data_size) | |
| 2979 | 206 *data_size = frame_info.samples; |
| 1245 | 207 |
| 208 return (buf_size < (int)frame_info.bytesconsumed) | |
| 2979 | 209 ? 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
|
210 #endif |
| 1245 | 211 } |
| 212 | |
|
6517
48759bfbd073
Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents:
6177
diff
changeset
|
213 static av_cold int faac_decode_end(AVCodecContext *avctx) |
| 1245 | 214 { |
| 4827 | 215 FAACContext *s = avctx->priv_data; |
| 1245 | 216 |
| 4753 | 217 s->faacDecClose(s->faac_handle); |
| 1245 | 218 |
| 219 dlclose(s->handle); | |
| 220 return 0; | |
| 221 } | |
| 222 | |
|
6517
48759bfbd073
Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents:
6177
diff
changeset
|
223 static av_cold int faac_decode_init(AVCodecContext *avctx) |
| 1245 | 224 { |
| 4827 | 225 FAACContext *s = avctx->priv_data; |
| 1245 | 226 faacDecConfigurationPtr faac_cfg; |
| 227 | |
| 8590 | 228 #if CONFIG_LIBFAADBIN |
| 1245 | 229 const char* err = 0; |
| 230 | |
| 231 s->handle = dlopen(libfaadname, RTLD_LAZY); | |
| 232 if (!s->handle) | |
| 233 { | |
| 2979 | 234 av_log(avctx, AV_LOG_ERROR, "FAAD library: %s could not be opened! \n%s\n", |
| 6175 | 235 libfaadname, dlerror()); |
| 1245 | 236 return -1; |
| 237 } | |
| 6177 | 238 |
| 239 #define dfaac(a) do { \ | |
| 240 const char* n = AV_STRINGIFY(faacDec ## a); \ | |
| 241 if (!err && !(s->faacDec ## a = dlsym(s->handle, n))) { \ | |
| 242 err = n; \ | |
| 243 } \ | |
| 244 } while(0) | |
|
4336
b7caa9237018
Rename variables: faad --> libfaad, faac --> libfaac, faadbin --> libfaadbin
diego
parents:
4163
diff
changeset
|
245 #else /* !CONFIG_LIBFAADBIN */ |
| 6177 | 246 #define dfaac(a) s->faacDec ## a = faacDec ## a |
|
4336
b7caa9237018
Rename variables: faad --> libfaad, faac --> libfaac, faadbin --> libfaadbin
diego
parents:
4163
diff
changeset
|
247 #endif /* CONFIG_LIBFAADBIN */ |
| 1245 | 248 |
| 6177 | 249 // resolve all needed function calls |
| 250 dfaac(Open); | |
| 251 dfaac(Close); | |
| 252 dfaac(GetCurrentConfiguration); | |
| 253 dfaac(SetConfiguration); | |
| 254 dfaac(Init); | |
| 255 dfaac(Init2); | |
| 256 dfaac(Decode); | |
| 257 #ifdef FAAD2_VERSION | |
| 258 dfaac(GetErrorMessage); | |
| 259 #endif | |
| 1245 | 260 |
| 6177 | 261 #undef dfaac |
| 1245 | 262 |
| 8590 | 263 #if CONFIG_LIBFAADBIN |
| 1245 | 264 if (err) { |
| 265 dlclose(s->handle); | |
| 2979 | 266 av_log(avctx, AV_LOG_ERROR, "FAAD library: cannot resolve %s in %s!\n", |
| 6175 | 267 err, libfaadname); |
| 1245 | 268 return -1; |
| 269 } | |
| 270 #endif | |
| 271 | |
| 272 s->faac_handle = s->faacDecOpen(); | |
| 273 if (!s->faac_handle) { | |
|
1602
fdb8244da1e5
av_log patch(2 of ?) by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1245
diff
changeset
|
274 av_log(avctx, AV_LOG_ERROR, "FAAD library: cannot create handler!\n"); |
| 1245 | 275 faac_decode_end(avctx); |
| 276 return -1; | |
| 277 } | |
| 278 | |
| 279 | |
| 280 faac_cfg = s->faacDecGetCurrentConfiguration(s->faac_handle); | |
| 281 | |
| 282 if (faac_cfg) { | |
|
7823
4525dcd81357
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
7451
diff
changeset
|
283 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
|
284 case 8: av_log(avctx, AV_LOG_ERROR, "FAADlib unsupported bps %d\n", avctx->bits_per_coded_sample); break; |
| 2979 | 285 default: |
| 286 case 16: | |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
287 #ifdef FAAD2_VERSION |
| 2979 | 288 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
|
289 #endif |
| 2979 | 290 s->sample_size = 2; |
| 291 break; | |
| 292 case 24: | |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
293 #ifdef FAAD2_VERSION |
| 2979 | 294 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
|
295 #endif |
| 2979 | 296 s->sample_size = 3; |
| 297 break; | |
| 298 case 32: | |
|
1929
d4525c3065d0
aac decoding patch by ("Thomas Raivio" <tjraivio at cc dot hut dot fi>)
michael
parents:
1602
diff
changeset
|
299 #ifdef FAAD2_VERSION |
| 2979 | 300 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
|
301 #endif |
| 2979 | 302 s->sample_size = 4; |
| 303 break; | |
| 304 } | |
| 1245 | 305 |
| 2979 | 306 faac_cfg->defSampleRate = (!avctx->sample_rate) ? 44100 : avctx->sample_rate; |
| 307 faac_cfg->defObjectType = LC; | |
| 1245 | 308 } |
| 309 | |
| 310 s->faacDecSetConfiguration(s->faac_handle, faac_cfg); | |
| 311 | |
| 312 faac_init_mp4(avctx); | |
| 313 | |
| 6119 | 314 if(!s->init && avctx->channels > 0) |
| 315 channel_setup(avctx); | |
| 316 | |
|
7451
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7158
diff
changeset
|
317 avctx->sample_fmt = SAMPLE_FMT_S16; |
| 1245 | 318 return 0; |
| 319 } | |
| 320 | |
|
6819
43bede126ef6
missing codec long names by Stefano Sabatini, stefano.sabatini-lala poste it
diego
parents:
6790
diff
changeset
|
321 #define AAC_CODEC(id, name, long_name_) \ |
| 1245 | 322 AVCodec name ## _decoder = { \ |
| 323 #name, \ | |
| 324 CODEC_TYPE_AUDIO, \ | |
| 325 id, \ | |
| 326 sizeof(FAACContext), \ | |
| 327 faac_decode_init, \ | |
| 328 NULL, \ | |
| 329 faac_decode_end, \ | |
| 330 faac_decode_frame, \ | |
|
7040
e943e1409077
Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents:
6819
diff
changeset
|
331 .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ |
| 1245 | 332 } |
| 333 | |
| 334 // FIXME - raw AAC files - maybe just one entry will be enough | |
|
6819
43bede126ef6
missing codec long names by Stefano Sabatini, stefano.sabatini-lala poste it
diego
parents:
6790
diff
changeset
|
335 AAC_CODEC(CODEC_ID_AAC, libfaad, "libfaad AAC (Advanced Audio Codec)"); |
| 1245 | 336 |
| 337 #undef AAC_CODEC |
