libavcodec/pcm.c
Go to the documentation of this file.
00001 /*
00002  * PCM codecs
00003  * Copyright (c) 2001 Fabrice Bellard
00004  *
00005  * This file is part of Libav.
00006  *
00007  * Libav is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * Libav is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with Libav; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00027 #include "avcodec.h"
00028 #include "libavutil/common.h" /* for av_reverse */
00029 #include "bytestream.h"
00030 #include "internal.h"
00031 #include "pcm_tablegen.h"
00032 
00033 #define MAX_CHANNELS 64
00034 
00035 static av_cold int pcm_encode_init(AVCodecContext *avctx)
00036 {
00037     avctx->frame_size = 0;
00038     switch(avctx->codec->id) {
00039     case CODEC_ID_PCM_ALAW:
00040         pcm_alaw_tableinit();
00041         break;
00042     case CODEC_ID_PCM_MULAW:
00043         pcm_ulaw_tableinit();
00044         break;
00045     default:
00046         break;
00047     }
00048 
00049     avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
00050     avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8;
00051     avctx->coded_frame= avcodec_alloc_frame();
00052     avctx->coded_frame->key_frame= 1;
00053 
00054     return 0;
00055 }
00056 
00057 static av_cold int pcm_encode_close(AVCodecContext *avctx)
00058 {
00059     av_freep(&avctx->coded_frame);
00060 
00061     return 0;
00062 }
00063 
00074 #define ENCODE(type, endian, src, dst, n, shift, offset) \
00075     samples_##type = (const type*) src; \
00076     for(;n>0;n--) { \
00077         register type v = (*samples_##type++ >> shift) + offset; \
00078         bytestream_put_##endian(&dst, v); \
00079     }
00080 
00081 static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
00082                             const AVFrame *frame, int *got_packet_ptr)
00083 {
00084     int n, sample_size, v, ret;
00085     const short *samples;
00086     unsigned char *dst;
00087     const uint8_t *srcu8;
00088     const int16_t *samples_int16_t;
00089     const int32_t *samples_int32_t;
00090     const int64_t *samples_int64_t;
00091     const uint16_t *samples_uint16_t;
00092     const uint32_t *samples_uint32_t;
00093 
00094     sample_size = av_get_bits_per_sample(avctx->codec->id)/8;
00095     n           = frame->nb_samples * avctx->channels;
00096     samples     = (const short *)frame->data[0];
00097 
00098     if ((ret = ff_alloc_packet(avpkt, n * sample_size))) {
00099         av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
00100         return ret;
00101     }
00102     dst = avpkt->data;
00103 
00104     switch(avctx->codec->id) {
00105     case CODEC_ID_PCM_U32LE:
00106         ENCODE(uint32_t, le32, samples, dst, n, 0, 0x80000000)
00107         break;
00108     case CODEC_ID_PCM_U32BE:
00109         ENCODE(uint32_t, be32, samples, dst, n, 0, 0x80000000)
00110         break;
00111     case CODEC_ID_PCM_S24LE:
00112         ENCODE(int32_t, le24, samples, dst, n, 8, 0)
00113         break;
00114     case CODEC_ID_PCM_S24BE:
00115         ENCODE(int32_t, be24, samples, dst, n, 8, 0)
00116         break;
00117     case CODEC_ID_PCM_U24LE:
00118         ENCODE(uint32_t, le24, samples, dst, n, 8, 0x800000)
00119         break;
00120     case CODEC_ID_PCM_U24BE:
00121         ENCODE(uint32_t, be24, samples, dst, n, 8, 0x800000)
00122         break;
00123     case CODEC_ID_PCM_S24DAUD:
00124         for(;n>0;n--) {
00125             uint32_t tmp = av_reverse[(*samples >> 8) & 0xff] +
00126                            (av_reverse[*samples & 0xff] << 8);
00127             tmp <<= 4; // sync flags would go here
00128             bytestream_put_be24(&dst, tmp);
00129             samples++;
00130         }
00131         break;
00132     case CODEC_ID_PCM_U16LE:
00133         ENCODE(uint16_t, le16, samples, dst, n, 0, 0x8000)
00134         break;
00135     case CODEC_ID_PCM_U16BE:
00136         ENCODE(uint16_t, be16, samples, dst, n, 0, 0x8000)
00137         break;
00138     case CODEC_ID_PCM_S8:
00139         srcu8 = frame->data[0];
00140         for(;n>0;n--) {
00141             v = *srcu8++;
00142             *dst++ = v - 128;
00143         }
00144         break;
00145 #if HAVE_BIGENDIAN
00146     case CODEC_ID_PCM_F64LE:
00147         ENCODE(int64_t, le64, samples, dst, n, 0, 0)
00148         break;
00149     case CODEC_ID_PCM_S32LE:
00150     case CODEC_ID_PCM_F32LE:
00151         ENCODE(int32_t, le32, samples, dst, n, 0, 0)
00152         break;
00153     case CODEC_ID_PCM_S16LE:
00154         ENCODE(int16_t, le16, samples, dst, n, 0, 0)
00155         break;
00156     case CODEC_ID_PCM_F64BE:
00157     case CODEC_ID_PCM_F32BE:
00158     case CODEC_ID_PCM_S32BE:
00159     case CODEC_ID_PCM_S16BE:
00160 #else
00161     case CODEC_ID_PCM_F64BE:
00162         ENCODE(int64_t, be64, samples, dst, n, 0, 0)
00163         break;
00164     case CODEC_ID_PCM_F32BE:
00165     case CODEC_ID_PCM_S32BE:
00166         ENCODE(int32_t, be32, samples, dst, n, 0, 0)
00167         break;
00168     case CODEC_ID_PCM_S16BE:
00169         ENCODE(int16_t, be16, samples, dst, n, 0, 0)
00170         break;
00171     case CODEC_ID_PCM_F64LE:
00172     case CODEC_ID_PCM_F32LE:
00173     case CODEC_ID_PCM_S32LE:
00174     case CODEC_ID_PCM_S16LE:
00175 #endif /* HAVE_BIGENDIAN */
00176     case CODEC_ID_PCM_U8:
00177         memcpy(dst, samples, n*sample_size);
00178         dst += n*sample_size;
00179         break;
00180     case CODEC_ID_PCM_ALAW:
00181         for(;n>0;n--) {
00182             v = *samples++;
00183             *dst++ = linear_to_alaw[(v + 32768) >> 2];
00184         }
00185         break;
00186     case CODEC_ID_PCM_MULAW:
00187         for(;n>0;n--) {
00188             v = *samples++;
00189             *dst++ = linear_to_ulaw[(v + 32768) >> 2];
00190         }
00191         break;
00192     default:
00193         return -1;
00194     }
00195 
00196     avpkt->size = frame->nb_samples * avctx->channels * sample_size;
00197     *got_packet_ptr = 1;
00198     return 0;
00199 }
00200 
00201 typedef struct PCMDecode {
00202     AVFrame frame;
00203     short table[256];
00204 } PCMDecode;
00205 
00206 static av_cold int pcm_decode_init(AVCodecContext * avctx)
00207 {
00208     PCMDecode *s = avctx->priv_data;
00209     int i;
00210 
00211     if (avctx->channels <= 0 || avctx->channels > MAX_CHANNELS) {
00212         av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n");
00213         return AVERROR(EINVAL);
00214     }
00215 
00216     switch(avctx->codec->id) {
00217     case CODEC_ID_PCM_ALAW:
00218         for(i=0;i<256;i++)
00219             s->table[i] = alaw2linear(i);
00220         break;
00221     case CODEC_ID_PCM_MULAW:
00222         for(i=0;i<256;i++)
00223             s->table[i] = ulaw2linear(i);
00224         break;
00225     default:
00226         break;
00227     }
00228 
00229     avctx->sample_fmt = avctx->codec->sample_fmts[0];
00230 
00231     if (avctx->sample_fmt == AV_SAMPLE_FMT_S32)
00232         avctx->bits_per_raw_sample = av_get_bits_per_sample(avctx->codec->id);
00233 
00234     avcodec_get_frame_defaults(&s->frame);
00235     avctx->coded_frame = &s->frame;
00236 
00237     return 0;
00238 }
00239 
00250 #define DECODE(size, endian, src, dst, n, shift, offset) \
00251     for(;n>0;n--) { \
00252         uint##size##_t v = bytestream_get_##endian(&src); \
00253         AV_WN##size##A(dst, (v - offset) << shift); \
00254         dst += size / 8; \
00255     }
00256 
00257 static int pcm_decode_frame(AVCodecContext *avctx, void *data,
00258                             int *got_frame_ptr, AVPacket *avpkt)
00259 {
00260     const uint8_t *src = avpkt->data;
00261     int buf_size = avpkt->size;
00262     PCMDecode *s = avctx->priv_data;
00263     int sample_size, c, n, ret, samples_per_block;
00264     uint8_t *samples;
00265     int32_t *dst_int32_t;
00266 
00267     sample_size = av_get_bits_per_sample(avctx->codec_id)/8;
00268 
00269     /* av_get_bits_per_sample returns 0 for CODEC_ID_PCM_DVD */
00270     samples_per_block = 1;
00271     if (avctx->codec->id == CODEC_ID_PCM_DVD) {
00272         if (avctx->bits_per_coded_sample != 20 &&
00273             avctx->bits_per_coded_sample != 24) {
00274             av_log(avctx, AV_LOG_ERROR, "PCM DVD unsupported sample depth\n");
00275             return AVERROR(EINVAL);
00276         }
00277         /* 2 samples are interleaved per block in PCM_DVD */
00278         samples_per_block = 2;
00279         sample_size = avctx->bits_per_coded_sample * 2 / 8;
00280     } else if (avctx->codec_id == CODEC_ID_PCM_LXF) {
00281         /* we process 40-bit blocks per channel for LXF */
00282         samples_per_block = 2;
00283         sample_size = 5;
00284     }
00285 
00286     if (sample_size == 0) {
00287         av_log(avctx, AV_LOG_ERROR, "Invalid sample_size\n");
00288         return AVERROR(EINVAL);
00289     }
00290 
00291     n = avctx->channels * sample_size;
00292 
00293     if(n && buf_size % n){
00294         if (buf_size < n) {
00295             av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");
00296             return -1;
00297         }else
00298             buf_size -= buf_size % n;
00299     }
00300 
00301     n = buf_size/sample_size;
00302 
00303     /* get output buffer */
00304     s->frame.nb_samples = n * samples_per_block / avctx->channels;
00305     if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
00306         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
00307         return ret;
00308     }
00309     samples = s->frame.data[0];
00310 
00311     switch(avctx->codec->id) {
00312     case CODEC_ID_PCM_U32LE:
00313         DECODE(32, le32, src, samples, n, 0, 0x80000000)
00314         break;
00315     case CODEC_ID_PCM_U32BE:
00316         DECODE(32, be32, src, samples, n, 0, 0x80000000)
00317         break;
00318     case CODEC_ID_PCM_S24LE:
00319         DECODE(32, le24, src, samples, n, 8, 0)
00320         break;
00321     case CODEC_ID_PCM_S24BE:
00322         DECODE(32, be24, src, samples, n, 8, 0)
00323         break;
00324     case CODEC_ID_PCM_U24LE:
00325         DECODE(32, le24, src, samples, n, 8, 0x800000)
00326         break;
00327     case CODEC_ID_PCM_U24BE:
00328         DECODE(32, be24, src, samples, n, 8, 0x800000)
00329         break;
00330     case CODEC_ID_PCM_S24DAUD:
00331         for(;n>0;n--) {
00332           uint32_t v = bytestream_get_be24(&src);
00333           v >>= 4; // sync flags are here
00334           AV_WN16A(samples, av_reverse[(v >> 8) & 0xff] +
00335                            (av_reverse[v & 0xff] << 8));
00336           samples += 2;
00337         }
00338         break;
00339     case CODEC_ID_PCM_S16LE_PLANAR:
00340     {
00341         const uint8_t *src2[MAX_CHANNELS];
00342         n /= avctx->channels;
00343         for(c=0;c<avctx->channels;c++)
00344             src2[c] = &src[c*n*2];
00345         for(;n>0;n--)
00346             for(c=0;c<avctx->channels;c++) {
00347                 AV_WN16A(samples, bytestream_get_le16(&src2[c]));
00348                 samples += 2;
00349             }
00350         break;
00351     }
00352     case CODEC_ID_PCM_U16LE:
00353         DECODE(16, le16, src, samples, n, 0, 0x8000)
00354         break;
00355     case CODEC_ID_PCM_U16BE:
00356         DECODE(16, be16, src, samples, n, 0, 0x8000)
00357         break;
00358     case CODEC_ID_PCM_S8:
00359         for(;n>0;n--) {
00360             *samples++ = *src++ + 128;
00361         }
00362         break;
00363 #if HAVE_BIGENDIAN
00364     case CODEC_ID_PCM_F64LE:
00365         DECODE(64, le64, src, samples, n, 0, 0)
00366         break;
00367     case CODEC_ID_PCM_S32LE:
00368     case CODEC_ID_PCM_F32LE:
00369         DECODE(32, le32, src, samples, n, 0, 0)
00370         break;
00371     case CODEC_ID_PCM_S16LE:
00372         DECODE(16, le16, src, samples, n, 0, 0)
00373         break;
00374     case CODEC_ID_PCM_F64BE:
00375     case CODEC_ID_PCM_F32BE:
00376     case CODEC_ID_PCM_S32BE:
00377     case CODEC_ID_PCM_S16BE:
00378 #else
00379     case CODEC_ID_PCM_F64BE:
00380         DECODE(64, be64, src, samples, n, 0, 0)
00381         break;
00382     case CODEC_ID_PCM_F32BE:
00383     case CODEC_ID_PCM_S32BE:
00384         DECODE(32, be32, src, samples, n, 0, 0)
00385         break;
00386     case CODEC_ID_PCM_S16BE:
00387         DECODE(16, be16, src, samples, n, 0, 0)
00388         break;
00389     case CODEC_ID_PCM_F64LE:
00390     case CODEC_ID_PCM_F32LE:
00391     case CODEC_ID_PCM_S32LE:
00392     case CODEC_ID_PCM_S16LE:
00393 #endif /* HAVE_BIGENDIAN */
00394     case CODEC_ID_PCM_U8:
00395         memcpy(samples, src, n*sample_size);
00396         break;
00397     case CODEC_ID_PCM_ZORK:
00398         for (; n > 0; n--) {
00399             int v = *src++;
00400             if (v < 128)
00401                 v = 128 - v;
00402             *samples++ = v;
00403         }
00404         break;
00405     case CODEC_ID_PCM_ALAW:
00406     case CODEC_ID_PCM_MULAW:
00407         for(;n>0;n--) {
00408             AV_WN16A(samples, s->table[*src++]);
00409             samples += 2;
00410         }
00411         break;
00412     case CODEC_ID_PCM_DVD:
00413     {
00414         const uint8_t *src8;
00415         dst_int32_t = (int32_t *)s->frame.data[0];
00416         n /= avctx->channels;
00417         switch (avctx->bits_per_coded_sample) {
00418         case 20:
00419             while (n--) {
00420                 c = avctx->channels;
00421                 src8 = src + 4*c;
00422                 while (c--) {
00423                     *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8   &0xf0) << 8);
00424                     *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++ &0x0f) << 12);
00425                 }
00426                 src = src8;
00427             }
00428             break;
00429         case 24:
00430             while (n--) {
00431                 c = avctx->channels;
00432                 src8 = src + 4*c;
00433                 while (c--) {
00434                     *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8);
00435                     *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8);
00436                 }
00437                 src = src8;
00438             }
00439             break;
00440         }
00441         break;
00442     }
00443     case CODEC_ID_PCM_LXF:
00444     {
00445         int i;
00446         const uint8_t *src8;
00447         dst_int32_t = (int32_t *)s->frame.data[0];
00448         n /= avctx->channels;
00449         //unpack and de-planerize
00450         for (i = 0; i < n; i++) {
00451             for (c = 0, src8 = src + i*5; c < avctx->channels; c++, src8 += n*5) {
00452                 //extract low 20 bits and expand to 32 bits
00453                 *dst_int32_t++ = (src8[2] << 28) | (src8[1] << 20) | (src8[0] << 12) |
00454                                  ((src8[2] & 0xF) << 8) | src8[1];
00455             }
00456 
00457             for (c = 0, src8 = src + i*5; c < avctx->channels; c++, src8 += n*5) {
00458                 //extract high 20 bits and expand to 32 bits
00459                 *dst_int32_t++ = (src8[4] << 24) | (src8[3] << 16) |
00460                                  ((src8[2] & 0xF0) << 8) | (src8[4] << 4) | (src8[3] >> 4);
00461             }
00462         }
00463         break;
00464     }
00465     default:
00466         return -1;
00467     }
00468 
00469     *got_frame_ptr   = 1;
00470     *(AVFrame *)data = s->frame;
00471 
00472     return buf_size;
00473 }
00474 
00475 #if CONFIG_ENCODERS
00476 #define PCM_ENCODER(id_,sample_fmt_,name_,long_name_) \
00477 AVCodec ff_ ## name_ ## _encoder = {            \
00478     .name        = #name_,                      \
00479     .type        = AVMEDIA_TYPE_AUDIO,          \
00480     .id          = id_,                         \
00481     .init        = pcm_encode_init,             \
00482     .encode2     = pcm_encode_frame,            \
00483     .close       = pcm_encode_close,            \
00484     .capabilities = CODEC_CAP_VARIABLE_FRAME_SIZE, \
00485     .sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \
00486     .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
00487 }
00488 #else
00489 #define PCM_ENCODER(id,sample_fmt_,name,long_name_)
00490 #endif
00491 
00492 #if CONFIG_DECODERS
00493 #define PCM_DECODER(id_,sample_fmt_,name_,long_name_)         \
00494 AVCodec ff_ ## name_ ## _decoder = {            \
00495     .name           = #name_,                   \
00496     .type           = AVMEDIA_TYPE_AUDIO,       \
00497     .id             = id_,                      \
00498     .priv_data_size = sizeof(PCMDecode),        \
00499     .init           = pcm_decode_init,          \
00500     .decode         = pcm_decode_frame,         \
00501     .capabilities   = CODEC_CAP_DR1,            \
00502     .sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \
00503     .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
00504 }
00505 #else
00506 #define PCM_DECODER(id,sample_fmt_,name,long_name_)
00507 #endif
00508 
00509 #define PCM_CODEC(id, sample_fmt_, name, long_name_)         \
00510     PCM_ENCODER(id,sample_fmt_,name,long_name_); PCM_DECODER(id,sample_fmt_,name,long_name_)
00511 
00512 /* Note: Do not forget to add new entries to the Makefile as well. */
00513 PCM_CODEC  (CODEC_ID_PCM_ALAW,  AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law");
00514 PCM_DECODER(CODEC_ID_PCM_DVD,   AV_SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian");
00515 PCM_CODEC  (CODEC_ID_PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian");
00516 PCM_CODEC  (CODEC_ID_PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian");
00517 PCM_CODEC  (CODEC_ID_PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian");
00518 PCM_CODEC  (CODEC_ID_PCM_F64LE, AV_SAMPLE_FMT_DBL, pcm_f64le, "PCM 64-bit floating point little-endian");
00519 PCM_DECODER(CODEC_ID_PCM_LXF,   AV_SAMPLE_FMT_S32, pcm_lxf, "PCM signed 20-bit little-endian planar");
00520 PCM_CODEC  (CODEC_ID_PCM_MULAW, AV_SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law");
00521 PCM_CODEC  (CODEC_ID_PCM_S8,    AV_SAMPLE_FMT_U8,  pcm_s8, "PCM signed 8-bit");
00522 PCM_CODEC  (CODEC_ID_PCM_S16BE, AV_SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-endian");
00523 PCM_CODEC  (CODEC_ID_PCM_S16LE, AV_SAMPLE_FMT_S16, pcm_s16le, "PCM signed 16-bit little-endian");
00524 PCM_DECODER(CODEC_ID_PCM_S16LE_PLANAR, AV_SAMPLE_FMT_S16, pcm_s16le_planar, "PCM 16-bit little-endian planar");
00525 PCM_CODEC  (CODEC_ID_PCM_S24BE, AV_SAMPLE_FMT_S32, pcm_s24be, "PCM signed 24-bit big-endian");
00526 PCM_CODEC  (CODEC_ID_PCM_S24DAUD, AV_SAMPLE_FMT_S16,  pcm_s24daud, "PCM D-Cinema audio signed 24-bit");
00527 PCM_CODEC  (CODEC_ID_PCM_S24LE, AV_SAMPLE_FMT_S32, pcm_s24le, "PCM signed 24-bit little-endian");
00528 PCM_CODEC  (CODEC_ID_PCM_S32BE, AV_SAMPLE_FMT_S32, pcm_s32be, "PCM signed 32-bit big-endian");
00529 PCM_CODEC  (CODEC_ID_PCM_S32LE, AV_SAMPLE_FMT_S32, pcm_s32le, "PCM signed 32-bit little-endian");
00530 PCM_CODEC  (CODEC_ID_PCM_U8,    AV_SAMPLE_FMT_U8,  pcm_u8, "PCM unsigned 8-bit");
00531 PCM_CODEC  (CODEC_ID_PCM_U16BE, AV_SAMPLE_FMT_S16, pcm_u16be, "PCM unsigned 16-bit big-endian");
00532 PCM_CODEC  (CODEC_ID_PCM_U16LE, AV_SAMPLE_FMT_S16, pcm_u16le, "PCM unsigned 16-bit little-endian");
00533 PCM_CODEC  (CODEC_ID_PCM_U24BE, AV_SAMPLE_FMT_S32, pcm_u24be, "PCM unsigned 24-bit big-endian");
00534 PCM_CODEC  (CODEC_ID_PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian");
00535 PCM_CODEC  (CODEC_ID_PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian");
00536 PCM_CODEC  (CODEC_ID_PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian");
00537 PCM_DECODER(CODEC_ID_PCM_ZORK,  AV_SAMPLE_FMT_U8,  pcm_zork,  "PCM Zork");