Mercurial > libavcodec.hg
annotate libamr.c @ 9591:483ba97736f8 libavcodec
Remove dead assignments found by CSA
author | banan |
---|---|
date | Sat, 02 May 2009 09:12:03 +0000 |
parents | 57a2076a2c40 |
children | 2d4718adf588 |
rev | line source |
---|---|
1258
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
1 /* |
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
2 * AMR Audio decoder stub |
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
3 * Copyright (c) 2003 the ffmpeg project |
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
4 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3463
diff
changeset
|
5 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3463
diff
changeset
|
6 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3463
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
1258
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
9 * 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:
3463
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
1258
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
11 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3463
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
1258
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
16 * |
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
17 * 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:
3463
diff
changeset
|
18 * 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
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
1258
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
20 */ |
2967 | 21 |
4575 | 22 /** @file |
23 * Adaptive Multi-Rate (AMR) Audio decoder stub. | |
24 * | |
25 * This code implements both an AMR-NarrowBand (AMR-NB) and an AMR-WideBand | |
26 * (AMR-WB) audio encoder/decoder through external reference code from | |
27 * http://www.3gpp.org/. The license of the code from 3gpp is unclear so you | |
28 * have to download the code separately. Two versions exists: One fixed-point | |
4857 | 29 * and one floating-point. For some reason the float encoder is significantly |
30 * faster at least on a P4 1.5GHz (0.9s instead of 9.9s on a 30s audio clip | |
31 * at MR102). Both float and fixed point are supported for AMR-NB, but only | |
32 * float for AMR-WB. | |
4575 | 33 * |
34 * \section AMR-NB | |
35 * | |
36 * \subsection Float | |
37 * The float version (default) can be downloaded from: | |
4746
4aedb3b6fa4e
Update specification and reference implementation links.
diego
parents:
4744
diff
changeset
|
38 * http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-610.zip |
4575 | 39 * |
40 * \subsection Specification | |
41 * The specification for AMR-NB can be found in TS 26.071 | |
42 * (http://www.3gpp.org/ftp/Specs/html-info/26071.htm) and some other | |
43 * info at http://www.3gpp.org/ftp/Specs/html-info/26-series.htm. | |
44 * | |
45 * \section AMR-WB | |
4858
3e38885a28bc
Remove the build instructions from the doxygen comments, they are duplicated
diego
parents:
4857
diff
changeset
|
46 * |
4575 | 47 * \subsection Float |
48 * The reference code can be downloaded from: | |
4746
4aedb3b6fa4e
Update specification and reference implementation links.
diego
parents:
4744
diff
changeset
|
49 * http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-600.zip |
4575 | 50 * |
51 * \subsection Specification | |
4746
4aedb3b6fa4e
Update specification and reference implementation links.
diego
parents:
4744
diff
changeset
|
52 * The specification for AMR-WB can be found in TS 26.171 |
4aedb3b6fa4e
Update specification and reference implementation links.
diego
parents:
4744
diff
changeset
|
53 * (http://www.3gpp.org/ftp/Specs/html-info/26171.htm) and some other |
4aedb3b6fa4e
Update specification and reference implementation links.
diego
parents:
4744
diff
changeset
|
54 * info at http://www.3gpp.org/ftp/Specs/html-info/26-series.htm. |
4575 | 55 * |
1297 | 56 */ |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
57 |
1297 | 58 #include "avcodec.h" |
59 | |
4843
0e11f292482f
Replace hackish support for amr-nb and amr-wb. Instead of including the source
diego
parents:
4842
diff
changeset
|
60 #include <amrnb/interf_dec.h> |
0e11f292482f
Replace hackish support for amr-nb and amr-wb. Instead of including the source
diego
parents:
4842
diff
changeset
|
61 #include <amrnb/interf_enc.h> |
1297 | 62 |
8347
81238f0bea66
Fix warning "format not a string literal and no format arguments".
benoit
parents:
7451
diff
changeset
|
63 static const char nb_bitrate_unsupported[] = |
4793
e69d9ecaaf84
Print a list of valid AMR bitrates if a wrong one is used.
diego
parents:
4789
diff
changeset
|
64 "bitrate not supported: use one of 4.75k, 5.15k, 5.9k, 6.7k, 7.4k, 7.95k, 10.2k or 12.2k\n"; |
8347
81238f0bea66
Fix warning "format not a string literal and no format arguments".
benoit
parents:
7451
diff
changeset
|
65 static const char wb_bitrate_unsupported[] = |
4793
e69d9ecaaf84
Print a list of valid AMR bitrates if a wrong one is used.
diego
parents:
4789
diff
changeset
|
66 "bitrate not supported: use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, 18.25k, 19.85k, 23.05k, or 23.85k\n"; |
e69d9ecaaf84
Print a list of valid AMR bitrates if a wrong one is used.
diego
parents:
4789
diff
changeset
|
67 |
1297 | 68 /* Common code for fixed and float version*/ |
69 typedef struct AMR_bitrates | |
70 { | |
4744 | 71 int rate; |
1297 | 72 enum Mode mode; |
73 } AMR_bitrates; | |
74 | |
4744 | 75 /* Match desired bitrate */ |
76 static int getBitrateMode(int bitrate) | |
1297 | 77 { |
4744 | 78 /* make the correspondance between bitrate and mode */ |
79 AMR_bitrates rates[]={ {4750,MR475}, | |
80 {5150,MR515}, | |
81 {5900,MR59}, | |
82 {6700,MR67}, | |
83 {7400,MR74}, | |
84 {7950,MR795}, | |
85 {10200,MR102}, | |
86 {12200,MR122}, | |
1297 | 87 }; |
88 int i; | |
4633 | 89 |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
90 for(i=0;i<8;i++) |
1297 | 91 { |
4744 | 92 if(rates[i].rate==bitrate) |
1297 | 93 { |
6750 | 94 return rates[i].mode; |
1297 | 95 } |
96 } | |
4744 | 97 /* no bitrate matching, return an error */ |
98 return -1; | |
1297 | 99 } |
100 | |
4094 | 101 static void amr_decode_fix_avctx(AVCodecContext * avctx) |
102 { | |
103 const int is_amr_wb = 1 + (avctx->codec_id == CODEC_ID_AMR_WB); | |
104 | |
105 if(avctx->sample_rate == 0) | |
106 { | |
107 avctx->sample_rate = 8000 * is_amr_wb; | |
108 } | |
109 | |
110 if(avctx->channels == 0) | |
111 { | |
112 avctx->channels = 1; | |
113 } | |
114 | |
115 avctx->frame_size = 160 * is_amr_wb; | |
7451
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7040
diff
changeset
|
116 avctx->sample_fmt = SAMPLE_FMT_S16; |
4094 | 117 } |
118 | |
9582 | 119 #if CONFIG_LIBAMR_NB |
1297 | 120 |
121 typedef struct AMRContext { | |
122 int frameCount; | |
123 void * decState; | |
124 int *enstate; | |
4744 | 125 int enc_bitrate; |
1297 | 126 } AMRContext; |
127 | |
9007
043574c5c153
Add missing av_cold in static init/close functions.
stefano
parents:
8590
diff
changeset
|
128 static av_cold int amr_nb_decode_init(AVCodecContext * avctx) |
1297 | 129 { |
130 AMRContext *s = avctx->priv_data; | |
4633 | 131 |
1297 | 132 s->frameCount=0; |
133 s->decState=Decoder_Interface_init(); | |
134 if(!s->decState) | |
135 { | |
1825 | 136 av_log(avctx, AV_LOG_ERROR, "Decoder_Interface_init error\r\n"); |
1297 | 137 return -1; |
138 } | |
4094 | 139 |
140 amr_decode_fix_avctx(avctx); | |
141 | |
142 if(avctx->channels > 1) | |
143 { | |
144 av_log(avctx, AV_LOG_ERROR, "amr_nb: multichannel decoding not supported\n"); | |
145 return -1; | |
146 } | |
147 | |
1297 | 148 return 0; |
149 } | |
150 | |
9007
043574c5c153
Add missing av_cold in static init/close functions.
stefano
parents:
8590
diff
changeset
|
151 static av_cold int amr_nb_encode_init(AVCodecContext * avctx) |
1297 | 152 { |
153 AMRContext *s = avctx->priv_data; | |
4633 | 154 |
1297 | 155 s->frameCount=0; |
2967 | 156 |
1297 | 157 if(avctx->sample_rate!=8000) |
158 { | |
4309
1f95aa362562
always print message when error, AV_LOG_DEBUG -> AV_LOG_ERROR
bcoudurier
parents:
4221
diff
changeset
|
159 av_log(avctx, AV_LOG_ERROR, "Only 8000Hz sample rate supported\n"); |
1297 | 160 return -1; |
161 } | |
162 | |
163 if(avctx->channels!=1) | |
164 { | |
4309
1f95aa362562
always print message when error, AV_LOG_DEBUG -> AV_LOG_ERROR
bcoudurier
parents:
4221
diff
changeset
|
165 av_log(avctx, AV_LOG_ERROR, "Only mono supported\n"); |
1297 | 166 return -1; |
167 } | |
168 | |
169 avctx->frame_size=160; | |
170 avctx->coded_frame= avcodec_alloc_frame(); | |
171 | |
172 s->enstate=Encoder_Interface_init(0); | |
173 if(!s->enstate) | |
174 { | |
4309
1f95aa362562
always print message when error, AV_LOG_DEBUG -> AV_LOG_ERROR
bcoudurier
parents:
4221
diff
changeset
|
175 av_log(avctx, AV_LOG_ERROR, "Encoder_Interface_init error\n"); |
1297 | 176 return -1; |
177 } | |
178 | |
4744 | 179 if((s->enc_bitrate=getBitrateMode(avctx->bit_rate))<0) |
180 { | |
4793
e69d9ecaaf84
Print a list of valid AMR bitrates if a wrong one is used.
diego
parents:
4789
diff
changeset
|
181 av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported); |
4744 | 182 return -1; |
183 } | |
1297 | 184 |
185 return 0; | |
186 } | |
187 | |
9007
043574c5c153
Add missing av_cold in static init/close functions.
stefano
parents:
8590
diff
changeset
|
188 static av_cold int amr_nb_decode_close(AVCodecContext * avctx) |
1297 | 189 { |
190 AMRContext *s = avctx->priv_data; | |
4633 | 191 |
1297 | 192 Decoder_Interface_exit(s->decState); |
193 return 0; | |
194 } | |
195 | |
9007
043574c5c153
Add missing av_cold in static init/close functions.
stefano
parents:
8590
diff
changeset
|
196 static av_cold int amr_nb_encode_close(AVCodecContext * avctx) |
1297 | 197 { |
198 AMRContext *s = avctx->priv_data; | |
4633 | 199 |
1297 | 200 Encoder_Interface_exit(s->enstate); |
201 av_freep(&avctx->coded_frame); | |
202 return 0; | |
203 } | |
204 | |
205 static int amr_nb_decode_frame(AVCodecContext * avctx, | |
206 void *data, int *data_size, | |
9358
93da33bb271e
Fix second amr_nb_decode_frame() to also use the new AVPacket argument
superdump
parents:
9355
diff
changeset
|
207 AVPacket *avpkt) |
1297 | 208 { |
9358
93da33bb271e
Fix second amr_nb_decode_frame() to also use the new AVPacket argument
superdump
parents:
9355
diff
changeset
|
209 const uint8_t *buf = avpkt->data; |
93da33bb271e
Fix second amr_nb_decode_frame() to also use the new AVPacket argument
superdump
parents:
9355
diff
changeset
|
210 int buf_size = avpkt->size; |
4634 | 211 AMRContext *s = avctx->priv_data; |
8348 | 212 const uint8_t*amrData=buf; |
6428 | 213 static const uint8_t block_size[16]={ 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 }; |
1297 | 214 enum Mode dec_mode; |
215 int packet_size; | |
216 | |
2287
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
217 /* av_log(NULL,AV_LOG_DEBUG,"amr_decode_frame buf=%p buf_size=%d frameCount=%d!!\n",buf,buf_size,s->frameCount); */ |
2967 | 218 |
2287
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
219 dec_mode = (buf[0] >> 3) & 0x000F; |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
220 packet_size = block_size[dec_mode]+1; |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
221 |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
222 if(packet_size > buf_size) { |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
223 av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n", buf_size, packet_size); |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
224 return -1; |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
225 } |
2967 | 226 |
2287
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
227 s->frameCount++; |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
228 /* av_log(NULL,AV_LOG_DEBUG,"packet_size=%d amrData= 0x%X %X %X %X\n",packet_size,amrData[0],amrData[1],amrData[2],amrData[3]); */ |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
229 /* call decoder */ |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
230 Decoder_Interface_Decode(s->decState, amrData, data, 0); |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
231 *data_size=160*2; |
2967 | 232 |
2287
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
233 return packet_size; |
1258
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
234 } |
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
235 |
1297 | 236 static int amr_nb_encode_frame(AVCodecContext *avctx, |
2979 | 237 unsigned char *frame/*out*/, int buf_size, void *data/*in*/) |
1297 | 238 { |
4634 | 239 AMRContext *s = avctx->priv_data; |
1297 | 240 int written; |
241 | |
4744 | 242 if((s->enc_bitrate=getBitrateMode(avctx->bit_rate))<0) |
243 { | |
4793
e69d9ecaaf84
Print a list of valid AMR bitrates if a wrong one is used.
diego
parents:
4789
diff
changeset
|
244 av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported); |
4744 | 245 return -1; |
246 } | |
4220
4115a044e31d
allow amr bitrate to be changed "on the fly" through avctx->bitrate.
gpoirier
parents:
4094
diff
changeset
|
247 |
2967 | 248 written = Encoder_Interface_Encode(s->enstate, |
249 s->enc_bitrate, | |
250 data, | |
251 frame, | |
1297 | 252 0); |
2571
b17d868a8f39
04_AMR_no_debug_output.patch by (Calcium | calcium nurs or jp)
michael
parents:
2287
diff
changeset
|
253 /* av_log(NULL,AV_LOG_DEBUG,"amr_nb_encode_frame encoded %u bytes, bitrate %u, first byte was %#02x\n",written, s->enc_bitrate, frame[0] ); */ |
1297 | 254 |
255 return written; | |
256 } | |
257 | |
258 #endif | |
259 | |
9582 | 260 #if CONFIG_LIBAMR_NB |
2895 | 261 |
4898
3df69e140c33
Give libamr decoders/encoders a lib prefix in the name.
diego
parents:
4858
diff
changeset
|
262 AVCodec libamr_nb_decoder = |
1258
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
263 { |
4898
3df69e140c33
Give libamr decoders/encoders a lib prefix in the name.
diego
parents:
4858
diff
changeset
|
264 "libamr_nb", |
1258
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
265 CODEC_TYPE_AUDIO, |
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
266 CODEC_ID_AMR_NB, |
1297 | 267 sizeof(AMRContext), |
1258
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
268 amr_nb_decode_init, |
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
269 NULL, |
1297 | 270 amr_nb_decode_close, |
1258
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
271 amr_nb_decode_frame, |
7040
e943e1409077
Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents:
6750
diff
changeset
|
272 .long_name = NULL_IF_CONFIG_SMALL("libamr-nb Adaptive Multi-Rate (AMR) Narrow-Band"), |
1258
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
273 }; |
802614404398
AMR-NB audio support patch by (<joca at rixmail dot se>)
michaelni
parents:
diff
changeset
|
274 |
4898
3df69e140c33
Give libamr decoders/encoders a lib prefix in the name.
diego
parents:
4858
diff
changeset
|
275 AVCodec libamr_nb_encoder = |
1297 | 276 { |
4898
3df69e140c33
Give libamr decoders/encoders a lib prefix in the name.
diego
parents:
4858
diff
changeset
|
277 "libamr_nb", |
1297 | 278 CODEC_TYPE_AUDIO, |
279 CODEC_ID_AMR_NB, | |
280 sizeof(AMRContext), | |
281 amr_nb_encode_init, | |
282 amr_nb_encode_frame, | |
283 amr_nb_encode_close, | |
284 NULL, | |
7451
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7040
diff
changeset
|
285 .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, |
7040
e943e1409077
Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents:
6750
diff
changeset
|
286 .long_name = NULL_IF_CONFIG_SMALL("libamr-nb Adaptive Multi-Rate (AMR) Narrow-Band"), |
1297 | 287 }; |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
288 |
2895 | 289 #endif |
290 | |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
291 /* -----------AMR wideband ------------*/ |
8590 | 292 #if CONFIG_LIBAMR_WB |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
293 |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
294 #ifdef _TYPEDEF_H |
6186 | 295 //To avoid duplicate typedefs from typedef in amr-nb |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
296 #define typedef_h |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
297 #endif |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
298 |
4843
0e11f292482f
Replace hackish support for amr-nb and amr-wb. Instead of including the source
diego
parents:
4842
diff
changeset
|
299 #include <amrwb/enc_if.h> |
0e11f292482f
Replace hackish support for amr-nb and amr-wb. Instead of including the source
diego
parents:
4842
diff
changeset
|
300 #include <amrwb/dec_if.h> |
0e11f292482f
Replace hackish support for amr-nb and amr-wb. Instead of including the source
diego
parents:
4842
diff
changeset
|
301 #include <amrwb/if_rom.h> |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
302 |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
303 /* Common code for fixed and float version*/ |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
304 typedef struct AMRWB_bitrates |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
305 { |
4744 | 306 int rate; |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
307 int mode; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
308 } AMRWB_bitrates; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
309 |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
310 static int getWBBitrateMode(int bitrate) |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
311 { |
4744 | 312 /* make the correspondance between bitrate and mode */ |
313 AMRWB_bitrates rates[]={ {6600,0}, | |
314 {8850,1}, | |
315 {12650,2}, | |
316 {14250,3}, | |
317 {15850,4}, | |
318 {18250,5}, | |
319 {19850,6}, | |
320 {23050,7}, | |
321 {23850,8}, | |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
322 }; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
323 int i; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
324 |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
325 for(i=0;i<9;i++) |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
326 { |
4744 | 327 if(rates[i].rate==bitrate) |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
328 { |
6750 | 329 return rates[i].mode; |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
330 } |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
331 } |
4744 | 332 /* no bitrate matching, return an error */ |
333 return -1; | |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
334 } |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
335 |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
336 |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
337 typedef struct AMRWBContext { |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
338 int frameCount; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
339 void *state; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
340 int mode; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
341 Word16 allow_dtx; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
342 } AMRWBContext; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
343 |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
344 static int amr_wb_encode_init(AVCodecContext * avctx) |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
345 { |
4634 | 346 AMRWBContext *s = avctx->priv_data; |
4633 | 347 |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
348 s->frameCount=0; |
2967 | 349 |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
350 if(avctx->sample_rate!=16000) |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
351 { |
4309
1f95aa362562
always print message when error, AV_LOG_DEBUG -> AV_LOG_ERROR
bcoudurier
parents:
4221
diff
changeset
|
352 av_log(avctx, AV_LOG_ERROR, "Only 16000Hz sample rate supported\n"); |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
353 return -1; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
354 } |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
355 |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
356 if(avctx->channels!=1) |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
357 { |
4309
1f95aa362562
always print message when error, AV_LOG_DEBUG -> AV_LOG_ERROR
bcoudurier
parents:
4221
diff
changeset
|
358 av_log(avctx, AV_LOG_ERROR, "Only mono supported\n"); |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
359 return -1; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
360 } |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
361 |
4744 | 362 if((s->mode=getWBBitrateMode(avctx->bit_rate))<0) |
363 { | |
4793
e69d9ecaaf84
Print a list of valid AMR bitrates if a wrong one is used.
diego
parents:
4789
diff
changeset
|
364 av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported); |
4744 | 365 return -1; |
366 } | |
367 | |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
368 avctx->frame_size=320; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
369 avctx->coded_frame= avcodec_alloc_frame(); |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
370 |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
371 s->state = E_IF_init(); |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
372 s->allow_dtx=0; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
373 |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
374 return 0; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
375 } |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
376 |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
377 static int amr_wb_encode_close(AVCodecContext * avctx) |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
378 { |
4634 | 379 AMRWBContext *s = avctx->priv_data; |
4633 | 380 |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
381 E_IF_exit(s->state); |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
382 av_freep(&avctx->coded_frame); |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
383 s->frameCount++; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
384 return 0; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
385 } |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
386 |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
387 static int amr_wb_encode_frame(AVCodecContext *avctx, |
2979 | 388 unsigned char *frame/*out*/, int buf_size, void *data/*in*/) |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
389 { |
4634 | 390 AMRWBContext *s = avctx->priv_data; |
4220
4115a044e31d
allow amr bitrate to be changed "on the fly" through avctx->bitrate.
gpoirier
parents:
4094
diff
changeset
|
391 int size; |
4632
260b5f667458
Move the initialization on context definition. In amr.c, only the
takis
parents:
4575
diff
changeset
|
392 |
4744 | 393 if((s->mode=getWBBitrateMode(avctx->bit_rate))<0) |
394 { | |
4793
e69d9ecaaf84
Print a list of valid AMR bitrates if a wrong one is used.
diego
parents:
4789
diff
changeset
|
395 av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported); |
4744 | 396 return -1; |
397 } | |
4220
4115a044e31d
allow amr bitrate to be changed "on the fly" through avctx->bitrate.
gpoirier
parents:
4094
diff
changeset
|
398 size = E_IF_encode(s->state, s->mode, data, frame, s->allow_dtx); |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
399 return size; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
400 } |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
401 |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
402 static int amr_wb_decode_init(AVCodecContext * avctx) |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
403 { |
4634 | 404 AMRWBContext *s = avctx->priv_data; |
4633 | 405 |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
406 s->frameCount=0; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
407 s->state = D_IF_init(); |
4094 | 408 |
409 amr_decode_fix_avctx(avctx); | |
410 | |
411 if(avctx->channels > 1) | |
412 { | |
413 av_log(avctx, AV_LOG_ERROR, "amr_wb: multichannel decoding not supported\n"); | |
414 return -1; | |
415 } | |
416 | |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
417 return 0; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
418 } |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
419 |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
420 static int amr_wb_decode_frame(AVCodecContext * avctx, |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
421 void *data, int *data_size, |
9355
54bc8a2727b0
Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents:
9007
diff
changeset
|
422 AVPacket *avpkt) |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
423 { |
9355
54bc8a2727b0
Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents:
9007
diff
changeset
|
424 const uint8_t *buf = avpkt->data; |
54bc8a2727b0
Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents:
9007
diff
changeset
|
425 int buf_size = avpkt->size; |
4634 | 426 AMRWBContext *s = avctx->priv_data; |
8348 | 427 const uint8_t*amrData=buf; |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
428 int mode; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
429 int packet_size; |
6427 | 430 static const uint8_t block_size[16] = {18, 23, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1}; |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
431 |
2287
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
432 if(buf_size==0) { |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
433 /* nothing to do */ |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
434 return 0; |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
435 } |
2287
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
436 |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
437 mode = (amrData[0] >> 3) & 0x000F; |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
438 packet_size = block_size[mode]; |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
439 |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
440 if(packet_size > buf_size) { |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
441 av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n", buf_size, packet_size+1); |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
442 return -1; |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
443 } |
2967 | 444 |
2287
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
445 s->frameCount++; |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
446 D_IF_decode( s->state, amrData, data, _good_frame); |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
447 *data_size=320*2; |
679642dc54cf
segfault in amr decoder fix patch by (Richard van der Hoff - richvdh0)
michael
parents:
2028
diff
changeset
|
448 return packet_size; |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
449 } |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
450 |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
451 static int amr_wb_decode_close(AVCodecContext * avctx) |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
452 { |
4634 | 453 AMRWBContext *s = avctx->priv_data; |
4633 | 454 |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
455 D_IF_exit(s->state); |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
456 return 0; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
457 } |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
458 |
4898
3df69e140c33
Give libamr decoders/encoders a lib prefix in the name.
diego
parents:
4858
diff
changeset
|
459 AVCodec libamr_wb_decoder = |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
460 { |
4898
3df69e140c33
Give libamr decoders/encoders a lib prefix in the name.
diego
parents:
4858
diff
changeset
|
461 "libamr_wb", |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
462 CODEC_TYPE_AUDIO, |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
463 CODEC_ID_AMR_WB, |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
464 sizeof(AMRWBContext), |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
465 amr_wb_decode_init, |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
466 NULL, |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
467 amr_wb_decode_close, |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
468 amr_wb_decode_frame, |
7040
e943e1409077
Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents:
6750
diff
changeset
|
469 .long_name = NULL_IF_CONFIG_SMALL("libamr-wb Adaptive Multi-Rate (AMR) Wide-Band"), |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
470 }; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
471 |
4898
3df69e140c33
Give libamr decoders/encoders a lib prefix in the name.
diego
parents:
4858
diff
changeset
|
472 AVCodec libamr_wb_encoder = |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
473 { |
4898
3df69e140c33
Give libamr decoders/encoders a lib prefix in the name.
diego
parents:
4858
diff
changeset
|
474 "libamr_wb", |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
475 CODEC_TYPE_AUDIO, |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
476 CODEC_ID_AMR_WB, |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
477 sizeof(AMRWBContext), |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
478 amr_wb_encode_init, |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
479 amr_wb_encode_frame, |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
480 amr_wb_encode_close, |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
481 NULL, |
7451
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7040
diff
changeset
|
482 .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, |
7040
e943e1409077
Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents:
6750
diff
changeset
|
483 .long_name = NULL_IF_CONFIG_SMALL("libamr-wb Adaptive Multi-Rate (AMR) Wide-Band"), |
1486
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
484 }; |
f22010affdce
AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
michaelni
parents:
1297
diff
changeset
|
485 |
4898
3df69e140c33
Give libamr decoders/encoders a lib prefix in the name.
diego
parents:
4858
diff
changeset
|
486 #endif //CONFIG_LIBAMR_WB |