summaryrefslogtreecommitdiff
path: root/libavformat/wav.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2005-09-02 19:16:48 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2005-09-02 19:16:48 +0000
commitb461b3bc4a14fe86aba4ed8e9adf30ab262896a2 (patch)
tree6ebc879c0917029608f33b2a224cb9a85c7ed3b4 /libavformat/wav.c
parent16beae15f3b610dfaa1d39d1effa25816c4185ae (diff)
Support de-/encoding of 24 and 32 bit PCM (from and to internal 16 bit).
Originally committed as revision 4548 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/wav.c')
-rw-r--r--libavformat/wav.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavformat/wav.c b/libavformat/wav.c
index 6557c0a962..e566f5ee6b 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -25,6 +25,8 @@ const CodecTag codec_wav_tags[] = {
{ 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 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
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 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
} 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 @@ int wav_codec_get_id(unsigned int tag, int bps)
/* 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;
}