summaryrefslogtreecommitdiff
path: root/libavformat/movenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-07-06 12:17:01 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-07-06 12:17:01 +0000
commit9a39cd35b8a3e172d902b06d7dfbca9073ee1caa (patch)
tree5bf587b773eca691c7c196233db6d4c2f356a662 /libavformat/movenc.c
parent1ae4a8e61fef01c35ae30dcd7b64ae8fd20f0c85 (diff)
vbr requires version=1 and samplesize=0 per QT spec
untested, but if this doesnt work the issue is likely somewhere else, as iam just chaning the random nonsense we do to what the spec says should be done Originally committed as revision 5636 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r--libavformat/movenc.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index dc18ccdb37..1709ffe307 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -353,9 +353,11 @@ static const CodecTag codec_movaudio_tags[] = {
static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track)
{
offset_t pos = url_ftell(pb);
+ int vbr= track->enc->codec_id == CODEC_ID_AAC ||
+ track->enc->codec_id == CODEC_ID_MP3 ||
+ track->enc->codec_id == CODEC_ID_AMR_NB;
int version = track->mode == MODE_MOV &&
- (track->enc->codec_id == CODEC_ID_AAC ||
- track->enc->codec_id == CODEC_ID_MP3 ||
+ (vbr ||
track->enc->codec_id == CODEC_ID_PCM_S32LE ||
track->enc->codec_id == CODEC_ID_PCM_S24LE);
@@ -375,9 +377,7 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track)
to be a good way to get number of bits of audio */
put_be16(pb, 0x10); /* Reserved */
- if(track->enc->codec_id == CODEC_ID_AAC ||
- track->enc->codec_id == CODEC_ID_MP3 ||
- track->enc->codec_id == CODEC_ID_AMR_NB) {
+ if(vbr) {
put_be16(pb, 0xfffe); /* compression ID (vbr)*/
} else {
put_be16(pb, 0); /* compression ID (= 0) */
@@ -387,13 +387,10 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track)
put_be16(pb, 0); /* Reserved */
if(version == 1) { /* SoundDescription V1 extended info */
- /* Parameters tested on quicktime 6.5, 7 */
- if (track->enc->codec_id == CODEC_ID_MP3)
- track->sampleSize = 666;
- if (track->enc->codec_id == CODEC_ID_AAC)
- track->sampleSize = 2;
+ if (vbr)
+ track->sampleSize = 0;
put_be32(pb, track->enc->frame_size); /* Samples per packet */
- put_be32(pb, track->sampleSize / 2); /* Bytes per packet */
+ put_be32(pb, track->sampleSize / track->enc->channels); /* Bytes per packet */
put_be32(pb, track->sampleSize); /* Bytes per frame */
put_be32(pb, 2); /* Bytes per sample */
}