Determining the length of a file using aRts

Jason Wood jasonwood at blueyonder.co.uk
Mon Sep 16 04:23:35 BST 2002


On Monday 16 Sep 2002 3:47 am, Charles Samuels wrote:
> Sunday 15 September 2002 07:43 pm, skrev Jason Wood:
> > Hi,
> >
> > My application needs to be able to determine the length of an audio/movie
> > clip as quickly as possible, but I am having trouble determining the best
> > way to do this.
> >
> > The only method I have using aRts at present is to open a play object,
> > wait for it to start playing, test it in various ways to discover when
> > the overallTime() function is returning a valid value, and then to stop
> > and close the playobject again. This is not a method I can use in my
> > application.
>
> You don't need to wait for it to start playing.  Just until after you open
> it.

Sorry, I should clarify that where I said open, I meant that I create a Play 
object (in particular, a KPlayObject,  though I don't think that is important 
in this case).

Is there a difference between opening a PlayObject and playing one? In other 
words, is there some method equivalent of a PlayObject->prepare(), or a 
PlayObject->open()   (having checked the docs I can't see anything obvious)

If I try to read the overallTime() of the PlayObject without playing it first 
(i.e. I have just created it), it always comes back with a duration of 0. 

If I try to play it first, it seems to take a couple of seconds to "warm up". 
I have to wait until the overallTime() changes to non-zero by repeatedly 
testing it.

cheers,
Jason.

-- 
Jason Wood
Homepage : www.uchian.pwp.blueyonder.co.uk



More information about the kde-multimedia mailing list