Re: Slow seeking in MP3 files using ExtAudioFile
Re: Slow seeking in MP3 files using ExtAudioFile
- Subject: Re: Slow seeking in MP3 files using ExtAudioFile
- From: Hamish Allan <email@hidden>
- Date: Thu, 22 Jan 2009 19:53:05 +0000
On Tue, Jan 20, 2009 at 10:11 PM, Jeff Moore <email@hidden> wrote:
> MPEG-1/2 files do not have anything like a packet table or table of contents
> in them. So, to seek to a position in the middle of the file requires
> parsing the file from the beginning. Note that this is the case regardless
> of whether you are talking a VBR or CBR MP3 encoding. The reason why is that
> there are no rules about what you can stick between packets and there are
> apps that will put stuff there.
I've been trying to write code to allow for playback of and random
seeking within files that are still being downloaded (as per Quicktime
Player). On the assumption that AudioFile/ExtAudioFile will get
confused if the full data is not available from the outset, my
approach has been to use an AudioFileStream to read the first few
packets until the bitrate is reasonably stable, then use that to allow
skipping (simply jumping to a byte offset within the data and passing
kAudioFileStreamParseFlag_Discontinuity). This approximation has been
reasonable for my purposes, but presumably would get less accurate if
more metadata e.g. album artwork were present.
However, it seems that AudioFileStreamParseBytes() always outputs
exactly as many bytes as it is input, i.e., doesn't drop inaudible
frames such as ID3v2. (I guess that's handled by the AudioQueue?) So
what is the best way to build a table of contents translating seconds
into packet offsets? Do I have to examine the packets myself?
Or maybe there's something I'm missing, an easier way to do the whole
task? Any advice gratefully appreciated.
Thanks,
Hamish
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden