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.
This commit is contained in:
Alex Converse 2012-04-20 13:21:28 -07:00
parent f973a85d4a
commit dc878b96a7
1 changed files with 7 additions and 12 deletions

View File

@ -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;