2

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)

owen gerig
  • 6,165
  • 6
  • 52
  • 91
  • is there a reason why you are appending the frames into a single piece of data? The reason I ask is that I'm using the same function CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer to grab data and send it over a network to be read by an AudioQueue.. but for some reason it's arriving all garbeled and stuff.. and I don't think it's an ABSD formatting issue as I'm using standard lPCM for both the sender and the receiver.. – abbood Sep 03 '12 at 12:29
  • @www.fossfactory.org yes. The httpclient I was using for sending took NSData/NSMutableData as an argument. So it was easiest for me to use that as a container. any time I had garbled audio was because it was using the wrong format (not ulaw). But my setup was different. – owen gerig Sep 04 '12 at 13:24
  • I know this is kinda of a cop out, but i've spent over a week fiddling with the formatting (and everything else) but no results.. check out the code in this question (do you see anything wrong with the formatting?) i simply use PCM formatting in and out: http://stackoverflow.com/questions/12264799/why-is-audio-coming-up-garbled-when-using-avassetreader-with-audio-queue – abbood Sep 04 '12 at 13:45
  • @www.fossfactory.org i will check it out when i have time. one thing that eventually helped me (worked on this problem for months) was that Apple offers developers support. You get 2 free with your subscription. I never knew about the dev support and so i thought maybe you didnt as well. – owen gerig Sep 04 '12 at 15:54

1 Answers1

5

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.

GoZoner
  • 67,920
  • 20
  • 95
  • 145
  • i swear to you i looked for coremedia after seeing this(http://disanji.net/iOS_Doc/#documentation/CoreMedia/Reference/CMSampleBuffer/Reference/reference.html) and it wasnt there. but i looked again after you said this and found it. so idk wtf happen, but thanks – owen gerig May 22 '12 at 20:07