From d1f05dd18375f2f8e68372edee11436927e43ba8 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Thu, 20 Sep 2012 01:07:09 +0200 Subject: ogg: calculate the start position once all the headers are parsed The fisbone packets can be muxed in any order as long the last one comes before the first data packet. --- libavformat/oggdec.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libavformat/oggdec.c') diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index c8b2a858f1..175feb79e6 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -169,6 +169,7 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream) os->bufsize = DECODER_BUFFER_SIZE; os->buf = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE); os->header = -1; + os->start_granule = OGG_NOGRANULE_VALUE; if (new_avstream) { st = avformat_new_stream(s, NULL); @@ -463,6 +464,9 @@ static int ogg_get_headers(AVFormatContext *s) "Headers mismatch for stream %d\n", i); return AVERROR_INVALIDDATA; } + if (os->start_granule != OGG_NOGRANULE_VALUE) + os->lastpts = s->streams[i]->start_time = + ogg_gptopts(s, i, os->start_granule, NULL); } av_dlog(s, "found headers\n"); -- cgit v1.2.3