Finding out estimated duration of a stream using Core Audio

Posted by Reflog on Stack Overflow See other posts from Stack Overflow or by Reflog
Published on 2010-03-25T17:22:50Z Indexed on 2010/03/25 17:23 UTC
Read the original article Hit count: 563

Filed under:
|
|
|
|

I am streaming a MP3 over network using custom feeding code, not AVAudioPlayer (which only works with URLs) using APIs like AudioFileStreamOpen and etc.
Is there any way to estimate a length of the stream? I know that I can get a 'elapsed' property using:

if(AudioQueueGetCurrentTime(queue.audioQueue, NULL, &t, &b) < 0)
        return 0;

    return t.mSampleTime / dataFormat.mSampleRate;

But what about total duration to create a progress bar? Is that possible?

© Stack Overflow or respective owner

Related posts about core-audio

Related posts about iphone-sdk