Commit 7e7012d0 authored by Michael Niedermayer's avatar Michael Niedermayer

oggdec: subtract time of first packet only from duration when it is significant

this fixes accuracy with normal ogg files while keeping support for ogg files
starting at times different from 0
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent d2cab951
......@@ -493,8 +493,9 @@ static int ogg_get_length(AVFormatContext *s)
if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
ogg->streams[i].codec) {
if(s->streams[i]->duration && s->streams[i]->start_time == AV_NOPTS_VALUE && !ogg->streams[i].got_start){
s->streams[i]->duration -=
ogg_gptopts (s, i, ogg->streams[i].granule, NULL);
int64_t start= ogg_gptopts (s, i, ogg->streams[i].granule, NULL);
if(av_rescale_q(start, s->streams[i]->time_base, AV_TIME_BASE_Q) > AV_TIME_BASE)
s->streams[i]->duration -= start;
ogg->streams[i].got_start= 1;
streams_left--;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment