<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Ralph -<br>
<br>
Thanks, that will come in handy, because I do eventually need to try to
determine duration of individual frames.<br>
<br>
Actually, I phrased my question badly though: What I originally wanted
to know was how to find the total duration of the movie.<br>
<br>
Thanks,<br>
<br>
Ken<br>
<br>
Ralph Giles wrote:
<blockquote cite="mid20070827180530.GA6172@ghostscript.com" type="cite">
<pre wrap="">On Thu, Aug 23, 2007 at 07:13:17AM -0400, Ken Larson wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I'm starting with the theora player_example.c. I want to be able to
determine the duration of the audio/video ahead of time, to be able to
display it somewhere.
I can't see anything obvious in ogg.h, theora.h, or vorbis.h for this.
</pre>
</blockquote>
<pre wrap=""><!---->
It's a little complicated. First you bisection-search based on the ogg
page serial numbers to find all the chain segments. Then you read the
bos pages for each chain segment to identify the codecs and get their
granulepos mappings. Then you read the first and last data packets for
each stream in each chain segment and use those to calculate the
duration of each segment. The length of the ogg stream is the sum of the
durations of each segment.
</pre>
<blockquote type="cite">
<pre wrap="">Can anyone help me with the right place to look to do this?
</pre>
</blockquote>
<pre wrap=""><!---->
You might take a look at liboggplay; it's a convenience library that
does this for general streams, as well as general playback marshalling.
<a class="moz-txt-link-freetext" href="http://svn.annodex.net/liboggplay/trunk/include/oggplay/oggplay.h">http://svn.annodex.net/liboggplay/trunk/include/oggplay/oggplay.h</a>
HTH,
-r
</pre>
</blockquote>
</body>
</html>