Re: Unable to open certain file formats using AudioFileOpenWithCallbacks, kAudioFilePermissionsError returned
Re: Unable to open certain file formats using AudioFileOpenWithCallbacks, kAudioFilePermissionsError returned
- Subject: Re: Unable to open certain file formats using AudioFileOpenWithCallbacks, kAudioFilePermissionsError returned
- From: Michael Glover <email@hidden>
- Date: Mon, 19 Oct 2009 09:20:15 -0700
Hi Bill, I tried removing the write and set size callbacks, and mp4 playback works! Unfortunately it did not occur to me to remove those callbacks originally as mp3 playback was functioning, thinking instead that each callback needed a value even if the callback didn't actually do anything. This is great news.
Thanks a lot for your help!
Cheers,
Michael
On Thu, Oct 8, 2009 at 7:01 PM, William Stewart
<email@hidden> wrote:
For MP4 files you can't open the file for writing. Because you are providing a Proc for writing (MyAudioFile_WriteProc), we think you are opening the file to write to it, and we will not allow that.
So, if you set this proc to NULL, it should be ok.
Bill
On Oct 8, 2009, at 3:11 PM, Michael Glover wrote:
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
_______________________________________________
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