I have this code that im trying to use to capture audio data. However the compiler is complaining about CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer
-(void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
AudioBufferList audioBufferList;
NSMutableData *data= [[NSMutableData alloc] init];
CMBlockBufferRef blockBuffer;
CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(sampleBuffer, NULL, &audioBufferList, sizeof(audioBufferList), NULL, NULL, 0, &blockBuffer);
for (int y = 0; y < audioBufferList.mNumberBuffers; y++) {
AudioBuffer audioBuffer = audioBufferList.mBuffers[y];
Float32 *frame = (Float32*)audioBuffer.mData;
[data appendBytes:frame length:audioBuffer.mDataByteSize];
}
CFRelease(blockBuffer);
blockBuffer=NULL;
[data release];
}
error:
Undefined symbols for architecture armv7:
“_CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer”, referenced
from:
-[MicCommunicator captureOutput:didOutputSampleBuffer:fromConnection:] in
MicCommunicator.o ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
The linker failing to find a symbol indicates that the library/framework containing that symbol is not listed as a dependency of your build target. In Xcode, select your target, go to ‘Build Phases’, open ‘Link Binary with Libraries’ and add CoreMedia.