summaryrefslogtreecommitdiff
path: root/libav
diff options
context:
space:
mode:
authorPhilip Gladstone <philipjsg@users.sourceforge.net>2002-05-09 01:21:56 +0000
committerPhilip Gladstone <philipjsg@users.sourceforge.net>2002-05-09 01:21:56 +0000
commitafc25d93eafef6ec49d10f6648b9ea167c4077c4 (patch)
tree90ebdc99bc7be31efa10aa74d8736949ede4df41 /libav
parentec6ac5e1fbd1facd1b6dcebbec4b617d2262f81d (diff)
* Make put_wav_header return the number of bytes that it put.
Originally committed as revision 468 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libav')
-rw-r--r--libav/wav.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libav/wav.c b/libav/wav.c
index d92b20c5e8..6fcd4d7077 100644
--- a/libav/wav.c
+++ b/libav/wav.c
@@ -31,9 +31,11 @@ CodecTag codec_wav_tags[] = {
};
/* WAVEFORMATEX header */
+/* returns the size or -1 on error */
int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
{
int tag, bps, blkalign, bytespersec;
+ int hdrsize = 18;
tag = codec_get_tag(codec_wav_tags, enc->codec_id);
if (tag == 0)
@@ -67,6 +69,7 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
put_le16(pb, bps); /* bits per sample */
if (enc->codec_id == CODEC_ID_MP3LAME) {
put_le16(pb, 12); /* wav_extra_size */
+ hdrsize += 12;
put_le16(pb, 1); /* wID */
put_le32(pb, 2); /* fdwFlags */
put_le16(pb, 1152); /* nBlockSize */
@@ -74,6 +77,7 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
put_le16(pb, 1393); /* nCodecDelay */
} else if (enc->codec_id == CODEC_ID_MP2) {
put_le16(pb, 22); /* wav_extra_size */
+ hdrsize += 22;
put_le16(pb, 2); /* fwHeadLayer */
put_le32(pb, enc->bit_rate); /* dwHeadBitrate */
put_le16(pb, enc->channels == 2 ? 1 : 8); /* fwHeadMode */
@@ -85,7 +89,7 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
} else
put_le16(pb, 0); /* wav_extra_size */
- return 0;
+ return hdrsize;
}
int wav_codec_get_id(unsigned int tag, int bps)