[FFmpeg-cvslog] r9831 - in trunk: libavcodec/allcodecs.c libavcodec/allcodecs.h libavcodec/avcodec.h libavcodec/pcm.c libavformat/riff.c

michael subversion
Mon Jul 30 04:05:17 CEST 2007


Author: michael
Date: Mon Jul 30 04:05:16 2007
New Revision: 9831

Log:
support silly PCM variant used by zork nemesis
fixes audio decoding of T000A11C.AVI


Modified:
   trunk/libavcodec/allcodecs.c
   trunk/libavcodec/allcodecs.h
   trunk/libavcodec/avcodec.h
   trunk/libavcodec/pcm.c
   trunk/libavformat/riff.c

Modified: trunk/libavcodec/allcodecs.c
==============================================================================
--- trunk/libavcodec/allcodecs.c	(original)
+++ trunk/libavcodec/allcodecs.c	Mon Jul 30 04:05:16 2007
@@ -225,6 +225,7 @@ void avcodec_register_all(void)
     REGISTER_ENCDEC (PCM_U24LE, pcm_u24le);
     REGISTER_ENCDEC (PCM_U32BE, pcm_u32be);
     REGISTER_ENCDEC (PCM_U32LE, pcm_u32le);
+    REGISTER_ENCDEC (PCM_ZORK , pcm_zork);
 
     /* dpcm codecs */
     REGISTER_DECODER(INTERPLAY_DPCM, interplay_dpcm);

Modified: trunk/libavcodec/allcodecs.h
==============================================================================
--- trunk/libavcodec/allcodecs.h	(original)
+++ trunk/libavcodec/allcodecs.h	Mon Jul 30 04:05:16 2007
@@ -228,6 +228,7 @@ PCM_CODEC(CODEC_ID_PCM_U24BE,   pcm_u24b
 PCM_CODEC(CODEC_ID_PCM_U24LE,   pcm_u24le);
 PCM_CODEC(CODEC_ID_PCM_U32BE,   pcm_u32be);
 PCM_CODEC(CODEC_ID_PCM_U32LE,   pcm_u32le);
+PCM_CODEC(CODEC_ID_PCM_ZORK,    pcm_zork);
 
 /* ADPCM codecs */
 

Modified: trunk/libavcodec/avcodec.h
==============================================================================
--- trunk/libavcodec/avcodec.h	(original)
+++ trunk/libavcodec/avcodec.h	Mon Jul 30 04:05:16 2007
@@ -185,6 +185,7 @@ enum CodecID {
     CODEC_ID_PCM_U24LE,
     CODEC_ID_PCM_U24BE,
     CODEC_ID_PCM_S24DAUD,
+    CODEC_ID_PCM_ZORK,
 
     /* various ADPCM codecs */
     CODEC_ID_ADPCM_IMA_QT= 0x11000,

Modified: trunk/libavcodec/pcm.c
==============================================================================
--- trunk/libavcodec/pcm.c	(original)
+++ trunk/libavcodec/pcm.c	Mon Jul 30 04:05:16 2007
@@ -291,6 +291,14 @@ static int pcm_encode_frame(AVCodecConte
             *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(AVCodecConte
             *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

Modified: trunk/libavformat/riff.c
==============================================================================
--- trunk/libavformat/riff.c	(original)
+++ trunk/libavformat/riff.c	Mon Jul 30 04:05:16 2007
@@ -415,6 +415,8 @@ int wav_codec_get_id(unsigned int tag, i
         id = CODEC_ID_PCM_S24LE;
     if (id == CODEC_ID_PCM_S16LE && bps == 32)
         id = CODEC_ID_PCM_S32LE;
+    if (id == CODEC_ID_ADPCM_IMA_WAV && bps == 8)
+        id = CODEC_ID_PCM_ZORK;
     return id;
 }
 #endif // CONFIG_DEMUXERS




More information about the ffmpeg-cvslog mailing list