Daniel Verkamp <[email protected]> added the comment:

Would a patch moving all of those 4-bit ADPCM codecs to the generic 
av_get_bits_per_sample() code be ok?

----------
nosy: +DrV

_____________________________________________________
FFmpeg issue tracker <[email protected]>
<https://roundup.ffmpeg.org/roundup/ffmpeg/issue1205>
_____________________________________________________
>From 52e12002b916b562bad9d5c61ce4941ca13c67d9 Mon Sep 17 00:00:00 2001
From: Daniel Verkamp <[email protected]>
Date: Mon, 21 Dec 2009 17:36:43 -0500
Subject: [PATCH] Handle ADPCM formats in av_get_bits_per_sample

---
 libavcodec/utils.c |    5 +++++
 libavformat/riff.c |    2 --
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d91cbc0..04807fa 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -963,6 +963,11 @@ int av_get_bits_per_sample(enum CodecID codec_id){
         return 3;
     case CODEC_ID_ADPCM_SBPRO_4:
     case CODEC_ID_ADPCM_CT:
+    case CODEC_ID_ADPCM_IMA_WAV:
+    case CODEC_ID_ADPCM_MS:
+    case CODEC_ID_ADPCM_G726:
+    case CODEC_ID_ADPCM_YAMAHA:
+    case CODEC_ID_ADPCM_SWF:
         return 4;
     case CODEC_ID_PCM_ALAW:
     case CODEC_ID_PCM_MULAW:
diff --git a/libavformat/riff.c b/libavformat/riff.c
index e1d0b2e..cac7d6a 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -332,8 +332,6 @@ int ff_put_wav_header(ByteIOContext *pb, AVCodecContext 
*enc)
     put_le32(pb, enc->sample_rate);
     if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || 
enc->codec_id == CODEC_ID_GSM_MS) {
         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 (!(bps = av_get_bits_per_sample(enc->codec_id)))
             bps = 16; // default to 16
-- 
1.6.6.rc3

Reply via email to