3
Reading the documentation關於iOS SDK CMBufferQueueCreate
,它說getDuration
和版本都是必需的,所有其他回調都可以是NULL。CMBufferQueueCreate需要什麼參數?
但運行下面的代碼:
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);
與timeCallback:
CMTime timeCallback(CMBufferRef buf, void *refcon){
return CMTimeMake(1, 1);
}
和隊列是:
CMBufferQueueRef* queue;
隊列創作失敗(隊列= 0),並返回一個狀態作者:
kCMBufferQueueError_RequiredParameterMissing = -12761,
callbacks
變量被正確初始化,至少調試器是這樣說的。
有沒有人使用過CMBufferQueue
?