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: William Stewart <email@hidden>
- Date: Thu, 22 Jan 2009 14:06:44 -0800
We return the same buffer to you whenever we can - this avoids a copy.
You need to look at the packet descriptions that come back with that
buffer - those tell you where the actual audio data is, so if the
buffer you provided us has an ID3 tag in it, you'll see that skipped
in the way the packet descriptions are laid out
On Jan 22, 2009, at 11:53 AM, Hamish Allan wrote:
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
_______________________________________________
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