mathops: remove undefined behaviour from sign_extend()
[libav.git] / libavcodec / pcm.c
CommitLineData
a96b68b7
FB
1/*
2 * PCM codecs
406792e7 3 * Copyright (c) 2001 Fabrice Bellard
a96b68b7 4 *
2912e87a 5 * This file is part of Libav.
b78e7197 6 *
2912e87a 7 * Libav is free software; you can redistribute it and/or
ff4ec49e
FB
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
b78e7197 10 * version 2.1 of the License, or (at your option) any later version.
a96b68b7 11 *
2912e87a 12 * Libav is distributed in the hope that it will be useful,
a96b68b7 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ff4ec49e
FB
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
a96b68b7 16 *
ff4ec49e 17 * You should have received a copy of the GNU Lesser General Public
2912e87a 18 * License along with Libav; if not, write to the Free Software
5509bffa 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
a96b68b7 20 */
115329f1 21
1ab3d669 22/**
ba87f080 23 * @file
1ab3d669
MN
24 * PCM codecs
25 */
115329f1 26
a96b68b7 27#include "avcodec.h"
91cc5d37 28#include "libavutil/common.h" /* for av_reverse */
5a2f421a 29#include "bytestream.h"
fa034b44 30#include "pcm_tablegen.h"
a96b68b7 31
725d86bf
AJ
32#define MAX_CHANNELS 64
33
98a6fff9 34static av_cold int pcm_encode_init(AVCodecContext *avctx)
a96b68b7
FB
35{
36 avctx->frame_size = 1;
37 switch(avctx->codec->id) {
38 case CODEC_ID_PCM_ALAW:
fa034b44 39 pcm_alaw_tableinit();
a96b68b7
FB
40 break;
41 case CODEC_ID_PCM_MULAW:
fa034b44 42 pcm_ulaw_tableinit();
a96b68b7
FB
43 break;
44 default:
45 break;
46 }
115329f1 47
dd1c8f3e
LA
48 avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
49 avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8;
492cd3a9
MN
50 avctx->coded_frame= avcodec_alloc_frame();
51 avctx->coded_frame->key_frame= 1;
115329f1 52
a96b68b7
FB
53 return 0;
54}
55
98a6fff9 56static av_cold int pcm_encode_close(AVCodecContext *avctx)
a96b68b7 57{
492cd3a9
MN
58 av_freep(&avctx->coded_frame);
59
a96b68b7
FB
60 return 0;
61}
62
b461b3bc 63/**
3ee573a3
PR
64 * Write PCM samples macro
65 * @param type Datatype of native machine format
66 * @param endian bytestream_put_xxx() suffix
67 * @param src Source pointer (variable name)
68 * @param dst Destination pointer (variable name)
69 * @param n Total number of samples (variable name)
5e8ecfde 70 * @param shift Bitshift (bits)
3ee573a3
PR
71 * @param offset Sample value offset
72 */
5e8ecfde 73#define ENCODE(type, endian, src, dst, n, shift, offset) \
151cd4f9 74 samples_##type = (const type*) src; \
3ee573a3 75 for(;n>0;n--) { \
5e8ecfde 76 register type v = (*samples_##type++ >> shift) + offset; \
3ee573a3 77 bytestream_put_##endian(&dst, v); \
5e8ecfde 78 }
3ee573a3 79
cd4af68a 80static int pcm_encode_frame(AVCodecContext *avctx,
bb270c08 81 unsigned char *frame, int buf_size, void *data)
a96b68b7
FB
82{
83 int n, sample_size, v;
edac49da 84 const short *samples;
a96b68b7 85 unsigned char *dst;
edac49da
RD
86 const uint8_t *srcu8;
87 const int16_t *samples_int16_t;
88 const int32_t *samples_int32_t;
89 const int64_t *samples_int64_t;
90 const uint16_t *samples_uint16_t;
91 const uint32_t *samples_uint32_t;
a96b68b7 92
cc0b6129 93 sample_size = av_get_bits_per_sample(avctx->codec->id)/8;
a96b68b7
FB
94 n = buf_size / sample_size;
95 samples = data;
96 dst = frame;
97
5e8ecfde
PR
98 if (avctx->sample_fmt!=avctx->codec->sample_fmts[0]) {
99 av_log(avctx, AV_LOG_ERROR, "invalid sample_fmt\n");
100 return -1;
101 }
102
a96b68b7 103 switch(avctx->codec->id) {
b461b3bc 104 case CODEC_ID_PCM_U32LE:
5e8ecfde 105 ENCODE(uint32_t, le32, samples, dst, n, 0, 0x80000000)
b461b3bc
RD
106 break;
107 case CODEC_ID_PCM_U32BE:
5e8ecfde 108 ENCODE(uint32_t, be32, samples, dst, n, 0, 0x80000000)
b461b3bc
RD
109 break;
110 case CODEC_ID_PCM_S24LE:
5e8ecfde 111 ENCODE(int32_t, le24, samples, dst, n, 8, 0)
b461b3bc
RD
112 break;
113 case CODEC_ID_PCM_S24BE:
5e8ecfde 114 ENCODE(int32_t, be24, samples, dst, n, 8, 0)
b461b3bc
RD
115 break;
116 case CODEC_ID_PCM_U24LE:
5e8ecfde 117 ENCODE(uint32_t, le24, samples, dst, n, 8, 0x800000)
b461b3bc
RD
118 break;
119 case CODEC_ID_PCM_U24BE:
5e8ecfde 120 ENCODE(uint32_t, be24, samples, dst, n, 8, 0x800000)
b461b3bc
RD
121 break;
122 case CODEC_ID_PCM_S24DAUD:
123 for(;n>0;n--) {
91cc5d37
FL
124 uint32_t tmp = av_reverse[(*samples >> 8) & 0xff] +
125 (av_reverse[*samples & 0xff] << 8);
b461b3bc 126 tmp <<= 4; // sync flags would go here
5a2f421a 127 bytestream_put_be24(&dst, tmp);
b461b3bc 128 samples++;
b461b3bc
RD
129 }
130 break;
a96b68b7 131 case CODEC_ID_PCM_U16LE:
5e8ecfde 132 ENCODE(uint16_t, le16, samples, dst, n, 0, 0x8000)
a96b68b7
FB
133 break;
134 case CODEC_ID_PCM_U16BE:
5e8ecfde 135 ENCODE(uint16_t, be16, samples, dst, n, 0, 0x8000)
a96b68b7
FB
136 break;
137 case CODEC_ID_PCM_S8:
5e8ecfde 138 srcu8= data;
a96b68b7 139 for(;n>0;n--) {
5e8ecfde
PR
140 v = *srcu8++;
141 *dst++ = v - 128;
a96b68b7
FB
142 }
143 break;
63613fe6 144#if HAVE_BIGENDIAN
143a5d6f
PR
145 case CODEC_ID_PCM_F64LE:
146 ENCODE(int64_t, le64, samples, dst, n, 0, 0)
147 break;
38a1c7f2 148 case CODEC_ID_PCM_S32LE:
143a5d6f 149 case CODEC_ID_PCM_F32LE:
38a1c7f2
PR
150 ENCODE(int32_t, le32, samples, dst, n, 0, 0)
151 break;
152 case CODEC_ID_PCM_S16LE:
153 ENCODE(int16_t, le16, samples, dst, n, 0, 0)
154 break;
143a5d6f 155 case CODEC_ID_PCM_F64BE:
38a1c7f2
PR
156 case CODEC_ID_PCM_F32BE:
157 case CODEC_ID_PCM_S32BE:
158 case CODEC_ID_PCM_S16BE:
159#else
143a5d6f
PR
160 case CODEC_ID_PCM_F64BE:
161 ENCODE(int64_t, be64, samples, dst, n, 0, 0)
162 break;
38a1c7f2
PR
163 case CODEC_ID_PCM_F32BE:
164 case CODEC_ID_PCM_S32BE:
165 ENCODE(int32_t, be32, samples, dst, n, 0, 0)
166 break;
167 case CODEC_ID_PCM_S16BE:
168 ENCODE(int16_t, be16, samples, dst, n, 0, 0)
169 break;
143a5d6f
PR
170 case CODEC_ID_PCM_F64LE:
171 case CODEC_ID_PCM_F32LE:
38a1c7f2
PR
172 case CODEC_ID_PCM_S32LE:
173 case CODEC_ID_PCM_S16LE:
63613fe6 174#endif /* HAVE_BIGENDIAN */
a96b68b7 175 case CODEC_ID_PCM_U8:
38a1c7f2
PR
176 memcpy(dst, samples, n*sample_size);
177 dst += n*sample_size;
a96b68b7 178 break;
a11c2a2c
MN
179 case CODEC_ID_PCM_ZORK:
180 for(;n>0;n--) {
181 v= *samples++ >> 8;
182 if(v<0) v = -v;
183 else v+= 128;
184 *dst++ = v;
185 }
186 break;
a96b68b7
FB
187 case CODEC_ID_PCM_ALAW:
188 for(;n>0;n--) {
189 v = *samples++;
a4461664 190 *dst++ = linear_to_alaw[(v + 32768) >> 2];
a96b68b7
FB
191 }
192 break;
193 case CODEC_ID_PCM_MULAW:
194 for(;n>0;n--) {
195 v = *samples++;
a4461664 196 *dst++ = linear_to_ulaw[(v + 32768) >> 2];
a96b68b7
FB
197 }
198 break;
199 default:
200 return -1;
201 }
13a0314f 202 //avctx->frame_size = (dst - frame) / (sample_size * avctx->channels);
4c3d2e5f 203
a96b68b7
FB
204 return dst - frame;
205}
206
207typedef struct PCMDecode {
208 short table[256];
209} PCMDecode;
210
98a6fff9 211static av_cold int pcm_decode_init(AVCodecContext * avctx)
a96b68b7
FB
212{
213 PCMDecode *s = avctx->priv_data;
214 int i;
215
216 switch(avctx->codec->id) {
217 case CODEC_ID_PCM_ALAW:
218 for(i=0;i<256;i++)
219 s->table[i] = alaw2linear(i);
220 break;
221 case CODEC_ID_PCM_MULAW:
222 for(i=0;i<256;i++)
223 s->table[i] = ulaw2linear(i);
224 break;
225 default:
226 break;
227 }
aa29709e 228
0fd7e57e 229 avctx->sample_fmt = avctx->codec->sample_fmts[0];
4dbcfa6f 230
5d6e4c16 231 if (avctx->sample_fmt == AV_SAMPLE_FMT_S32)
4dbcfa6f
JR
232 avctx->bits_per_raw_sample = av_get_bits_per_sample(avctx->codec->id);
233
a96b68b7
FB
234 return 0;
235}
236
b461b3bc 237/**
3ee573a3
PR
238 * Read PCM samples macro
239 * @param type Datatype of native machine format
240 * @param endian bytestream_get_xxx() endian suffix
241 * @param src Source pointer (variable name)
242 * @param dst Destination pointer (variable name)
243 * @param n Total number of samples (variable name)
5e8ecfde 244 * @param shift Bitshift (bits)
3ee573a3
PR
245 * @param offset Sample value offset
246 */
5e8ecfde
PR
247#define DECODE(type, endian, src, dst, n, shift, offset) \
248 dst_##type = (type*)dst; \
3ee573a3
PR
249 for(;n>0;n--) { \
250 register type v = bytestream_get_##endian(&src); \
5e8ecfde 251 *dst_##type++ = (v - offset) << shift; \
3ee573a3 252 } \
5e8ecfde 253 dst = (short*)dst_##type;
3ee573a3 254
cd4af68a 255static int pcm_decode_frame(AVCodecContext *avctx,
bb270c08 256 void *data, int *data_size,
7a00bbad 257 AVPacket *avpkt)
a96b68b7 258{
7a00bbad
TB
259 const uint8_t *buf = avpkt->data;
260 int buf_size = avpkt->size;
a96b68b7 261 PCMDecode *s = avctx->priv_data;
fbeabfca 262 int sample_size, c, n, i;
a96b68b7 263 short *samples;
0cdc6ec9 264 const uint8_t *src, *src8, *src2[MAX_CHANNELS];
5e8ecfde
PR
265 uint8_t *dstu8;
266 int16_t *dst_int16_t;
267 int32_t *dst_int32_t;
143a5d6f 268 int64_t *dst_int64_t;
5e8ecfde
PR
269 uint16_t *dst_uint16_t;
270 uint32_t *dst_uint32_t;
a96b68b7
FB
271
272 samples = data;
273 src = buf;
274
5e8ecfde
PR
275 if (avctx->sample_fmt!=avctx->codec->sample_fmts[0]) {
276 av_log(avctx, AV_LOG_ERROR, "invalid sample_fmt\n");
277 return -1;
278 }
279
3426d575 280 if(avctx->channels <= 0 || avctx->channels > MAX_CHANNELS){
281 av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n");
282 return -1;
283 }
b2a581dc 284
ff66caab
PR
285 sample_size = av_get_bits_per_sample(avctx->codec_id)/8;
286
1472b7dd
LT
287 /* av_get_bits_per_sample returns 0 for CODEC_ID_PCM_DVD */
288 if (CODEC_ID_PCM_DVD == avctx->codec_id)
289 /* 2 samples are interleaved per block in PCM_DVD */
dd1c8f3e 290 sample_size = avctx->bits_per_coded_sample * 2 / 8;
fbeabfca
TH
291 else if (avctx->codec_id == CODEC_ID_PCM_LXF)
292 /* we process 40-bit blocks per channel for LXF */
293 sample_size = 5;
2cd04cf9 294
e048a9ca
DK
295 if (sample_size == 0) {
296 av_log(avctx, AV_LOG_ERROR, "Invalid sample_size\n");
297 return AVERROR(EINVAL);
298 }
299
2cd04cf9 300 n = avctx->channels * sample_size;
1472b7dd
LT
301
302 if(n && buf_size % n){
012e4f5a 303 if (buf_size < n) {
34365443
MN
304 av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");
305 return -1;
012e4f5a
MN
306 }else
307 buf_size -= buf_size % n;
1472b7dd
LT
308 }
309
ac66834c
MN
310 buf_size= FFMIN(buf_size, *data_size/2);
311 *data_size=0;
a8d02f2b 312
ff66caab 313 n = buf_size/sample_size;
725d86bf 314
a96b68b7 315 switch(avctx->codec->id) {
b461b3bc 316 case CODEC_ID_PCM_U32LE:
5e8ecfde 317 DECODE(uint32_t, le32, src, samples, n, 0, 0x80000000)
b461b3bc
RD
318 break;
319 case CODEC_ID_PCM_U32BE:
5e8ecfde 320 DECODE(uint32_t, be32, src, samples, n, 0, 0x80000000)
b461b3bc
RD
321 break;
322 case CODEC_ID_PCM_S24LE:
5e8ecfde 323 DECODE(int32_t, le24, src, samples, n, 8, 0)
b461b3bc
RD
324 break;
325 case CODEC_ID_PCM_S24BE:
5e8ecfde 326 DECODE(int32_t, be24, src, samples, n, 8, 0)
b461b3bc
RD
327 break;
328 case CODEC_ID_PCM_U24LE:
5e8ecfde 329 DECODE(uint32_t, le24, src, samples, n, 8, 0x800000)
b461b3bc
RD
330 break;
331 case CODEC_ID_PCM_U24BE:
5e8ecfde 332 DECODE(uint32_t, be24, src, samples, n, 8, 0x800000)
b461b3bc
RD
333 break;
334 case CODEC_ID_PCM_S24DAUD:
b461b3bc 335 for(;n>0;n--) {
5a2f421a 336 uint32_t v = bytestream_get_be24(&src);
b461b3bc 337 v >>= 4; // sync flags are here
91cc5d37
FL
338 *samples++ = av_reverse[(v >> 8) & 0xff] +
339 (av_reverse[v & 0xff] << 8);
b461b3bc
RD
340 }
341 break;
725d86bf 342 case CODEC_ID_PCM_S16LE_PLANAR:
ff66caab
PR
343 n /= avctx->channels;
344 for(c=0;c<avctx->channels;c++)
4efbd755
PR
345 src2[c] = &src[c*n*2];
346 for(;n>0;n--)
725d86bf
AJ
347 for(c=0;c<avctx->channels;c++)
348 *samples++ = bytestream_get_le16(&src2[c]);
349 src = src2[avctx->channels-1];
350 break;
a96b68b7 351 case CODEC_ID_PCM_U16LE:
5e8ecfde 352 DECODE(uint16_t, le16, src, samples, n, 0, 0x8000)
a96b68b7
FB
353 break;
354 case CODEC_ID_PCM_U16BE:
5e8ecfde 355 DECODE(uint16_t, be16, src, samples, n, 0, 0x8000)
a96b68b7
FB
356 break;
357 case CODEC_ID_PCM_S8:
5e8ecfde 358 dstu8= (uint8_t*)samples;
a96b68b7 359 for(;n>0;n--) {
5e8ecfde 360 *dstu8++ = *src++ + 128;
a96b68b7 361 }
5e8ecfde 362 samples= (short*)dstu8;
a96b68b7 363 break;
63613fe6 364#if HAVE_BIGENDIAN
143a5d6f
PR
365 case CODEC_ID_PCM_F64LE:
366 DECODE(int64_t, le64, src, samples, n, 0, 0)
367 break;
38a1c7f2 368 case CODEC_ID_PCM_S32LE:
143a5d6f 369 case CODEC_ID_PCM_F32LE:
38a1c7f2
PR
370 DECODE(int32_t, le32, src, samples, n, 0, 0)
371 break;
372 case CODEC_ID_PCM_S16LE:
373 DECODE(int16_t, le16, src, samples, n, 0, 0)
374 break;
143a5d6f 375 case CODEC_ID_PCM_F64BE:
38a1c7f2
PR
376 case CODEC_ID_PCM_F32BE:
377 case CODEC_ID_PCM_S32BE:
378 case CODEC_ID_PCM_S16BE:
379#else
143a5d6f
PR
380 case CODEC_ID_PCM_F64BE:
381 DECODE(int64_t, be64, src, samples, n, 0, 0)
382 break;
38a1c7f2
PR
383 case CODEC_ID_PCM_F32BE:
384 case CODEC_ID_PCM_S32BE:
385 DECODE(int32_t, be32, src, samples, n, 0, 0)
386 break;
387 case CODEC_ID_PCM_S16BE:
388 DECODE(int16_t, be16, src, samples, n, 0, 0)
389 break;
143a5d6f
PR
390 case CODEC_ID_PCM_F64LE:
391 case CODEC_ID_PCM_F32LE:
38a1c7f2
PR
392 case CODEC_ID_PCM_S32LE:
393 case CODEC_ID_PCM_S16LE:
63613fe6 394#endif /* HAVE_BIGENDIAN */
a96b68b7 395 case CODEC_ID_PCM_U8:
38a1c7f2
PR
396 memcpy(samples, src, n*sample_size);
397 src += n*sample_size;
398 samples = (short*)((uint8_t*)data + n*sample_size);
a96b68b7 399 break;
a11c2a2c 400 case CODEC_ID_PCM_ZORK:
a11c2a2c
MN
401 for(;n>0;n--) {
402 int x= *src++;
403 if(x&128) x-= 128;
404 else x = -x;
405 *samples++ = x << 8;
406 }
407 break;
a96b68b7
FB
408 case CODEC_ID_PCM_ALAW:
409 case CODEC_ID_PCM_MULAW:
a96b68b7 410 for(;n>0;n--) {
a4461664 411 *samples++ = s->table[*src++];
a96b68b7
FB
412 }
413 break;
1472b7dd 414 case CODEC_ID_PCM_DVD:
0cdc6ec9
PR
415 dst_int32_t = data;
416 n /= avctx->channels;
dd1c8f3e 417 switch (avctx->bits_per_coded_sample) {
0cdc6ec9 418 case 20:
1472b7dd 419 while (n--) {
0cdc6ec9
PR
420 c = avctx->channels;
421 src8 = src + 4*c;
422 while (c--) {
423 *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8 &0xf0) << 8);
424 *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++ &0x0f) << 12);
425 }
426 src = src8;
1472b7dd 427 }
0cdc6ec9
PR
428 break;
429 case 24:
430 while (n--) {
431 c = avctx->channels;
432 src8 = src + 4*c;
433 while (c--) {
434 *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8);
435 *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8);
436 }
437 src = src8;
438 }
439 break;
440 default:
441 av_log(avctx, AV_LOG_ERROR, "PCM DVD unsupported sample depth\n");
442 return -1;
1472b7dd 443 }
0cdc6ec9 444 samples = (short *) dst_int32_t;
1472b7dd 445 break;
fbeabfca
TH
446 case CODEC_ID_PCM_LXF:
447 dst_int32_t = data;
448 n /= avctx->channels;
449 //unpack and de-planerize
450 for (i = 0; i < n; i++) {
451 for (c = 0, src8 = src + i*5; c < avctx->channels; c++, src8 += n*5) {
452 //extract low 20 bits and expand to 32 bits
453 *dst_int32_t++ = (src8[2] << 28) | (src8[1] << 20) | (src8[0] << 12) |
454 ((src8[2] & 0xF) << 8) | src8[1];
455 }
456
457 for (c = 0, src8 = src + i*5; c < avctx->channels; c++, src8 += n*5) {
458 //extract high 20 bits and expand to 32 bits
459 *dst_int32_t++ = (src8[4] << 24) | (src8[3] << 16) |
460 ((src8[2] & 0xF0) << 8) | (src8[4] << 4) | (src8[3] >> 4);
461 }
462 }
463 src += n * avctx->channels * 5;
464 samples = (short *) dst_int32_t;
465 break;
a96b68b7 466 default:
a96b68b7
FB
467 return -1;
468 }
0c1a9eda 469 *data_size = (uint8_t *)samples - (uint8_t *)data;
a96b68b7
FB
470 return src - buf;
471}
472
b250f9c6 473#if CONFIG_ENCODERS
a5b588bc 474#define PCM_ENCODER(id_,sample_fmt_,name_,long_name_) \
d36beb3f 475AVCodec ff_ ## name_ ## _encoder = { \
a5b588bc
PR
476 .name = #name_, \
477 .type = AVMEDIA_TYPE_AUDIO, \
478 .id = id_, \
479 .init = pcm_encode_init, \
480 .encode = pcm_encode_frame, \
481 .close = pcm_encode_close, \
5d6e4c16 482 .sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \
fe4bf374 483 .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
44adbebe 484}
2b045c9c 485#else
fd76c37f 486#define PCM_ENCODER(id,sample_fmt_,name,long_name_)
2b045c9c
AJ
487#endif
488
b250f9c6 489#if CONFIG_DECODERS
a5b588bc 490#define PCM_DECODER(id_,sample_fmt_,name_,long_name_) \
d36beb3f 491AVCodec ff_ ## name_ ## _decoder = { \
a5b588bc
PR
492 .name = #name_, \
493 .type = AVMEDIA_TYPE_AUDIO, \
494 .id = id_, \
495 .priv_data_size = sizeof(PCMDecode), \
496 .init = pcm_decode_init, \
497 .decode = pcm_decode_frame, \
5d6e4c16 498 .sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \
fe4bf374 499 .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
44adbebe 500}
2b045c9c 501#else
0fd7e57e 502#define PCM_DECODER(id,sample_fmt_,name,long_name_)
2b045c9c
AJ
503#endif
504
fd76c37f 505#define PCM_CODEC(id, sample_fmt_, name, long_name_) \
44adbebe 506 PCM_ENCODER(id,sample_fmt_,name,long_name_); PCM_DECODER(id,sample_fmt_,name,long_name_)
44caa86d 507
bbdfa06d 508/* Note: Do not forget to add new entries to the Makefile as well. */
5d6e4c16 509PCM_CODEC (CODEC_ID_PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law");
5b5083b5 510PCM_DECODER(CODEC_ID_PCM_DVD, AV_SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian");
5d6e4c16
SS
511PCM_CODEC (CODEC_ID_PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian");
512PCM_CODEC (CODEC_ID_PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian");
513PCM_CODEC (CODEC_ID_PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian");
514PCM_CODEC (CODEC_ID_PCM_F64LE, AV_SAMPLE_FMT_DBL, pcm_f64le, "PCM 64-bit floating point little-endian");
515PCM_DECODER(CODEC_ID_PCM_LXF, AV_SAMPLE_FMT_S32, pcm_lxf, "PCM signed 20-bit little-endian planar");
516PCM_CODEC (CODEC_ID_PCM_MULAW, AV_SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law");
517PCM_CODEC (CODEC_ID_PCM_S8, AV_SAMPLE_FMT_U8, pcm_s8, "PCM signed 8-bit");
518PCM_CODEC (CODEC_ID_PCM_S16BE, AV_SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-endian");
519PCM_CODEC (CODEC_ID_PCM_S16LE, AV_SAMPLE_FMT_S16, pcm_s16le, "PCM signed 16-bit little-endian");
520PCM_DECODER(CODEC_ID_PCM_S16LE_PLANAR, AV_SAMPLE_FMT_S16, pcm_s16le_planar, "PCM 16-bit little-endian planar");
521PCM_CODEC (CODEC_ID_PCM_S24BE, AV_SAMPLE_FMT_S32, pcm_s24be, "PCM signed 24-bit big-endian");
522PCM_CODEC (CODEC_ID_PCM_S24DAUD, AV_SAMPLE_FMT_S16, pcm_s24daud, "PCM D-Cinema audio signed 24-bit");
523PCM_CODEC (CODEC_ID_PCM_S24LE, AV_SAMPLE_FMT_S32, pcm_s24le, "PCM signed 24-bit little-endian");
524PCM_CODEC (CODEC_ID_PCM_S32BE, AV_SAMPLE_FMT_S32, pcm_s32be, "PCM signed 32-bit big-endian");
525PCM_CODEC (CODEC_ID_PCM_S32LE, AV_SAMPLE_FMT_S32, pcm_s32le, "PCM signed 32-bit little-endian");
526PCM_CODEC (CODEC_ID_PCM_U8, AV_SAMPLE_FMT_U8, pcm_u8, "PCM unsigned 8-bit");
527PCM_CODEC (CODEC_ID_PCM_U16BE, AV_SAMPLE_FMT_S16, pcm_u16be, "PCM unsigned 16-bit big-endian");
528PCM_CODEC (CODEC_ID_PCM_U16LE, AV_SAMPLE_FMT_S16, pcm_u16le, "PCM unsigned 16-bit little-endian");
529PCM_CODEC (CODEC_ID_PCM_U24BE, AV_SAMPLE_FMT_S32, pcm_u24be, "PCM unsigned 24-bit big-endian");
530PCM_CODEC (CODEC_ID_PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian");
531PCM_CODEC (CODEC_ID_PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian");
532PCM_CODEC (CODEC_ID_PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian");
533PCM_CODEC (CODEC_ID_PCM_ZORK, AV_SAMPLE_FMT_S16, pcm_zork, "PCM Zork");