Simple Question on m4a CAStreamBasicDescription and Recording
Simple Question on m4a CAStreamBasicDescription and Recording
- Subject: Simple Question on m4a CAStreamBasicDescription and Recording
- From: Jaime Magiera <email@hidden>
- Date: Thu, 25 Oct 2007 17:24:16 -0400
Hello folks,
Pardon the simple question, it's been nearly 5 years since doing any
audio programming.
I inherited some code that uses MTCoreAudio.framework and am now
attempting to move off that and use plain vanilla CoreAudio. The
project is off to a bumpy start. I can't even get a basic m4a :) I've
looked at all the examples on the web, taken a look at MTCoreAudio,
reverse engineered afrecord. The CAStreamBasicDescription might be
incorrect. However, the code works for other formats. If I use
kAudioFormatLinearPCM and kAudioFileAIFFType, everything is fine.
Can someone point out the likely obvious flaw below? Thanks for any
help.
Jaime
[self setTempFileRecordingPath:
[@"/" stringByAppendingPathComponent:
[@"test" stringByAppendingString:
[[[NSNumber numberWithDouble: [[NSDate date]
timeIntervalSince1970]] stringValue] stringByAppendingPathExtension:
@"m4a"]]]];
BOOL testResult;
testResult = CFURLGetFSRef((CFURLRef)[NSURL fileURLWithPath:
[[self tempFileRecordingPath] stringByDeletingLastPathComponent]],
&parentDir);
NSLog(@"The result of the creation %d", testResult);
CAStreamBasicDescription dataFormat;
dataFormat.mSampleRate = 44100;
dataFormat.mFormatID = kAudioFormatMPEG4AAC;
dataFormat.mFormatFlags = kAudioFormatFlagIsBigEndian |
kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
dataFormat.mFramesPerPacket = 1;
dataFormat.mChannelsPerFrame = 2;
dataFormat.mBitsPerChannel = 16;
dataFormat.mBytesPerPacket = dataFormat.mBytesPerFrame = 4;
[self audioFileRecorder]->SetFile(parentDir,
(CFStringRef) [[self
tempFileRecordingPath] lastPathComponent],
kAudioFileM4AType,
dataFormat,
NULL);
Errors:
This causes the app to crash hard with "Exec_Bad_Access". GDB shows
"MP4AudioFile:GetNumBytes"
File was created though...
2007-10-25 17:13:10.441 MyApp[22942:813] The result of the creation 1
_______________________________________________
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