aboutsummaryrefslogtreecommitdiffstats
path: root/libav/wav.c
diff options
context:
space:
mode:
authorJuanjo <pulento@users.sourceforge.net>2002-04-15 02:28:05 +0000
committerJuanjo <pulento@users.sourceforge.net>2002-04-15 02:28:05 +0000
commit4b1f4f236b1019e69396676f1eb455bbea0d8e17 (patch)
treeaac32420abdbb0e34991150d71f2d86bac11bcae /libav/wav.c
parent101bea5f2272dfcca084aeeb78ccb1c2e925b12b (diff)
downloadffmpeg-4b1f4f236b1019e69396676f1eb455bbea0d8e17.tar.gz
- Versions defined for libav/libavcodec.
- Bug fix in wav muxer for MP2 audio. - ffmpeg/libavcodec version in MPEG-4 user data. Originally committed as revision 400 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libav/wav.c')
-rw-r--r--libav/wav.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/libav/wav.c b/libav/wav.c
index 0023ac608a..d92b20c5e8 100644
--- a/libav/wav.c
+++ b/libav/wav.c
@@ -20,9 +20,8 @@
#include "avi.h"
CodecTag codec_wav_tags[] = {
- { CODEC_ID_MP2, 0x55 },
- { CODEC_ID_MP3LAME, 0x55 },
{ CODEC_ID_MP2, 0x50 },
+ { CODEC_ID_MP3LAME, 0x55 },
{ CODEC_ID_AC3, 0x2000 },
{ CODEC_ID_PCM_S16LE, 0x01 },
{ CODEC_ID_PCM_U8, 0x01 }, /* must come after s16le in this list */
@@ -39,7 +38,7 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
tag = codec_get_tag(codec_wav_tags, enc->codec_id);
if (tag == 0)
return -1;
- put_le16(pb, tag);
+ put_le16(pb, tag);
put_le16(pb, enc->channels);
put_le32(pb, enc->sample_rate);
if (enc->codec_id == CODEC_ID_PCM_U8 ||
@@ -52,9 +51,10 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
bps = 16;
}
- if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3LAME)
+ if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3LAME) {
blkalign = 1;
- else
+ //blkalign = 144 * enc->bit_rate/enc->sample_rate;
+ } else
blkalign = enc->channels*bps >> 3;
if (enc->codec_id == CODEC_ID_PCM_U8 ||
enc->codec_id == CODEC_ID_PCM_S16LE) {
@@ -65,13 +65,23 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
put_le32(pb, bytespersec); /* bytes per second */
put_le16(pb, blkalign); /* block align */
put_le16(pb, bps); /* bits per sample */
- if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3LAME) {
+ if (enc->codec_id == CODEC_ID_MP3LAME) {
put_le16(pb, 12); /* wav_extra_size */
put_le16(pb, 1); /* wID */
put_le32(pb, 2); /* fdwFlags */
put_le16(pb, 1152); /* nBlockSize */
put_le16(pb, 1); /* nFramesPerBlock */
put_le16(pb, 1393); /* nCodecDelay */
+ } else if (enc->codec_id == CODEC_ID_MP2) {
+ put_le16(pb, 22); /* wav_extra_size */
+ put_le16(pb, 2); /* fwHeadLayer */
+ put_le32(pb, enc->bit_rate); /* dwHeadBitrate */
+ put_le16(pb, enc->channels == 2 ? 1 : 8); /* fwHeadMode */
+ put_le16(pb, 0); /* fwHeadModeExt */
+ put_le16(pb, 1); /* wHeadEmphasis */
+ put_le16(pb, 16); /* fwHeadFlags */
+ put_le32(pb, 0); /* dwPTSLow */
+ put_le32(pb, 0); /* dwPTSHigh */
} else
put_le16(pb, 0); /* wav_extra_size */