Unable to open certain file formats using AudioFileOpenWithCallbacks, kAudioFilePermissionsError returned
Unable to open certain file formats using AudioFileOpenWithCallbacks, kAudioFilePermissionsError returned
- Subject: Unable to open certain file formats using AudioFileOpenWithCallbacks, kAudioFilePermissionsError returned
- From: Michael Glover <email@hidden>
- Date: Thu, 8 Oct 2009 15:11:11 -0700
Hello,
We have been using the AudioFileOpenWithCallbacks function to retrieve an AudioFileId for playback data stored in memory using the iPhone SDK (currently using version 3.0, but we've also tried this with 3.1). This has worked well for MP3 track data up to this point. In an effort to switch over to using AAC we have been attempting to use the function to callback to AAC data in an mp4 container (ex: .mp4, .3gp2), but the resulting OSStatus is kAudioFilePermissionsError, which seems like an odd error to return from AFOWC given that data was in fact returned. We have been able to successfully retrieve an AudioFileId when opening MP3 and AAC ADTS files. Perhaps there is some manipulation that needs to be made with the mp4 data, as it has a container wrapping the AAC encoding? We have also tried several type hints (e.g. 0, kAudioFileMPEG4Type, kAudioFileM4AType, kAudioFile3GP2Type) with no success. The behavior is as follows:
1) Make the call to AudioFileOpenWithCallbacks:
OSStatus result = AudioFileOpenWithCallbacks (
self,
MyAudioFile_ReadProc,
MyAudioFile_WriteProc,
MyAudioFile_GetSizeProc,
MyAudioFile_SetSizeProc,
0, // Also tried kAudioFileMPEG4Type, kAudioFileM4AType, kAudioFile3GP2Type
&audioFileID
);
2) The callback MyAudioFile_ReadProc is then made, which returns the requested 8192 bytes:
static OSStatus MyAudioFile_ReadProc (
void *inClientData,
SInt64 inPosition,
UInt32 requestCount,
void *buffer,
UInt32 *actualCount) {
AudioPlayer *player = (AudioPlayer *) inClientData;
NSRange bufferRange = NSMakeRange(inPosition, requestCount);
[player.audioData getBytes: buffer range: bufferRange];
*actualCount = requestCount;
return 0;
}
3) Only the one call to MyAudioFile_ReadProc is made. No calls are made to the other callbacks. kAudioFilePermissionsError is returned as the OSStatus.
Any help would be greatly appreciated.
Thanks!
Michael
_______________________________________________
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