FW: ExtAudioFileSetProperty( kExtAudioFileProperty_FileDataFormat ) returns error 1718449215
FW: ExtAudioFileSetProperty( kExtAudioFileProperty_FileDataFormat ) returns error 1718449215
- Subject: FW: ExtAudioFileSetProperty( kExtAudioFileProperty_FileDataFormat ) returns error 1718449215
- From: "Andrew E. Davidson" <email@hidden>
- Date: Wed, 5 Aug 2009 15:07:53 -0700
Sorry for the repost, The formatting on my original post got scrambled
Hi
I am trying to use ExtAudioFile to convert a PCM file I create on the iPhone
using AudioQueues into a compressed format ( aac)
Here is the high level structure of my code
1. Open input file
2. get AudioStreamBasicDescription from input file
3. cp inputASBD to outputASBD
4. outputASBD mFormatID = kAudioFormatMPEG4AAC;
5. get the audio channel layout
6. create output file with type kAudioFileM4AType
7. set kExtAudioFileProperty_ClientDataFormat
8. for() { read; write;}
for some unknown reason I keep getting a 1718449215 error when I try to set
kExtAudioFileProperty_ClientDataFormat. I believe this is a 'format error'
Could the problem be with the way I set up the recording format? I set the
recording up this way because I need 16 int PCM.
here is how I set up the audio format when I made the recording
audioFormat.mSampleRate = self.hardwareSampleRate / 4.0;
audioFormat.mFormatID = kAudioFormatLinearPCM;
audioFormat.mChannelsPerFrame = 1;
audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger |
kAudioFormatFlagIsPacked;
audioFormat.mFramesPerPacket = 1;
audioFormat.mBitsPerChannel = 16;
audioFormat.mBytesPerPacket = 2;
audioFormat.mBytesPerFrame = 2;
// open input file
err = ExtAudioFileOpenURL ( inputURL, &audioSourceFile);
// get the input file format
err = ExtAudioFileGetProperty ( audioSourceFile,
kExtAudioFileProperty_FileDataFormat, &sizeOfFormatASBDStruct
&audioSourceFormat );
//Copy the inputFormat to outputFormat
.
outputFormat.mFormatID = kAudioFormatMPEG4AAC;
// get the channel layout and create the output file
AudioChannelLayout *acl = NULL;
ExtAudioFileGetProperty( audioSourceFile,
kExtAudioFileProperty_FileChannelLayout, &size, acl );
ExtAudioFileCreateWithURL(outURL, kAudioFileM4AType, &outputFormat, acl,
kAudioFileFlags_EraseFile, &outputFile);
ExtAudioFileSetProperty( outputFile,
kExtAudioFileProperty_ClientDataFormat, sizeOfFormatASBDStruct,
&audioSourceFormat );
Any idea what I am doing wrong? I get the same error when I try to convert
PCM to mp3
Thanks
Andy
_______________________________________________
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