1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

use aiff when we can, some players only support aiff

Originally committed as revision 7978 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Baptiste Coudurier 2007-02-14 11:01:05 +00:00
parent e13d80238c
commit 400615b68b
2 changed files with 12 additions and 4 deletions

View File

@ -163,26 +163,32 @@ static int aiff_write_header(AVFormatContext *s)
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
AVCodecContext *enc = s->streams[0]->codec; AVCodecContext *enc = s->streams[0]->codec;
AVExtFloat sample_rate; AVExtFloat sample_rate;
int aifc = 0;
/* First verify if format is ok */ /* First verify if format is ok */
if (!enc->codec_tag) { if (!enc->codec_tag) {
return -1; return -1;
} }
if (enc->codec_tag != MKTAG('N','O','N','E'))
aifc = 1;
/* FORM AIFF header */ /* FORM AIFF header */
put_tag(pb, "FORM"); put_tag(pb, "FORM");
aiff->form = url_ftell(pb); aiff->form = url_ftell(pb);
put_be32(pb, 0); /* file length */ put_be32(pb, 0); /* file length */
put_tag(pb, "AIFC"); put_tag(pb, aifc ? "AIFC" : "AIFF");
if (aifc) {
/* Version chunk */ /* Version chunk */
put_tag(pb, "FVER"); put_tag(pb, "FVER");
put_be32(pb, 4); put_be32(pb, 4);
put_be32(pb, 0xA2805140); put_be32(pb, 0xA2805140);
}
/* Common chunk */ /* Common chunk */
put_tag(pb, "COMM"); put_tag(pb, "COMM");
put_be32(pb, 24); /* size */ put_be32(pb, aifc ? 24 : 18); /* size */
put_be16(pb, enc->channels); /* Number of channels */ put_be16(pb, enc->channels); /* Number of channels */
aiff->frames = url_ftell(pb); aiff->frames = url_ftell(pb);
@ -202,8 +208,10 @@ static int aiff_write_header(AVFormatContext *s)
sample_rate = av_dbl2ext((double)enc->sample_rate); sample_rate = av_dbl2ext((double)enc->sample_rate);
put_buffer(pb, (uint8_t*)&sample_rate, sizeof(sample_rate)); put_buffer(pb, (uint8_t*)&sample_rate, sizeof(sample_rate));
if (aifc) {
put_le32(pb, enc->codec_tag); put_le32(pb, enc->codec_tag);
put_be16(pb, 0); put_be16(pb, 0);
}
/* Sound data chunk */ /* Sound data chunk */
put_tag(pb, "SSND"); put_tag(pb, "SSND");

View File

@ -62,8 +62,8 @@ e2a6d6fae17394dfe87cb5bb8ae11837 *./data/b-libav.al
272b91d8fc31ed43b08246d182719751 *./data/b-libav.mmf 272b91d8fc31ed43b08246d182719751 *./data/b-libav.mmf
22609 ./data/b-libav.mmf 22609 ./data/b-libav.mmf
./data/b-libav.mmf CRC=0x03633476 ./data/b-libav.mmf CRC=0x03633476
c8cf5bac13fb7862bcbce76977328f92 *./data/b-libav.aif ae3a23a7ea13c92a2909445ca8144dcd *./data/b-libav.aif
89160 ./data/b-libav.aif 89142 ./data/b-libav.aif
./data/b-libav.aif CRC=0x2a09519c ./data/b-libav.aif CRC=0x2a09519c
8d117c49d6b210abe783d1b0b897cec7 *./data/b-libav.voc 8d117c49d6b210abe783d1b0b897cec7 *./data/b-libav.voc
32768 ./data/b-libav.voc 32768 ./data/b-libav.voc