summaryrefslogtreecommitdiff
path: root/libavformat/oggdec.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2012-09-20 01:07:09 +0200
committerLuca Barbato <lu_zero@gentoo.org>2012-09-24 22:35:29 +0200
commitd1f05dd18375f2f8e68372edee11436927e43ba8 (patch)
treec63585f1c7dd1f8bb10d3d5339ee7114a4583f5b /libavformat/oggdec.c
parent7751e4693dd10ec98c20fbd9887233b575034272 (diff)
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.
Diffstat (limited to 'libavformat/oggdec.c')
-rw-r--r--libavformat/oggdec.c4
1 files changed, 4 insertions, 0 deletions
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");