_CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer的未定义符号

时间:2012-05-22 19:57:15

标签: ios audio

我有这个代码,我试图用来捕获音频数据。但是编译器抱怨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];
}

错误:

  

架构armv7的未定义符号:
  “_CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer”,引用   从:          - [MicCommunicator captureOutput:didOutputSampleBuffer:fromConnection:] in   MicCommunicator.o ld:找不到架构armv7的符号   clang:错误:链接器命令失败,退出代码为1(使用-v查看   调用)

1 个答案:

答案 0 :(得分:5)

链接器未能找到符号表示包含该符号的库/框架未列为构建目标的依赖项。在Xcode中,选择目标,转到“Build Phases”,打开“Link Binary with Libraries”并添加CoreMedia。