diff options
author | jan gerber <j@v2v.cc> | 2011-05-07 15:31:04 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-05-07 16:21:55 +0200 |
commit | 5901cd6236d97b34fe59a47ba0fd6da8f647d1f1 (patch) | |
tree | a1035b7e415f96645e7927a1a8b389d30d63eb8c /libavformat/oggdec.c | |
parent | c8981edd902e40185b80ddb77a229104deb7c7e1 (diff) | |
download | ffmpeg-5901cd6236d97b34fe59a47ba0fd6da8f647d1f1.tar.gz |
oggdec:Correct duration
Based on a patch by Reimar Döffinger.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/oggdec.c')
-rw-r--r-- | libavformat/oggdec.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 29e4907e86..43af23d284 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -490,6 +490,18 @@ ogg_get_length (AVFormatContext * s) ogg_restore (s, 0); + ogg_save (s); + url_fseek (s->pb, 0, SEEK_SET); + while (!ogg_read_page (s, &i)){ + if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 && + ogg->streams[i].codec) { + s->streams[i]->duration -= + ogg_gptopts (s, i, ogg->streams[i].granule, NULL); + break; + } + } + ogg_restore (s, 0); + return 0; } |