What are the required parameters for CMBufferQueueCreate?

Reading the documentation on the iOS SDK CMBufferQueueCreate, it says that a getDurationversion is needed, all other callbacks can be NULL.

By running the following code:

CFAllocatorRef allocator;
CMBufferCallbacks *callbacks;
callbacks = malloc(sizeof(CMBufferCallbacks));
callbacks->version = 0;
callbacks->getDuration = timeCallback;
callbacks->refcon = NULL;
callbacks->getDecodeTimeStamp = NULL;
callbacks->getPresentationTimeStamp = NULL;
callbacks->isDataReady = NULL;
callbacks->compare = NULL;
callbacks->dataBecameReadyNotification = NULL;

CMItemCount capacity = 4;

OSStatus s = CMBufferQueueCreate(allocator, capacity, callbacks, queue);

NSLog(@"QUEUE: %x", queue);
NSLog(@"STATUS: %i", s);

with timeCallback:

CMTime timeCallback(CMBufferRef buf, void *refcon){
    return CMTimeMake(1, 1);
}

and turn:

CMBufferQueueRef* queue;

failures to create the queue (queue = 0) and returns the status:

kCMBufferQueueError_RequiredParameterMissing = -12761,

The variable is callbackscorrectly initialized, at least the debugger talks about it.

Has anyone used CMBufferQueue?

+3
source share
1 answer

, . , CMBufferQueue.h . , CMBufferQueueRef *. , , OK.

CMBufferQueueRef queue;
CFAllocatorRef allocator = kCFAllocatorDefault;
CMBufferCallbacks *callbacks;
callbacks = malloc(sizeof(CMBufferCallbacks));
callbacks->version = 0;
callbacks->getDuration = timeCallback;
callbacks->refcon = NULL;
callbacks->getDecodeTimeStamp = NULL;
callbacks->getPresentationTimeStamp = NULL;
callbacks->isDataReady = NULL;
callbacks->compare = NULL;
callbacks->dataBecameReadyNotification = NULL;

CMItemCount capacity = 4;

OSStatus s = CMBufferQueueCreate(allocator, capacity, callbacks, &queue);

NSLog(@"QUEUE: %x", queue);
NSLog(@"STATUS: %i", s);

.

, , , - .

+1

Source: https://habr.com/ru/post/1785432/


All Articles