You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

572 lines
22KB

  1. /*
  2. * PCM codecs
  3. * Copyright (c) 2001 Fabrice Bellard
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg 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. * FFmpeg 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 FFmpeg; 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 "libavutil/attributes.h"
  26. #include "avcodec.h"
  27. #include "bytestream.h"
  28. #include "internal.h"
  29. #include "mathops.h"
  30. #include "pcm_tablegen.h"
  31. static av_cold int pcm_encode_init(AVCodecContext *avctx)
  32. {
  33. avctx->frame_size = 0;
  34. switch (avctx->codec->id) {
  35. case AV_CODEC_ID_PCM_ALAW:
  36. pcm_alaw_tableinit();
  37. break;
  38. case AV_CODEC_ID_PCM_MULAW:
  39. pcm_ulaw_tableinit();
  40. break;
  41. default:
  42. break;
  43. }
  44. avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
  45. avctx->block_align = avctx->channels * avctx->bits_per_coded_sample / 8;
  46. avctx->bit_rate = avctx->block_align * avctx->sample_rate * 8;
  47. return 0;
  48. }
  49. /**
  50. * Write PCM samples macro
  51. * @param type Datatype of native machine format
  52. * @param endian bytestream_put_xxx() suffix
  53. * @param src Source pointer (variable name)
  54. * @param dst Destination pointer (variable name)
  55. * @param n Total number of samples (variable name)
  56. * @param shift Bitshift (bits)
  57. * @param offset Sample value offset
  58. */
  59. #define ENCODE(type, endian, src, dst, n, shift, offset) \
  60. samples_ ## type = (const type *) src; \
  61. for (; n > 0; n--) { \
  62. register type v = (*samples_ ## type++ >> shift) + offset; \
  63. bytestream_put_ ## endian(&dst, v); \
  64. }
  65. #define ENCODE_PLANAR(type, endian, dst, n, shift, offset) \
  66. n /= avctx->channels; \
  67. for (c = 0; c < avctx->channels; c++) { \
  68. int i; \
  69. samples_ ## type = (const type *) frame->extended_data[c]; \
  70. for (i = n; i > 0; i--) { \
  71. register type v = (*samples_ ## type++ >> shift) + offset; \
  72. bytestream_put_ ## endian(&dst, v); \
  73. } \
  74. }
  75. static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
  76. const AVFrame *frame, int *got_packet_ptr)
  77. {
  78. int n, c, sample_size, v, ret;
  79. const short *samples;
  80. unsigned char *dst;
  81. const uint8_t *samples_uint8_t;
  82. const int16_t *samples_int16_t;
  83. const int32_t *samples_int32_t;
  84. const int64_t *samples_int64_t;
  85. const uint16_t *samples_uint16_t;
  86. const uint32_t *samples_uint32_t;
  87. sample_size = av_get_bits_per_sample(avctx->codec->id) / 8;
  88. n = frame->nb_samples * avctx->channels;
  89. samples = (const short *)frame->data[0];
  90. if ((ret = ff_alloc_packet2(avctx, avpkt, n * sample_size, 0)) < 0)
  91. return ret;
  92. dst = avpkt->data;
  93. switch (avctx->codec->id) {
  94. case AV_CODEC_ID_PCM_U32LE:
  95. ENCODE(uint32_t, le32, samples, dst, n, 0, 0x80000000)
  96. break;
  97. case AV_CODEC_ID_PCM_U32BE:
  98. ENCODE(uint32_t, be32, samples, dst, n, 0, 0x80000000)
  99. break;
  100. case AV_CODEC_ID_PCM_S24LE:
  101. ENCODE(int32_t, le24, samples, dst, n, 8, 0)
  102. break;
  103. case AV_CODEC_ID_PCM_S24LE_PLANAR:
  104. ENCODE_PLANAR(int32_t, le24, dst, n, 8, 0)
  105. break;
  106. case AV_CODEC_ID_PCM_S24BE:
  107. ENCODE(int32_t, be24, samples, dst, n, 8, 0)
  108. break;
  109. case AV_CODEC_ID_PCM_U24LE:
  110. ENCODE(uint32_t, le24, samples, dst, n, 8, 0x800000)
  111. break;
  112. case AV_CODEC_ID_PCM_U24BE:
  113. ENCODE(uint32_t, be24, samples, dst, n, 8, 0x800000)
  114. break;
  115. case AV_CODEC_ID_PCM_S24DAUD:
  116. for (; n > 0; n--) {
  117. uint32_t tmp = ff_reverse[(*samples >> 8) & 0xff] +
  118. (ff_reverse[*samples & 0xff] << 8);
  119. tmp <<= 4; // sync flags would go here
  120. bytestream_put_be24(&dst, tmp);
  121. samples++;
  122. }
  123. break;
  124. case AV_CODEC_ID_PCM_U16LE:
  125. ENCODE(uint16_t, le16, samples, dst, n, 0, 0x8000)
  126. break;
  127. case AV_CODEC_ID_PCM_U16BE:
  128. ENCODE(uint16_t, be16, samples, dst, n, 0, 0x8000)
  129. break;
  130. case AV_CODEC_ID_PCM_S8:
  131. ENCODE(uint8_t, byte, samples, dst, n, 0, -128)
  132. break;
  133. case AV_CODEC_ID_PCM_S8_PLANAR:
  134. ENCODE_PLANAR(uint8_t, byte, dst, n, 0, -128)
  135. break;
  136. #if HAVE_BIGENDIAN
  137. case AV_CODEC_ID_PCM_F64LE:
  138. ENCODE(int64_t, le64, samples, dst, n, 0, 0)
  139. break;
  140. case AV_CODEC_ID_PCM_S32LE:
  141. case AV_CODEC_ID_PCM_F32LE:
  142. ENCODE(int32_t, le32, samples, dst, n, 0, 0)
  143. break;
  144. case AV_CODEC_ID_PCM_S32LE_PLANAR:
  145. ENCODE_PLANAR(int32_t, le32, dst, n, 0, 0)
  146. break;
  147. case AV_CODEC_ID_PCM_S16LE:
  148. ENCODE(int16_t, le16, samples, dst, n, 0, 0)
  149. break;
  150. case AV_CODEC_ID_PCM_S16LE_PLANAR:
  151. ENCODE_PLANAR(int16_t, le16, dst, n, 0, 0)
  152. break;
  153. case AV_CODEC_ID_PCM_F64BE:
  154. case AV_CODEC_ID_PCM_F32BE:
  155. case AV_CODEC_ID_PCM_S32BE:
  156. case AV_CODEC_ID_PCM_S16BE:
  157. #else
  158. case AV_CODEC_ID_PCM_F64BE:
  159. ENCODE(int64_t, be64, samples, dst, n, 0, 0)
  160. break;
  161. case AV_CODEC_ID_PCM_F32BE:
  162. case AV_CODEC_ID_PCM_S32BE:
  163. ENCODE(int32_t, be32, samples, dst, n, 0, 0)
  164. break;
  165. case AV_CODEC_ID_PCM_S16BE:
  166. ENCODE(int16_t, be16, samples, dst, n, 0, 0)
  167. break;
  168. case AV_CODEC_ID_PCM_S16BE_PLANAR:
  169. ENCODE_PLANAR(int16_t, be16, dst, n, 0, 0)
  170. break;
  171. case AV_CODEC_ID_PCM_F64LE:
  172. case AV_CODEC_ID_PCM_F32LE:
  173. case AV_CODEC_ID_PCM_S32LE:
  174. case AV_CODEC_ID_PCM_S16LE:
  175. #endif /* HAVE_BIGENDIAN */
  176. case AV_CODEC_ID_PCM_U8:
  177. memcpy(dst, samples, n * sample_size);
  178. break;
  179. #if HAVE_BIGENDIAN
  180. case AV_CODEC_ID_PCM_S16BE_PLANAR:
  181. #else
  182. case AV_CODEC_ID_PCM_S16LE_PLANAR:
  183. case AV_CODEC_ID_PCM_S32LE_PLANAR:
  184. #endif /* HAVE_BIGENDIAN */
  185. n /= avctx->channels;
  186. for (c = 0; c < avctx->channels; c++) {
  187. const uint8_t *src = frame->extended_data[c];
  188. bytestream_put_buffer(&dst, src, n * sample_size);
  189. }
  190. break;
  191. case AV_CODEC_ID_PCM_ALAW:
  192. for (; n > 0; n--) {
  193. v = *samples++;
  194. *dst++ = linear_to_alaw[(v + 32768) >> 2];
  195. }
  196. break;
  197. case AV_CODEC_ID_PCM_MULAW:
  198. for (; n > 0; n--) {
  199. v = *samples++;
  200. *dst++ = linear_to_ulaw[(v + 32768) >> 2];
  201. }
  202. break;
  203. default:
  204. return -1;
  205. }
  206. *got_packet_ptr = 1;
  207. return 0;
  208. }
  209. typedef struct PCMDecode {
  210. short table[256];
  211. } PCMDecode;
  212. static av_cold int pcm_decode_init(AVCodecContext *avctx)
  213. {
  214. PCMDecode *s = avctx->priv_data;
  215. int i;
  216. if (avctx->channels <= 0) {
  217. av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n");
  218. return AVERROR(EINVAL);
  219. }
  220. switch (avctx->codec_id) {
  221. case AV_CODEC_ID_PCM_ALAW:
  222. for (i = 0; i < 256; i++)
  223. s->table[i] = alaw2linear(i);
  224. break;
  225. case AV_CODEC_ID_PCM_MULAW:
  226. for (i = 0; i < 256; i++)
  227. s->table[i] = ulaw2linear(i);
  228. break;
  229. default:
  230. break;
  231. }
  232. avctx->sample_fmt = avctx->codec->sample_fmts[0];
  233. if (avctx->sample_fmt == AV_SAMPLE_FMT_S32)
  234. avctx->bits_per_raw_sample = av_get_bits_per_sample(avctx->codec_id);
  235. return 0;
  236. }
  237. /**
  238. * Read PCM samples macro
  239. * @param size Data size 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)
  244. * @param shift Bitshift (bits)
  245. * @param offset Sample value offset
  246. */
  247. #define DECODE(size, endian, src, dst, n, shift, offset) \
  248. for (; n > 0; n--) { \
  249. uint ## size ## _t v = bytestream_get_ ## endian(&src); \
  250. AV_WN ## size ## A(dst, (v - offset) << shift); \
  251. dst += size / 8; \
  252. }
  253. #define DECODE_PLANAR(size, endian, src, dst, n, shift, offset) \
  254. n /= avctx->channels; \
  255. for (c = 0; c < avctx->channels; c++) { \
  256. int i; \
  257. dst = frame->extended_data[c]; \
  258. for (i = n; i > 0; i--) { \
  259. uint ## size ## _t v = bytestream_get_ ## endian(&src); \
  260. AV_WN ## size ## A(dst, (v - offset) << shift); \
  261. dst += size / 8; \
  262. } \
  263. }
  264. static int pcm_decode_frame(AVCodecContext *avctx, void *data,
  265. int *got_frame_ptr, AVPacket *avpkt)
  266. {
  267. const uint8_t *src = avpkt->data;
  268. int buf_size = avpkt->size;
  269. PCMDecode *s = avctx->priv_data;
  270. AVFrame *frame = data;
  271. int sample_size, c, n, ret, samples_per_block;
  272. uint8_t *samples;
  273. int32_t *dst_int32_t;
  274. sample_size = av_get_bits_per_sample(avctx->codec_id) / 8;
  275. /* av_get_bits_per_sample returns 0 for AV_CODEC_ID_PCM_DVD */
  276. samples_per_block = 1;
  277. if (avctx->codec_id == AV_CODEC_ID_PCM_LXF) {
  278. /* we process 40-bit blocks per channel for LXF */
  279. samples_per_block = 2;
  280. sample_size = 5;
  281. }
  282. if (sample_size == 0) {
  283. av_log(avctx, AV_LOG_ERROR, "Invalid sample_size\n");
  284. return AVERROR(EINVAL);
  285. }
  286. if (avctx->channels == 0) {
  287. av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n");
  288. return AVERROR(EINVAL);
  289. }
  290. if (avctx->codec_id != avctx->codec->id) {
  291. av_log(avctx, AV_LOG_ERROR, "codec ids mismatch\n");
  292. return AVERROR(EINVAL);
  293. }
  294. n = avctx->channels * sample_size;
  295. if (n && buf_size % n) {
  296. if (buf_size < n) {
  297. av_log(avctx, AV_LOG_ERROR,
  298. "Invalid PCM packet, data has size %d but at least a size of %d was expected\n",
  299. buf_size, n);
  300. return AVERROR_INVALIDDATA;
  301. } else
  302. buf_size -= buf_size % n;
  303. }
  304. n = buf_size / sample_size;
  305. /* get output buffer */
  306. frame->nb_samples = n * samples_per_block / avctx->channels;
  307. if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
  308. return ret;
  309. samples = frame->data[0];
  310. switch (avctx->codec_id) {
  311. case AV_CODEC_ID_PCM_U32LE:
  312. DECODE(32, le32, src, samples, n, 0, 0x80000000)
  313. break;
  314. case AV_CODEC_ID_PCM_U32BE:
  315. DECODE(32, be32, src, samples, n, 0, 0x80000000)
  316. break;
  317. case AV_CODEC_ID_PCM_S24LE:
  318. DECODE(32, le24, src, samples, n, 8, 0)
  319. break;
  320. case AV_CODEC_ID_PCM_S24LE_PLANAR:
  321. DECODE_PLANAR(32, le24, src, samples, n, 8, 0);
  322. break;
  323. case AV_CODEC_ID_PCM_S24BE:
  324. DECODE(32, be24, src, samples, n, 8, 0)
  325. break;
  326. case AV_CODEC_ID_PCM_U24LE:
  327. DECODE(32, le24, src, samples, n, 8, 0x800000)
  328. break;
  329. case AV_CODEC_ID_PCM_U24BE:
  330. DECODE(32, be24, src, samples, n, 8, 0x800000)
  331. break;
  332. case AV_CODEC_ID_PCM_S24DAUD:
  333. for (; n > 0; n--) {
  334. uint32_t v = bytestream_get_be24(&src);
  335. v >>= 4; // sync flags are here
  336. AV_WN16A(samples, ff_reverse[(v >> 8) & 0xff] +
  337. (ff_reverse[v & 0xff] << 8));
  338. samples += 2;
  339. }
  340. break;
  341. case AV_CODEC_ID_PCM_U16LE:
  342. DECODE(16, le16, src, samples, n, 0, 0x8000)
  343. break;
  344. case AV_CODEC_ID_PCM_U16BE:
  345. DECODE(16, be16, src, samples, n, 0, 0x8000)
  346. break;
  347. case AV_CODEC_ID_PCM_S8:
  348. for (; n > 0; n--)
  349. *samples++ = *src++ + 128;
  350. break;
  351. case AV_CODEC_ID_PCM_S8_PLANAR:
  352. n /= avctx->channels;
  353. for (c = 0; c < avctx->channels; c++) {
  354. int i;
  355. samples = frame->extended_data[c];
  356. for (i = n; i > 0; i--)
  357. *samples++ = *src++ + 128;
  358. }
  359. break;
  360. #if HAVE_BIGENDIAN
  361. case AV_CODEC_ID_PCM_F64LE:
  362. DECODE(64, le64, src, samples, n, 0, 0)
  363. break;
  364. case AV_CODEC_ID_PCM_S32LE:
  365. case AV_CODEC_ID_PCM_F32LE:
  366. DECODE(32, le32, src, samples, n, 0, 0)
  367. break;
  368. case AV_CODEC_ID_PCM_S32LE_PLANAR:
  369. DECODE_PLANAR(32, le32, src, samples, n, 0, 0);
  370. break;
  371. case AV_CODEC_ID_PCM_S16LE:
  372. DECODE(16, le16, src, samples, n, 0, 0)
  373. break;
  374. case AV_CODEC_ID_PCM_S16LE_PLANAR:
  375. DECODE_PLANAR(16, le16, src, samples, n, 0, 0);
  376. break;
  377. case AV_CODEC_ID_PCM_F64BE:
  378. case AV_CODEC_ID_PCM_F32BE:
  379. case AV_CODEC_ID_PCM_S32BE:
  380. case AV_CODEC_ID_PCM_S16BE:
  381. #else
  382. case AV_CODEC_ID_PCM_F64BE:
  383. DECODE(64, be64, src, samples, n, 0, 0)
  384. break;
  385. case AV_CODEC_ID_PCM_F32BE:
  386. case AV_CODEC_ID_PCM_S32BE:
  387. DECODE(32, be32, src, samples, n, 0, 0)
  388. break;
  389. case AV_CODEC_ID_PCM_S16BE:
  390. DECODE(16, be16, src, samples, n, 0, 0)
  391. break;
  392. case AV_CODEC_ID_PCM_S16BE_PLANAR:
  393. DECODE_PLANAR(16, be16, src, samples, n, 0, 0);
  394. break;
  395. case AV_CODEC_ID_PCM_F64LE:
  396. case AV_CODEC_ID_PCM_F32LE:
  397. case AV_CODEC_ID_PCM_S32LE:
  398. case AV_CODEC_ID_PCM_S16LE:
  399. #endif /* HAVE_BIGENDIAN */
  400. case AV_CODEC_ID_PCM_U8:
  401. memcpy(samples, src, n * sample_size);
  402. break;
  403. #if HAVE_BIGENDIAN
  404. case AV_CODEC_ID_PCM_S16BE_PLANAR:
  405. #else
  406. case AV_CODEC_ID_PCM_S16LE_PLANAR:
  407. case AV_CODEC_ID_PCM_S32LE_PLANAR:
  408. #endif /* HAVE_BIGENDIAN */
  409. n /= avctx->channels;
  410. for (c = 0; c < avctx->channels; c++) {
  411. samples = frame->extended_data[c];
  412. bytestream_get_buffer(&src, samples, n * sample_size);
  413. }
  414. break;
  415. case AV_CODEC_ID_PCM_ZORK:
  416. for (; n > 0; n--) {
  417. int v = *src++;
  418. if (v < 128)
  419. v = 128 - v;
  420. *samples++ = v;
  421. }
  422. break;
  423. case AV_CODEC_ID_PCM_ALAW:
  424. case AV_CODEC_ID_PCM_MULAW:
  425. for (; n > 0; n--) {
  426. AV_WN16A(samples, s->table[*src++]);
  427. samples += 2;
  428. }
  429. break;
  430. case AV_CODEC_ID_PCM_LXF:
  431. {
  432. int i;
  433. n /= avctx->channels;
  434. for (c = 0; c < avctx->channels; c++) {
  435. dst_int32_t = (int32_t *)frame->extended_data[c];
  436. for (i = 0; i < n; i++) {
  437. // extract low 20 bits and expand to 32 bits
  438. *dst_int32_t++ = (src[2] << 28) |
  439. (src[1] << 20) |
  440. (src[0] << 12) |
  441. ((src[2] & 0x0F) << 8) |
  442. src[1];
  443. // extract high 20 bits and expand to 32 bits
  444. *dst_int32_t++ = (src[4] << 24) |
  445. (src[3] << 16) |
  446. ((src[2] & 0xF0) << 8) |
  447. (src[4] << 4) |
  448. (src[3] >> 4);
  449. src += 5;
  450. }
  451. }
  452. break;
  453. }
  454. default:
  455. return -1;
  456. }
  457. *got_frame_ptr = 1;
  458. return buf_size;
  459. }
  460. #define PCM_ENCODER_0(id_, sample_fmt_, name_, long_name_)
  461. #define PCM_ENCODER_1(id_, sample_fmt_, name_, long_name_) \
  462. AVCodec ff_ ## name_ ## _encoder = { \
  463. .name = #name_, \
  464. .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
  465. .type = AVMEDIA_TYPE_AUDIO, \
  466. .id = AV_CODEC_ID_ ## id_, \
  467. .init = pcm_encode_init, \
  468. .encode2 = pcm_encode_frame, \
  469. .capabilities = CODEC_CAP_VARIABLE_FRAME_SIZE, \
  470. .sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \
  471. AV_SAMPLE_FMT_NONE }, \
  472. }
  473. #define PCM_ENCODER_2(cf, id, sample_fmt, name, long_name) \
  474. PCM_ENCODER_ ## cf(id, sample_fmt, name, long_name)
  475. #define PCM_ENCODER_3(cf, id, sample_fmt, name, long_name) \
  476. PCM_ENCODER_2(cf, id, sample_fmt, name, long_name)
  477. #define PCM_ENCODER(id, sample_fmt, name, long_name) \
  478. PCM_ENCODER_3(CONFIG_ ## id ## _ENCODER, id, sample_fmt, name, long_name)
  479. #define PCM_DECODER_0(id, sample_fmt, name, long_name)
  480. #define PCM_DECODER_1(id_, sample_fmt_, name_, long_name_) \
  481. AVCodec ff_ ## name_ ## _decoder = { \
  482. .name = #name_, \
  483. .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
  484. .type = AVMEDIA_TYPE_AUDIO, \
  485. .id = AV_CODEC_ID_ ## id_, \
  486. .priv_data_size = sizeof(PCMDecode), \
  487. .init = pcm_decode_init, \
  488. .decode = pcm_decode_frame, \
  489. .capabilities = CODEC_CAP_DR1, \
  490. .sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \
  491. AV_SAMPLE_FMT_NONE }, \
  492. }
  493. #define PCM_DECODER_2(cf, id, sample_fmt, name, long_name) \
  494. PCM_DECODER_ ## cf(id, sample_fmt, name, long_name)
  495. #define PCM_DECODER_3(cf, id, sample_fmt, name, long_name) \
  496. PCM_DECODER_2(cf, id, sample_fmt, name, long_name)
  497. #define PCM_DECODER(id, sample_fmt, name, long_name) \
  498. PCM_DECODER_3(CONFIG_ ## id ## _DECODER, id, sample_fmt, name, long_name)
  499. #define PCM_CODEC(id, sample_fmt_, name, long_name_) \
  500. PCM_ENCODER(id, sample_fmt_, name, long_name_); \
  501. PCM_DECODER(id, sample_fmt_, name, long_name_)
  502. /* Note: Do not forget to add new entries to the Makefile as well. */
  503. PCM_CODEC (PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law / G.711 A-law");
  504. PCM_CODEC (PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian");
  505. PCM_CODEC (PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian");
  506. PCM_CODEC (PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian");
  507. PCM_CODEC (PCM_F64LE, AV_SAMPLE_FMT_DBL, pcm_f64le, "PCM 64-bit floating point little-endian");
  508. PCM_DECODER(PCM_LXF, AV_SAMPLE_FMT_S32P,pcm_lxf, "PCM signed 20-bit little-endian planar");
  509. PCM_CODEC (PCM_MULAW, AV_SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law / G.711 mu-law");
  510. PCM_CODEC (PCM_S8, AV_SAMPLE_FMT_U8, pcm_s8, "PCM signed 8-bit");
  511. PCM_CODEC (PCM_S8_PLANAR, AV_SAMPLE_FMT_U8P, pcm_s8_planar, "PCM signed 8-bit planar");
  512. PCM_CODEC (PCM_S16BE, AV_SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-endian");
  513. PCM_CODEC (PCM_S16BE_PLANAR, AV_SAMPLE_FMT_S16P,pcm_s16be_planar, "PCM signed 16-bit big-endian planar");
  514. PCM_CODEC (PCM_S16LE, AV_SAMPLE_FMT_S16, pcm_s16le, "PCM signed 16-bit little-endian");
  515. PCM_CODEC (PCM_S16LE_PLANAR, AV_SAMPLE_FMT_S16P,pcm_s16le_planar, "PCM signed 16-bit little-endian planar");
  516. PCM_CODEC (PCM_S24BE, AV_SAMPLE_FMT_S32, pcm_s24be, "PCM signed 24-bit big-endian");
  517. PCM_CODEC (PCM_S24DAUD, AV_SAMPLE_FMT_S16, pcm_s24daud, "PCM D-Cinema audio signed 24-bit");
  518. PCM_CODEC (PCM_S24LE, AV_SAMPLE_FMT_S32, pcm_s24le, "PCM signed 24-bit little-endian");
  519. PCM_CODEC (PCM_S24LE_PLANAR, AV_SAMPLE_FMT_S32P,pcm_s24le_planar, "PCM signed 24-bit little-endian planar");
  520. PCM_CODEC (PCM_S32BE, AV_SAMPLE_FMT_S32, pcm_s32be, "PCM signed 32-bit big-endian");
  521. PCM_CODEC (PCM_S32LE, AV_SAMPLE_FMT_S32, pcm_s32le, "PCM signed 32-bit little-endian");
  522. PCM_CODEC (PCM_S32LE_PLANAR, AV_SAMPLE_FMT_S32P,pcm_s32le_planar, "PCM signed 32-bit little-endian planar");
  523. PCM_CODEC (PCM_U8, AV_SAMPLE_FMT_U8, pcm_u8, "PCM unsigned 8-bit");
  524. PCM_CODEC (PCM_U16BE, AV_SAMPLE_FMT_S16, pcm_u16be, "PCM unsigned 16-bit big-endian");
  525. PCM_CODEC (PCM_U16LE, AV_SAMPLE_FMT_S16, pcm_u16le, "PCM unsigned 16-bit little-endian");
  526. PCM_CODEC (PCM_U24BE, AV_SAMPLE_FMT_S32, pcm_u24be, "PCM unsigned 24-bit big-endian");
  527. PCM_CODEC (PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian");
  528. PCM_CODEC (PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian");
  529. PCM_CODEC (PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian");
  530. PCM_DECODER(PCM_ZORK, AV_SAMPLE_FMT_U8, pcm_zork, "PCM Zork");