diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2007-07-30 02:05:16 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2007-07-30 02:05:16 +0000 |
commit | a11c2a2c66c6e74f4af366995704a3819466f3a8 (patch) | |
tree | dfa723f995dd35b7b120f027dc041ec3195ce82d /libavcodec/pcm.c | |
parent | 2711cb28f46463760f0326d806fe5ef9551ade2c (diff) | |
download | ffmpeg-a11c2a2c66c6e74f4af366995704a3819466f3a8.tar.gz |
support silly PCM variant used by zork nemesis
fixes audio decoding of T000A11C.AVI
Originally committed as revision 9831 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/pcm.c')
-rw-r--r-- | libavcodec/pcm.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 2551d12b65..c0383adabc 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -291,6 +291,14 @@ static int pcm_encode_frame(AVCodecContext *avctx, *dst++ = (v >> 8) + 128; } break; + case CODEC_ID_PCM_ZORK: + for(;n>0;n--) { + v= *samples++ >> 8; + if(v<0) v = -v; + else v+= 128; + *dst++ = v; + } + break; case CODEC_ID_PCM_ALAW: for(;n>0;n--) { v = *samples++; @@ -452,6 +460,15 @@ static int pcm_decode_frame(AVCodecContext *avctx, *samples++ = ((int)*src++ - 128) << 8; } break; + case CODEC_ID_PCM_ZORK: + n = buf_size; + for(;n>0;n--) { + int x= *src++; + if(x&128) x-= 128; + else x = -x; + *samples++ = x << 8; + } + break; case CODEC_ID_PCM_ALAW: case CODEC_ID_PCM_MULAW: n = buf_size; @@ -505,5 +522,6 @@ PCM_CODEC(CODEC_ID_PCM_S8, pcm_s8); PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8); PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw); PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw); +PCM_CODEC(CODEC_ID_PCM_ZORK, pcm_zork); #undef PCM_CODEC |