summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Converse <alex.converse@gmail.com>2012-04-20 13:21:28 -0700
committerAlex Converse <alex.converse@gmail.com>2012-04-20 13:45:35 -0700
commitdc878b96a78c1cc5edc6edc0bf087cf7a3c14ae9 (patch)
tree02ed17a87c7a81b063d165c6a984fe1b0188d701
parentf973a85d4af67165dd1661c347f33ac5d1ef51a3 (diff)
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.
-rw-r--r--libavformat/movenc.c19
1 files 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;