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 16:51:45 -0700
Neil, thanks for the pointer. Unfortunately we can't re-transcode everything to ADTS. It's surprising tho it would have a problem with MP4, but not ADTS.
Could any of the core audio engineers from Apple give us insight to this?
Thanks,
-David
On Wed, Jul 1, 2009 at 10:30 AM, Neil Mix
<email@hidden> wrote:
I had a similar problem a while back -- I was trying to begin playback of AAC/mp4 in the middle of a file. I futzed with having AudioFileStream parse the file header and then seek, but to no avail. Eventually I wrote up a bug, but we re-transcoded our audio to ADTS. While we don't do seeking (we just start in the middle), I'll make a wild guess that seeking would work with ADTS format (if you have the option of using it). -Neil
On Jul 1, 2009, at 12:13 PM, David L Zhao wrote:
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)
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