Technically speaking Player has its own playing thread which is triggered by 
the startPlayback() call. So depending on scheduler that runs in Python and 
overall system busyness it can take some time till the main loop goes into 
parsing the file. 
As of getLength() call. Some formats have length in the headers, some not. In 
some cases the length of the file can be calculated as FILE_LENGTH / BIT_RATE 
(not sample rate). But it is very inaccurate calculation. 
For MP3 file the easiest way to get the length of the audio file is to read 
XING header if exists.
For OGG that information may be available already in the header.
Hope this helps,
Dmitry/

-----Original Message-----
From: jeffbarish <[EMAIL PROTECTED]>
To: [email protected]
Date: Tue, 11 Jul 2006 13:09:21 -0700 (PDT)
Subject: Re: [Pymedia-users] Experience using PyMedia

> 
> 
> Concerning the bug in player.getLength(): getLength() returns self.length. 
> self.length is set in _getStreamLength(), which is called from
> _readerLoop().  After calling _getStreamLength(), _readerLoop() drops into a
> while loop where it stays as long as the sound file is playing. 
> Accordingly, _getStreamLength() never gets called again.  You said that it
> sometimes takes 1 sec before getLength() returns the correct value, but if
> _getStreamLength() never gets called again then self.length will never get
> updated.  self.length is assigned a large negative number the one time
> _getStreamLength() gets called.  I don't know what you meant to do here.  I
> especially don't know why player can't get the correct length the first time
> _getSreamLength is called.  We should be able to determine the file size. 
> The only other datum we need is the sample rate.  Is there a problem reading
> the metadata in one try?  Any suggestions?
> -- 
> View this message in context: 
> http://www.nabble.com/Experience-using-PyMedia-tf1919429.html#a5276934
> Sent from the pymedia-users forum at Nabble.com.
> 
> 
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Pymedia-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pymedia-users
> 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Pymedia-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pymedia-users

Reply via email to