X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Foggparsetheora.c;h=87a676fe482f29a96a8f269d776637619b5bf52f;hb=a07b19d9af6377beac5630cb49065ede426c4fee;hp=b14f9f0669c1addc191b42b42411bdef7fd3dd05;hpb=b668a1c8b35d7b45eb32cba465fb99b99355998c;p=ffmpeg diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c index b14f9f0669c..87a676fe482 100644 --- a/libavformat/oggparsetheora.c +++ b/libavformat/oggparsetheora.c @@ -65,7 +65,7 @@ static int theora_header(AVFormatContext *s, int idx) /* 0x80"theora" */ skip_bits_long(&gb, 7 * 8); - thp->version = get_bits_long(&gb, 24); + thp->version = get_bits(&gb, 24); if (thp->version < 0x030100) { av_log(s, AV_LOG_ERROR, "Too old or unsupported Theora (%x)\n", thp->version); @@ -79,8 +79,8 @@ static int theora_header(AVFormatContext *s, int idx) skip_bits(&gb, 100); if (thp->version >= 0x030200) { - int width = get_bits_long(&gb, 24); - int height = get_bits_long(&gb, 24); + int width = get_bits(&gb, 24); + int height = get_bits(&gb, 24); if (width <= st->codecpar->width && width > st->codecpar->width - 16 && height <= st->codecpar->height && height > st->codecpar->height - 16) { st->codecpar->width = width; @@ -99,8 +99,8 @@ static int theora_header(AVFormatContext *s, int idx) } avpriv_set_pts_info(st, 64, timebase.num, timebase.den); - st->sample_aspect_ratio.num = get_bits_long(&gb, 24); - st->sample_aspect_ratio.den = get_bits_long(&gb, 24); + st->sample_aspect_ratio.num = get_bits(&gb, 24); + st->sample_aspect_ratio.den = get_bits(&gb, 24); if (thp->version >= 0x030200) skip_bits_long(&gb, 38); @@ -181,6 +181,7 @@ static int theora_packet(AVFormatContext *s, int idx) if ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) && !(os->flags & OGG_FLAG_EOS)) { int seg; + int64_t pts; duration = 1; for (seg = os->segp; seg < os->nsegs; seg++) { @@ -188,7 +189,10 @@ static int theora_packet(AVFormatContext *s, int idx) duration ++; } - os->lastpts = os->lastdts = theora_gptopts(s, idx, os->granule, NULL) - duration; + pts = theora_gptopts(s, idx, os->granule, NULL); + if (pts != AV_NOPTS_VALUE) + pts -= duration; + os->lastpts = os->lastdts = pts; if(s->streams[idx]->start_time == AV_NOPTS_VALUE) { s->streams[idx]->start_time = os->lastpts; if (s->streams[idx]->duration > 0)