Re: Problem seeking with AudioFileStreamSeek and AAC files
Re: Problem seeking with AudioFileStreamSeek and AAC files
- Subject: Re: Problem seeking with AudioFileStreamSeek and AAC files
- From: David L Zhao <email@hidden>
- Date: Wed, 1 Jul 2009 10:13:00 -0700
Anyone with similar experiences before or have used AudioFileStreamSeek successfully on AAC files?
Any gotchas I'm missing here? I really appreciate it.
On Mon, Jun 29, 2009 at 6:29 PM, David Zhao
<email@hidden> wrote:
Hello,
I've been banging my head against the wall for the last few hours on this. Either I'm doing something wrong, or AudioFileStreamSeek just doesn't work for AAC files. The following code works for seeking inside of an MP3 file, when I feed a AAC stream contained in an MP4 container, I get the error code: kAudioFileStreamError_DiscontinuityCantRecover after calling AudioFileStreamParseBytes.
Here's what the code roughly looks like:
AudioQueueStop( queueObject, YES );
UInt32 flags = 0;
OSStatus status = AudioFileStreamSeek( fileStreamID, framePacket.mPacket, ¤tOffset, &flags );
NSLog(@"Setting next byte offset to: %qi, flags: %d", (long long)currentOffset, flags);
// then read data from the new offset set by AudioFileStreamSeek
[fileHandle seekToFileOffset:currentOffset];
NSData * data = "" readDataOfLength:4096];
flags = kAudioFileStreamParseFlag_Discontinuity;
status = AudioFileStreamParseBytes( fileStreamID, [data length], [data bytes], flags );
if( status != noErr )
NSLog(@"Error parsing bytes: %d", status);
This works fine for MP3 files, but it always fails with kAudioFileStreamError_DiscontinuityCantRecover for AAC files. Looking at the documentation, it says:
"A discontinuity has occurred in the audio data, and Audio File Stream Services cannot recover."
Any insights? I'll buy beer for anyone that can provide a pointer :)
-David
_______________________________________________
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