Problem seeking with AudioFileStreamSeek and AAC files
Problem seeking with AudioFileStreamSeek and AAC files
- Subject: Problem seeking with AudioFileStreamSeek and AAC files
- From: David Zhao <email@hidden>
- Date: Mon, 29 Jun 2009 18:29:43 -0700
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 = [fileHandle 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