From dc878b96a78c1cc5edc6edc0bf087cf7a3c14ae9 Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Fri, 20 Apr 2012 13:21:28 -0700 Subject: [PATCH] movenc: Support high sample rates in isomedia formats by setting the sample rate field in stsd to 0. Libisomediafile appears to always set this field to zero. --- libavformat/movenc.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index dd2598b5ed..35c03ddfef 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -630,7 +630,8 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track) avio_wb16(pb, 0); avio_wb16(pb, 0); /* packet size (= 0) */ - avio_wb16(pb, track->enc->sample_rate); + avio_wb16(pb, track->enc->sample_rate <= UINT16_MAX ? + track->enc->sample_rate : 0); avio_wb16(pb, 0); /* Reserved */ } @@ -3122,17 +3123,11 @@ static int mov_write_header(AVFormatContext *s) if (av_get_bits_per_sample(st->codec->codec_id) < 8) { track->audio_vbr = 1; } - if (track->mode != MODE_MOV) { - if (track->timescale > UINT16_MAX) { - av_log(s, AV_LOG_ERROR, "track %d: output format does not support " - "sample rate %dhz\n", i, track->timescale); - goto error; - } - if (track->enc->codec_id == CODEC_ID_MP3 && track->timescale < 16000) { - av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is not supported\n", - i, track->enc->sample_rate); - goto error; - } + if (track->mode != MODE_MOV && + track->enc->codec_id == CODEC_ID_MP3 && track->timescale < 16000) { + av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is not supported\n", + i, track->enc->sample_rate); + goto error; } }else if(st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE){ track->timescale = st->codec->time_base.den;