]> git.sesse.net Git - ffmpeg/blob - libavcodec/pcm.c
(cosmetics) Align comments consistently.
[ffmpeg] / libavcodec / pcm.c
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 /**
23  * @file pcm.c
24  * PCM codecs
25  */
26
27 #include "avcodec.h"
28 #include "bitstream.h" // for ff_reverse
29 #include "bytestream.h"
30
31 #define MAX_CHANNELS 64
32
33 /* from g711.c by SUN microsystems (unrestricted use) */
34
35 #define         SIGN_BIT        (0x80)      /* Sign bit for a A-law byte. */
36 #define         QUANT_MASK      (0xf)       /* Quantization field mask. */
37 #define         NSEGS           (8)         /* Number of A-law segments. */
38 #define         SEG_SHIFT       (4)         /* Left shift for segment number. */
39 #define         SEG_MASK        (0x70)      /* Segment field mask. */
40
41 #define         BIAS            (0x84)      /* Bias for linear code. */
42
43 /*
44  * alaw2linear() - Convert an A-law value to 16-bit linear PCM
45  *
46  */
47 static av_cold int alaw2linear(unsigned char a_val)
48 {
49         int t;
50         int seg;
51
52         a_val ^= 0x55;
53
54         t = a_val & QUANT_MASK;
55         seg = ((unsigned)a_val & SEG_MASK) >> SEG_SHIFT;
56         if(seg) t= (t + t + 1 + 32) << (seg + 2);
57         else    t= (t + t + 1     ) << 3;
58
59         return (a_val & SIGN_BIT) ? t : -t;
60 }
61
62 static av_cold int ulaw2linear(unsigned char u_val)
63 {
64         int t;
65
66         /* Complement to obtain normal u-law value. */
67         u_val = ~u_val;
68
69         /*
70          * Extract and bias the quantization bits. Then
71          * shift up by the segment number and subtract out the bias.
72          */
73         t = ((u_val & QUANT_MASK) << 3) + BIAS;
74         t <<= ((unsigned)u_val & SEG_MASK) >> SEG_SHIFT;
75
76         return (u_val & SIGN_BIT) ? (BIAS - t) : (t - BIAS);
77 }
78
79 /* 16384 entries per table */
80 static uint8_t linear_to_alaw[16384];
81 static uint8_t linear_to_ulaw[16384];
82
83 static av_cold void build_xlaw_table(uint8_t *linear_to_xlaw,
84                              int (*xlaw2linear)(unsigned char),
85                              int mask)
86 {
87     int i, j, v, v1, v2;
88
89     j = 0;
90     for(i=0;i<128;i++) {
91         if (i != 127) {
92             v1 = xlaw2linear(i ^ mask);
93             v2 = xlaw2linear((i + 1) ^ mask);
94             v = (v1 + v2 + 4) >> 3;
95         } else {
96             v = 8192;
97         }
98         for(;j<v;j++) {
99             linear_to_xlaw[8192 + j] = (i ^ mask);
100             if (j > 0)
101                 linear_to_xlaw[8192 - j] = (i ^ (mask ^ 0x80));
102         }
103     }
104     linear_to_xlaw[0] = linear_to_xlaw[1];
105 }
106
107 static av_cold int pcm_encode_init(AVCodecContext *avctx)
108 {
109     avctx->frame_size = 1;
110     switch(avctx->codec->id) {
111     case CODEC_ID_PCM_ALAW:
112         build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5);
113         break;
114     case CODEC_ID_PCM_MULAW:
115         build_xlaw_table(linear_to_ulaw, ulaw2linear, 0xff);
116         break;
117     default:
118         break;
119     }
120
121     avctx->block_align = avctx->channels * av_get_bits_per_sample(avctx->codec->id)/8;
122     avctx->coded_frame= avcodec_alloc_frame();
123     avctx->coded_frame->key_frame= 1;
124
125     return 0;
126 }
127
128 static av_cold int pcm_encode_close(AVCodecContext *avctx)
129 {
130     av_freep(&avctx->coded_frame);
131
132     return 0;
133 }
134
135 /**
136  * Write PCM samples macro
137  * @param type Datatype of native machine format
138  * @param endian bytestream_put_xxx() suffix
139  * @param src Source pointer (variable name)
140  * @param dst Destination pointer (variable name)
141  * @param n Total number of samples (variable name)
142  * @param shift Bitshift (bits)
143  * @param offset Sample value offset
144  */
145 #define ENCODE(type, endian, src, dst, n, shift, offset) \
146     samples_##type = (type*)src; \
147     for(;n>0;n--) { \
148         register type v = (*samples_##type++ >> shift) + offset; \
149         bytestream_put_##endian(&dst, v); \
150     }
151
152 static int pcm_encode_frame(AVCodecContext *avctx,
153                             unsigned char *frame, int buf_size, void *data)
154 {
155     int n, sample_size, v;
156     short *samples;
157     unsigned char *dst;
158     uint8_t *srcu8;
159     int16_t *samples_int16_t;
160     int32_t *samples_int32_t;
161     int64_t *samples_int64_t;
162     uint16_t *samples_uint16_t;
163     uint32_t *samples_uint32_t;
164
165     sample_size = av_get_bits_per_sample(avctx->codec->id)/8;
166     n = buf_size / sample_size;
167     samples = data;
168     dst = frame;
169
170     if (avctx->sample_fmt!=avctx->codec->sample_fmts[0]) {
171         av_log(avctx, AV_LOG_ERROR, "invalid sample_fmt\n");
172         return -1;
173     }
174
175     switch(avctx->codec->id) {
176     case CODEC_ID_PCM_U32LE:
177         ENCODE(uint32_t, le32, samples, dst, n, 0, 0x80000000)
178         break;
179     case CODEC_ID_PCM_U32BE:
180         ENCODE(uint32_t, be32, samples, dst, n, 0, 0x80000000)
181         break;
182     case CODEC_ID_PCM_S24LE:
183         ENCODE(int32_t, le24, samples, dst, n, 8, 0)
184         break;
185     case CODEC_ID_PCM_S24BE:
186         ENCODE(int32_t, be24, samples, dst, n, 8, 0)
187         break;
188     case CODEC_ID_PCM_U24LE:
189         ENCODE(uint32_t, le24, samples, dst, n, 8, 0x800000)
190         break;
191     case CODEC_ID_PCM_U24BE:
192         ENCODE(uint32_t, be24, samples, dst, n, 8, 0x800000)
193         break;
194     case CODEC_ID_PCM_S24DAUD:
195         for(;n>0;n--) {
196             uint32_t tmp = ff_reverse[(*samples >> 8) & 0xff] +
197                            (ff_reverse[*samples & 0xff] << 8);
198             tmp <<= 4; // sync flags would go here
199             bytestream_put_be24(&dst, tmp);
200             samples++;
201         }
202         break;
203     case CODEC_ID_PCM_U16LE:
204         ENCODE(uint16_t, le16, samples, dst, n, 0, 0x8000)
205         break;
206     case CODEC_ID_PCM_U16BE:
207         ENCODE(uint16_t, be16, samples, dst, n, 0, 0x8000)
208         break;
209     case CODEC_ID_PCM_S8:
210         srcu8= data;
211         for(;n>0;n--) {
212             v = *srcu8++;
213             *dst++ = v - 128;
214         }
215         break;
216 #if WORDS_BIGENDIAN
217     case CODEC_ID_PCM_F64LE:
218         ENCODE(int64_t, le64, samples, dst, n, 0, 0)
219         break;
220     case CODEC_ID_PCM_S32LE:
221     case CODEC_ID_PCM_F32LE:
222         ENCODE(int32_t, le32, samples, dst, n, 0, 0)
223         break;
224     case CODEC_ID_PCM_S16LE:
225         ENCODE(int16_t, le16, samples, dst, n, 0, 0)
226         break;
227     case CODEC_ID_PCM_F64BE:
228     case CODEC_ID_PCM_F32BE:
229     case CODEC_ID_PCM_S32BE:
230     case CODEC_ID_PCM_S16BE:
231 #else
232     case CODEC_ID_PCM_F64BE:
233         ENCODE(int64_t, be64, samples, dst, n, 0, 0)
234         break;
235     case CODEC_ID_PCM_F32BE:
236     case CODEC_ID_PCM_S32BE:
237         ENCODE(int32_t, be32, samples, dst, n, 0, 0)
238         break;
239     case CODEC_ID_PCM_S16BE:
240         ENCODE(int16_t, be16, samples, dst, n, 0, 0)
241         break;
242     case CODEC_ID_PCM_F64LE:
243     case CODEC_ID_PCM_F32LE:
244     case CODEC_ID_PCM_S32LE:
245     case CODEC_ID_PCM_S16LE:
246 #endif /* WORDS_BIGENDIAN */
247     case CODEC_ID_PCM_U8:
248         memcpy(dst, samples, n*sample_size);
249         dst += n*sample_size;
250         break;
251     case CODEC_ID_PCM_ZORK:
252         for(;n>0;n--) {
253             v= *samples++ >> 8;
254             if(v<0)   v = -v;
255             else      v+= 128;
256             *dst++ = v;
257         }
258         break;
259     case CODEC_ID_PCM_ALAW:
260         for(;n>0;n--) {
261             v = *samples++;
262             *dst++ = linear_to_alaw[(v + 32768) >> 2];
263         }
264         break;
265     case CODEC_ID_PCM_MULAW:
266         for(;n>0;n--) {
267             v = *samples++;
268             *dst++ = linear_to_ulaw[(v + 32768) >> 2];
269         }
270         break;
271     default:
272         return -1;
273     }
274     //avctx->frame_size = (dst - frame) / (sample_size * avctx->channels);
275
276     return dst - frame;
277 }
278
279 typedef struct PCMDecode {
280     short table[256];
281 } PCMDecode;
282
283 static av_cold int pcm_decode_init(AVCodecContext * avctx)
284 {
285     PCMDecode *s = avctx->priv_data;
286     int i;
287
288     switch(avctx->codec->id) {
289     case CODEC_ID_PCM_ALAW:
290         for(i=0;i<256;i++)
291             s->table[i] = alaw2linear(i);
292         break;
293     case CODEC_ID_PCM_MULAW:
294         for(i=0;i<256;i++)
295             s->table[i] = ulaw2linear(i);
296         break;
297     default:
298         break;
299     }
300
301     avctx->sample_fmt = avctx->codec->sample_fmts[0];
302     return 0;
303 }
304
305 /**
306  * Read PCM samples macro
307  * @param type Datatype of native machine format
308  * @param endian bytestream_get_xxx() endian suffix
309  * @param src Source pointer (variable name)
310  * @param dst Destination pointer (variable name)
311  * @param n Total number of samples (variable name)
312  * @param shift Bitshift (bits)
313  * @param offset Sample value offset
314  */
315 #define DECODE(type, endian, src, dst, n, shift, offset) \
316     dst_##type = (type*)dst; \
317     for(;n>0;n--) { \
318         register type v = bytestream_get_##endian(&src); \
319         *dst_##type++ = (v - offset) << shift; \
320     } \
321     dst = (short*)dst_##type;
322
323 static int pcm_decode_frame(AVCodecContext *avctx,
324                             void *data, int *data_size,
325                             const uint8_t *buf, int buf_size)
326 {
327     PCMDecode *s = avctx->priv_data;
328     int sample_size, c, n;
329     short *samples;
330     const uint8_t *src, *src8, *src2[MAX_CHANNELS];
331     uint8_t *dstu8;
332     int16_t *dst_int16_t;
333     int32_t *dst_int32_t;
334     int64_t *dst_int64_t;
335     uint16_t *dst_uint16_t;
336     uint32_t *dst_uint32_t;
337
338     samples = data;
339     src = buf;
340
341     if (avctx->sample_fmt!=avctx->codec->sample_fmts[0]) {
342         av_log(avctx, AV_LOG_ERROR, "invalid sample_fmt\n");
343         return -1;
344     }
345
346     if(avctx->channels <= 0 || avctx->channels > MAX_CHANNELS){
347         av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n");
348         return -1;
349     }
350
351     sample_size = av_get_bits_per_sample(avctx->codec_id)/8;
352
353     /* av_get_bits_per_sample returns 0 for CODEC_ID_PCM_DVD */
354     if (CODEC_ID_PCM_DVD == avctx->codec_id)
355         /* 2 samples are interleaved per block in PCM_DVD */
356         sample_size = avctx->bits_per_sample * 2 / 8;
357
358     n = avctx->channels * sample_size;
359
360     if(n && buf_size % n){
361         av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");
362         return -1;
363     }
364
365     buf_size= FFMIN(buf_size, *data_size/2);
366     *data_size=0;
367
368     n = buf_size/sample_size;
369
370     switch(avctx->codec->id) {
371     case CODEC_ID_PCM_U32LE:
372         DECODE(uint32_t, le32, src, samples, n, 0, 0x80000000)
373         break;
374     case CODEC_ID_PCM_U32BE:
375         DECODE(uint32_t, be32, src, samples, n, 0, 0x80000000)
376         break;
377     case CODEC_ID_PCM_S24LE:
378         DECODE(int32_t, le24, src, samples, n, 8, 0)
379         break;
380     case CODEC_ID_PCM_S24BE:
381         DECODE(int32_t, be24, src, samples, n, 8, 0)
382         break;
383     case CODEC_ID_PCM_U24LE:
384         DECODE(uint32_t, le24, src, samples, n, 8, 0x800000)
385         break;
386     case CODEC_ID_PCM_U24BE:
387         DECODE(uint32_t, be24, src, samples, n, 8, 0x800000)
388         break;
389     case CODEC_ID_PCM_S24DAUD:
390         for(;n>0;n--) {
391           uint32_t v = bytestream_get_be24(&src);
392           v >>= 4; // sync flags are here
393           *samples++ = ff_reverse[(v >> 8) & 0xff] +
394                        (ff_reverse[v & 0xff] << 8);
395         }
396         break;
397     case CODEC_ID_PCM_S16LE_PLANAR:
398         n /= avctx->channels;
399         for(c=0;c<avctx->channels;c++)
400             src2[c] = &src[c*n*2];
401         for(;n>0;n--)
402             for(c=0;c<avctx->channels;c++)
403                 *samples++ = bytestream_get_le16(&src2[c]);
404         src = src2[avctx->channels-1];
405         break;
406     case CODEC_ID_PCM_U16LE:
407         DECODE(uint16_t, le16, src, samples, n, 0, 0x8000)
408         break;
409     case CODEC_ID_PCM_U16BE:
410         DECODE(uint16_t, be16, src, samples, n, 0, 0x8000)
411         break;
412     case CODEC_ID_PCM_S8:
413         dstu8= (uint8_t*)samples;
414         for(;n>0;n--) {
415             *dstu8++ = *src++ + 128;
416         }
417         samples= (short*)dstu8;
418         break;
419 #if WORDS_BIGENDIAN
420     case CODEC_ID_PCM_F64LE:
421         DECODE(int64_t, le64, src, samples, n, 0, 0)
422         break;
423     case CODEC_ID_PCM_S32LE:
424     case CODEC_ID_PCM_F32LE:
425         DECODE(int32_t, le32, src, samples, n, 0, 0)
426         break;
427     case CODEC_ID_PCM_S16LE:
428         DECODE(int16_t, le16, src, samples, n, 0, 0)
429         break;
430     case CODEC_ID_PCM_F64BE:
431     case CODEC_ID_PCM_F32BE:
432     case CODEC_ID_PCM_S32BE:
433     case CODEC_ID_PCM_S16BE:
434 #else
435     case CODEC_ID_PCM_F64BE:
436         DECODE(int64_t, be64, src, samples, n, 0, 0)
437         break;
438     case CODEC_ID_PCM_F32BE:
439     case CODEC_ID_PCM_S32BE:
440         DECODE(int32_t, be32, src, samples, n, 0, 0)
441         break;
442     case CODEC_ID_PCM_S16BE:
443         DECODE(int16_t, be16, src, samples, n, 0, 0)
444         break;
445     case CODEC_ID_PCM_F64LE:
446     case CODEC_ID_PCM_F32LE:
447     case CODEC_ID_PCM_S32LE:
448     case CODEC_ID_PCM_S16LE:
449 #endif /* WORDS_BIGENDIAN */
450     case CODEC_ID_PCM_U8:
451         memcpy(samples, src, n*sample_size);
452         src += n*sample_size;
453         samples = (short*)((uint8_t*)data + n*sample_size);
454         break;
455     case CODEC_ID_PCM_ZORK:
456         for(;n>0;n--) {
457             int x= *src++;
458             if(x&128) x-= 128;
459             else      x = -x;
460             *samples++ = x << 8;
461         }
462         break;
463     case CODEC_ID_PCM_ALAW:
464     case CODEC_ID_PCM_MULAW:
465         for(;n>0;n--) {
466             *samples++ = s->table[*src++];
467         }
468         break;
469     case CODEC_ID_PCM_DVD:
470         dst_int32_t = data;
471         n /= avctx->channels;
472         switch (avctx->bits_per_sample) {
473         case 20:
474             while (n--) {
475                 c = avctx->channels;
476                 src8 = src + 4*c;
477                 while (c--) {
478                     *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8   &0xf0) << 8);
479                     *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++ &0x0f) << 12);
480                 }
481                 src = src8;
482             }
483             break;
484         case 24:
485             while (n--) {
486                 c = avctx->channels;
487                 src8 = src + 4*c;
488                 while (c--) {
489                     *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8);
490                     *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8);
491                 }
492                 src = src8;
493             }
494             break;
495         default:
496             av_log(avctx, AV_LOG_ERROR, "PCM DVD unsupported sample depth\n");
497             return -1;
498             break;
499         }
500         samples = (short *) dst_int32_t;
501         break;
502     default:
503         return -1;
504     }
505     *data_size = (uint8_t *)samples - (uint8_t *)data;
506     return src - buf;
507 }
508
509 #ifdef CONFIG_ENCODERS
510 #define PCM_ENCODER(id,sample_fmt_,name,long_name_) \
511 AVCodec name ## _encoder = {                    \
512     #name,                                      \
513     CODEC_TYPE_AUDIO,                           \
514     id,                                         \
515     0,                                          \
516     pcm_encode_init,                            \
517     pcm_encode_frame,                           \
518     pcm_encode_close,                           \
519     NULL,                                       \
520     .sample_fmts = (enum SampleFormat[]){sample_fmt_,SAMPLE_FMT_NONE}, \
521     .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
522 };
523 #else
524 #define PCM_ENCODER(id,sample_fmt_,name,long_name_)
525 #endif
526
527 #ifdef CONFIG_DECODERS
528 #define PCM_DECODER(id,sample_fmt_,name,long_name_)         \
529 AVCodec name ## _decoder = {                    \
530     #name,                                      \
531     CODEC_TYPE_AUDIO,                           \
532     id,                                         \
533     sizeof(PCMDecode),                          \
534     pcm_decode_init,                            \
535     NULL,                                       \
536     NULL,                                       \
537     pcm_decode_frame,                           \
538     .sample_fmts = (enum SampleFormat[]){sample_fmt_,SAMPLE_FMT_NONE}, \
539     .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
540 };
541 #else
542 #define PCM_DECODER(id,sample_fmt_,name,long_name_)
543 #endif
544
545 #define PCM_CODEC(id, sample_fmt_, name, long_name_)         \
546     PCM_ENCODER(id,sample_fmt_,name,long_name_) PCM_DECODER(id,sample_fmt_,name,long_name_)
547
548 /* Note: Do not forget to add new entries to the Makefile as well. */
549 PCM_CODEC  (CODEC_ID_PCM_ALAW,  SAMPLE_FMT_S16, pcm_alaw, "A-law PCM");
550 PCM_CODEC  (CODEC_ID_PCM_DVD,   SAMPLE_FMT_S32, pcm_dvd, "signed 20|24-bit big-endian PCM");
551 PCM_CODEC  (CODEC_ID_PCM_F32BE, SAMPLE_FMT_FLT, pcm_f32be, "32-bit floating point big-endian PCM");
552 PCM_CODEC  (CODEC_ID_PCM_F32LE, SAMPLE_FMT_FLT, pcm_f32le, "32-bit floating point little-endian PCM");
553 PCM_CODEC  (CODEC_ID_PCM_F64BE, SAMPLE_FMT_DBL, pcm_f64be, "64-bit floating point big-endian PCM");
554 PCM_CODEC  (CODEC_ID_PCM_F64LE, SAMPLE_FMT_DBL, pcm_f64le, "64-bit floating point little-endian PCM");
555 PCM_CODEC  (CODEC_ID_PCM_MULAW, SAMPLE_FMT_S16, pcm_mulaw, "mu-law PCM");
556 PCM_CODEC  (CODEC_ID_PCM_S8,    SAMPLE_FMT_U8,  pcm_s8, "signed 8-bit PCM");
557 PCM_CODEC  (CODEC_ID_PCM_S16BE, SAMPLE_FMT_S16, pcm_s16be, "signed 16-bit big-endian PCM");
558 PCM_CODEC  (CODEC_ID_PCM_S16LE, SAMPLE_FMT_S16, pcm_s16le, "signed 16-bit little-endian PCM");
559 PCM_DECODER(CODEC_ID_PCM_S16LE_PLANAR, SAMPLE_FMT_S16, pcm_s16le_planar, "16-bit little-endian planar PCM");
560 PCM_CODEC  (CODEC_ID_PCM_S24BE, SAMPLE_FMT_S32, pcm_s24be, "signed 24-bit big-endian PCM");
561 PCM_CODEC  (CODEC_ID_PCM_S24DAUD, SAMPLE_FMT_S16,  pcm_s24daud, "D-Cinema audio signed 24-bit PCM");
562 PCM_CODEC  (CODEC_ID_PCM_S24LE, SAMPLE_FMT_S32, pcm_s24le, "signed 24-bit little-endian PCM");
563 PCM_CODEC  (CODEC_ID_PCM_S32BE, SAMPLE_FMT_S32, pcm_s32be, "signed 32-bit big-endian PCM");
564 PCM_CODEC  (CODEC_ID_PCM_S32LE, SAMPLE_FMT_S32, pcm_s32le, "signed 32-bit little-endian PCM");
565 PCM_CODEC  (CODEC_ID_PCM_U8,    SAMPLE_FMT_U8,  pcm_u8, "unsigned 8-bit PCM");
566 PCM_CODEC  (CODEC_ID_PCM_U16BE, SAMPLE_FMT_S16, pcm_u16be, "unsigned 16-bit big-endian PCM");
567 PCM_CODEC  (CODEC_ID_PCM_U16LE, SAMPLE_FMT_S16, pcm_u16le, "unsigned 16-bit little-endian PCM");
568 PCM_CODEC  (CODEC_ID_PCM_U24BE, SAMPLE_FMT_S32, pcm_u24be, "unsigned 24-bit big-endian PCM");
569 PCM_CODEC  (CODEC_ID_PCM_U24LE, SAMPLE_FMT_S32, pcm_u24le, "unsigned 24-bit little-endian PCM");
570 PCM_CODEC  (CODEC_ID_PCM_U32BE, SAMPLE_FMT_S32, pcm_u32be, "unsigned 32-bit big-endian PCM");
571 PCM_CODEC  (CODEC_ID_PCM_U32LE, SAMPLE_FMT_S32, pcm_u32le, "unsigned 32-bit little-endian PCM");
572 PCM_CODEC  (CODEC_ID_PCM_ZORK,  SAMPLE_FMT_S16, pcm_zork, "Zork PCM");