[MPlayer-dev-eng] [PATCH] Make ogg (theora) clips' reported length to be saner

Timo Jyrinki timo.jyrinki at hut.fi
Tue Jan 3 14:16:53 CET 2006


Ok, this's like not a Fix but something that works at least better for
me. Currently eg. 3 min Ogg clip (Theora/Vorbis) is reported to have a
length of over 3 hours by MPlayer. Please verify... if you don't have
oggs, one 35s example clip  at
http://www.niksula.hut.fi/%7etajyrink/3d_prod/harj5_final.ogg

The following:

Index: demux_ogg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_ogg.c,v
retrieving revision 1.86
diff -u -r1.86 demux_ogg.c
--- demux_ogg.c	18 Dec 2005 11:55:47 -0000	1.86
+++ demux_ogg.c	3 Jan 2006 12:11:39 -0000
@@ -1637,7 +1637,7 @@

   if(demuxer->video->id >= 0) {
     os = &ogg_d->subs[demuxer->video->id];
-    rate = os->samplerate;
+    rate = os->samplerate*64;
   } else {
     os = &ogg_d->subs[demuxer->audio->id];
     rate =
(float)((ov_struct_t*)((sh_audio_t*)demuxer->audio->sh)->context)->vi.rate;

...fixes the problem somewhat (only a few seconds off). Of course, doing
this correctly would require more (what?) than just
final_granulepos/rate. But if you think that the change doesn't break
anything more than it already is, it would be better this way than
showing totally wrong numbers.

Getting the Ogg length seems to be more complicated than it could/should
be, but then again it's already done right eg. in GStreamer and Xine so
someone more knowledgeable could perhaps fix this correctly.

I've also noticed that when using mplayer to play ogg theora/vorbis
files with vo/vc null and ao pcm, mplayer stops ca. 10-20% before the
end, making it unusable. Do you think it's related to this length
calculation (in perhaps some other place of the demuxer) or something
else? Also seeking often "throws" the user towards the end by a big leap
when trying to rewind, which's another problem of MPlayer ogg/theora
playback. I wonder if these could also be fixed by taking a better look
at how various things are calculated in demux_ogg.c.

-Timo




More information about the MPlayer-dev-eng mailing list