aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-02-14 11:01:05 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-02-14 11:01:05 +0000
commit400615b68b1f741b2bc267c97b8dcf2caa7c913d (patch)
tree5b9658813dbc42ac7b1340ec1b2039d7ba73aa14 /libavformat
parente13d80238c362c5b0588de15ccb127491fe01735 (diff)
downloadffmpeg-400615b68b1f741b2bc267c97b8dcf2caa7c913d.tar.gz
use aiff when we can, some players only support aiff
Originally committed as revision 7978 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/aiff.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavformat/aiff.c b/libavformat/aiff.c
index 813c7626a4..0d75f3be30 100644
--- a/libavformat/aiff.c
+++ b/libavformat/aiff.c
@@ -163,26 +163,32 @@ static int aiff_write_header(AVFormatContext *s)
ByteIOContext *pb = &s->pb;
AVCodecContext *enc = s->streams[0]->codec;
AVExtFloat sample_rate;
+ int aifc = 0;
/* First verify if format is ok */
if (!enc->codec_tag) {
return -1;
}
+ if (enc->codec_tag != MKTAG('N','O','N','E'))
+ aifc = 1;
+
/* FORM AIFF header */
put_tag(pb, "FORM");
aiff->form = url_ftell(pb);
put_be32(pb, 0); /* file length */
- put_tag(pb, "AIFC");
+ put_tag(pb, aifc ? "AIFC" : "AIFF");
+ if (aifc) {
/* Version chunk */
put_tag(pb, "FVER");
put_be32(pb, 4);
put_be32(pb, 0xA2805140);
+ }
/* Common chunk */
put_tag(pb, "COMM");
- put_be32(pb, 24); /* size */
+ put_be32(pb, aifc ? 24 : 18); /* size */
put_be16(pb, enc->channels); /* Number of channels */
aiff->frames = url_ftell(pb);
@@ -202,8 +208,10 @@ static int aiff_write_header(AVFormatContext *s)
sample_rate = av_dbl2ext((double)enc->sample_rate);
put_buffer(pb, (uint8_t*)&sample_rate, sizeof(sample_rate));
+ if (aifc) {
put_le32(pb, enc->codec_tag);
put_be16(pb, 0);
+ }
/* Sound data chunk */
put_tag(pb, "SSND");