pcm.c 18 KB

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