0

是否有此功能(适用于 iOS 核心音频)CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer的综合文档/教程?在网上找不到任何东西,堆栈溢出的示例还有很多不足之处。

4

1 回答 1

4

在与 CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer 合作数月后,我了解到,虽然很难找到专门关于上述功能的帖子或链接,但在 iOS 中找到关于音频一般主题的大量资源也很容易,其中最主要的是书学习核心音频..

深入iOS核心音频的密集概念需要时间,并且需要大量练习..一旦事情深入..上述方法将成为更大工具箱中的简单工具..及其所有参数和使用将具有直观意义

也是一种快速了解参数和函数在上面的确切作用的方法。只需转到头文件中提供的文档(即在 XCode 中,突出显示方法并右键单击 - > 跳转到定义).. 你'将在CMSampleBuffer.h中看到这一点(但如果您不熟悉核心音频.. 如果您查看所有这些参数并且只了解其中的 10%,请不要感到沮丧.. 它发生在我们所有人身上,它需要时间):

/*!
    @function   CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer
    @abstract   Creates an AudioBufferList containing the data from the CMSampleBuffer,
                and a CMBlockBuffer which references (and manages the lifetime of) the
                data in that AudioBufferList.  The data may or may not be copied,
                depending on the contiguity and 16-byte alignment of the CMSampleBuffer's
                data. The buffers placed in the AudioBufferList are guaranteed to be contiguous.
                The buffers in the AudioBufferList will be 16-byte-aligned if
                kCMSampleBufferFlag_AudioBufferList_Assure16ByteAlignment is passed in.
*/
CM_EXPORT
OSStatus CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(
    CMSampleBufferRef sbuf,             /*! @param sbuf
                                        CMSampleBuffer being accessed. */
    size_t *bufferListSizeNeededOut,    /*! @param bufferListSizeNeededOut
                                        Receives the size of the AudioBufferList required to
                                        accommodate the data. May be NULL. */
    AudioBufferList *bufferListOut,     /*! @param bufferListOut
                                        Allocated by the caller, sized as specified by bufferListSizeNeededOut.
                                        It is filled in with pointers into the retained blockBufferOut.
                                        May be NULL. */
    size_t bufferListSize,              /*! @param bufferListSize
                                        Size of the bufferListOut allocated by the client. If bufferListOut
                                        is not NULL and bufferListSize is insufficient, kFigSampleBufferError_ArrayTooSmall
                                        is returned. */ 
    CFAllocatorRef bbufStructAllocator, /*! @param bbufStructAllocator
                                        Allocator to use when creating the CMBlockBuffer structure. */
    CFAllocatorRef bbufMemoryAllocator, /*! @param bbufMemoryAllocator
                                        Allocator to use for memory block held by the CMBlockBuffer. */
    uint32_t flags,                     /*! @param flags
                                        Flags controlling operation. */
    CMBlockBufferRef *blockBufferOut)   /*! @param blockBufferOut
                                        The retained CMBlockBuffer. */
                            __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
于 2012-11-23T07:57:30.103 回答