[FFmpeg-cvslog] oggdec:Correct duration
jan gerber
git at videolan.org
Sat May 7 16:23:57 CEST 2011
ffmpeg | branch: master | jan gerber <j at v2v.cc> | Sat May 7 15:31:04 2011 +0200| [5901cd6236d97b34fe59a47ba0fd6da8f647d1f1] | committer: Michael Niedermayer
oggdec:Correct duration
Based on a patch by Reimar Döffinger.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5901cd6236d97b34fe59a47ba0fd6da8f647d1f1
---
libavformat/oggdec.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 29e4907..43af23d 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;
}
More information about the ffmpeg-cvslog
mailing list