Re: AudioFileStream not returning PacketSizeUpperBound
Re: AudioFileStream not returning PacketSizeUpperBound
- Subject: Re: AudioFileStream not returning PacketSizeUpperBound
- From: William Stewart <email@hidden>
- Date: Fri, 15 Feb 2008 19:02:06 -0800
There's a couple of problems here.
(1) the property really isn't implemented, so the return result is
correct.
However,
(2) For MP3 you would get an error in any case. We can't determine the
file's packet size upper bound because MP3 is a self-framing file
format. For CAF or MP4 files though we could though, because the files
have packet tables. But there's an added complexity here of course
because we'd never tell you that we didn't have the property to not
give you :)
So, we'll need to work something out here.
For what you need to know, the AudioFormat API is in any case the
right place to get this information. It has an upper bound packet size
property for any given format. We added the file version of this
because for all of the VBR formats this theoretical bound is very
conservative, and many files do know the max size in them...
Bill
On Feb 15, 2008, at 3:46 PM, Jens Alfke wrote:
I'm now using AudioFileStream to feed incoming streamed MP3 audio
into an AudioQueue. But I'm running into a problem: the
kAudioFileStreamProperty_PacketSizeUpperBound* isn't available. It
doesn't get reported to my property callback, and if I try to get
the property value after I get the 'redy' property, I get back an
error -4 (which is not one of the errors listed in the header file;
MacErrors.h says it's 'unimpErr'.)
However, if I read the _exact same file_ using the regular AudioFile
API, the corresponding property
(kAudioFilePropertyPacketSizeUpperBound) does exist and has a
reasonable value (1448).
This is causing trouble for me because my AudioQueue code (based on
aqplay.cpp) uses the max packet size to help derive the buffer size
to use ... when streaming, it ends up dividing by zero and crashing.
Any ideas? I can hardcode a value to use if the property's missing,
but that's a kludge, and this kind of looks like a bug in the
framework.
—Jens
* Note that I don't mean kAudioFileStreamProperty_MaximumPacketSize.
In other words, I'm asking for the "theoretical maximum packet size"
for the file format, not the actual largest packet in the file
(which a streaming API wouldn't know until it finished reading the
whole file.) _______________________________________________
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