[Ffmpeg-cvslog] CVS: ffmpeg/libavformat wav.c, 1.53, 1.54 utils.c, 1.164, 1.165

Reimar Döffinger CVS reimar
Fri Sep 2 21:16:50 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv32161/libavformat

Modified Files:
	wav.c utils.c 
Log Message:
Support de-/encoding of 24 and 32 bit PCM (from and to internal 16 bit).


Index: wav.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/wav.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- wav.c	17 Jul 2005 22:24:36 -0000	1.53
+++ wav.c	2 Sep 2005 19:16:48 -0000	1.54
@@ -25,6 +25,8 @@
     { CODEC_ID_AC3, 0x2000 },
     { CODEC_ID_PCM_S16LE, 0x01 },
     { CODEC_ID_PCM_U8, 0x01 }, /* must come after s16le in this list */
+    { CODEC_ID_PCM_S24LE, 0x01 },
+    { CODEC_ID_PCM_S32LE, 0x01 },
     { CODEC_ID_PCM_ALAW, 0x06 },
     { CODEC_ID_PCM_MULAW, 0x07 },
     { CODEC_ID_ADPCM_MS, 0x02 },
@@ -68,6 +70,10 @@
         bps = 0;
     } else if (enc->codec_id == CODEC_ID_ADPCM_IMA_WAV || enc->codec_id == CODEC_ID_ADPCM_MS || enc->codec_id == CODEC_ID_ADPCM_G726 || enc->codec_id == CODEC_ID_ADPCM_YAMAHA) { //
         bps = 4;
+    } else if (enc->codec_id == CODEC_ID_PCM_S24LE) {
+        bps = 24;
+    } else if (enc->codec_id == CODEC_ID_PCM_S32LE) {
+        bps = 32;
     } else {
         bps = 16;
     }
@@ -82,6 +88,8 @@
     } else
         blkalign = enc->channels*bps >> 3;
     if (enc->codec_id == CODEC_ID_PCM_U8 ||
+        enc->codec_id == CODEC_ID_PCM_S24LE ||
+        enc->codec_id == CODEC_ID_PCM_S32LE ||
         enc->codec_id == CODEC_ID_PCM_S16LE) {
         bytespersec = enc->sample_rate * blkalign;
     } else {
@@ -179,6 +187,10 @@
     /* handle specific u8 codec */
     if (id == CODEC_ID_PCM_S16LE && bps == 8)
         id = CODEC_ID_PCM_U8;
+    if (id == CODEC_ID_PCM_S16LE && bps == 24)
+        id = CODEC_ID_PCM_S24LE;
+    if (id == CODEC_ID_PCM_S16LE && bps == 32)
+        id = CODEC_ID_PCM_S32LE;
     return id;
 }
 

Index: utils.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/utils.c,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- utils.c	15 Aug 2005 15:58:21 -0000	1.164
+++ utils.c	2 Sep 2005 19:16:48 -0000	1.165
@@ -643,6 +643,23 @@
         /* specific hack for pcm codecs because no frame size is
            provided */
         switch(enc->codec_id) {
+        case CODEC_ID_PCM_S32LE:
+        case CODEC_ID_PCM_S32BE:
+        case CODEC_ID_PCM_U32LE:
+        case CODEC_ID_PCM_U32BE:
+            if (enc->channels == 0)
+                return -1;
+            frame_size = size / (4 * enc->channels);
+            break;
+        case CODEC_ID_PCM_S24LE:
+        case CODEC_ID_PCM_S24BE:
+        case CODEC_ID_PCM_U24LE:
+        case CODEC_ID_PCM_U24BE:
+        case CODEC_ID_PCM_S24DAUD:
+            if (enc->channels == 0)
+                return -1;
+            frame_size = size / (3 * enc->channels);
+            break;
         case CODEC_ID_PCM_S16LE:
         case CODEC_ID_PCM_S16BE:
         case CODEC_ID_PCM_U16LE:





More information about the ffmpeg-cvslog mailing list