One Logo Pool Ball
CoreMedia · IOS API REFERENCE

CMBufferQueue

class · iOS 4.0+ · SDK 27.1

class CMBufferQueue

Members (26)

init · iOS 4.0+

init

TypeScript
static init(object: CMBufferQueue): CMBufferQueue
Swift declaration
init(referencing object: CMBufferQueue)
get · iOS 13.0+

bufferCount

TypeScript
get bufferCount(): number
Swift declaration
var bufferCount: CMItemCount { get }

Gets the number of buffers in the queue.

method · iOS 13.0+

testTrigger

TypeScript
testTrigger(triggerToken: SDKHandle): boolean
Swift declaration
func testTrigger(_ triggerToken: CMBufferQueue.TriggerToken) -> Bool

Tests whether the trigger condition is true. Whereas the trigger callback will only be called when the condition goes from `false` to `true`, `testTrigger` always returns the condition's current status. The `triggerToken` must be one that has been installed on this queue. - Parameter triggerToken: Trigger to test.

get · iOS 13.0+

isAtEndOfData

TypeScript
get isAtEndOfData(): boolean
Swift declaration
var isAtEndOfData: Bool { get }

Returns whether or not the `CMBufferQueue` has been marked with EOD, and is now empty.

method · iOS 13.0+

markEndOfData

TypeScript
markEndOfData(): void
Swift declaration
func markEndOfData() throws

Marks the `CMBufferQueue` with EOD. All subsequent enqueues will be rejected until `reset()` is called. Subsequent dequeues will succeed as long as the queue is not empty.

method · iOS 13.0+

removeTrigger

TypeScript
removeTrigger(triggerToken: SDKHandle): void
Swift declaration
func removeTrigger(_ triggerToken: CMBufferQueue.TriggerToken) throws

Removes a previously installed trigger. Triggers will automatically be removed when a queue is finalized. However, if more than one module has access to a queue, it may be hard for an individual module to know when the queue is finalized since other modules may retain it. To address this concern, modules should remove their triggers before they themselves are finalized. - Parameter triggerToken: Trigger to remove from the queue

method · iOS 13.0+

installTrigger

TypeScript
installTrigger(condition: CMBufferQueue_TriggerCondition, body?: (((arg0: SDKHandle) => void)) | null): SDKHandle
Swift declaration
func installTrigger(condition: CMBufferQueue.TriggerCondition, _ body: CMBufferQueueTriggerHandler? = nil) throws -> CMBufferQueue.TriggerToken

Installs a trigger. The returned trigger token can be passed to `testTrigger` and `removeTrigger`. The returned trigger can be discarded (client doesn't need to test or remove trigger), and the body parameter can be `nil` (client doesn't need callbacks, but rather will explicitly test the trigger). One of these two parameters must be non-`nil`, however, since an untestable trigger that does not perform a callback is meaningless. If the trigger condition is already true, `installTrigger` will call the `body`. - Parameters: - condition: The condition to be tested when evaluating the trigger. - body: Closure to be called when the trigger condition becomes true. Can be `nil`, if client intends only to explicitly test the condition. - Returns: Trigger token which can be used with `testTrigger` and `removeTrigger`. Can be discarded if client has no need to explicitly test or remove the trigger.

get · iOS 13.0+

containsEndOfData

TypeScript
get containsEndOfData(): boolean
Swift declaration
var containsEndOfData: Bool { get }

Returns whether or not the `CMBufferQueue` has been marked with EOD.

method · iOS 13.0+

dequeueIfDataReady

TypeScript
dequeueIfDataReady(): (unknown) | null
Swift declaration
func dequeueIfDataReady() -> CMBuffer?

Dequeues a buffer if it is ready. - Returns: The dequeued buffer. Will be `nil` if the queue is empty, or if the buffer to be dequeued is not yet ready.

get · iOS 13.0+

minDecodeTimeStamp

TypeScript
get minDecodeTimeStamp(): CMTime
Swift declaration
var minDecodeTimeStamp: CMTime { get }

Gets the earliest decode timestamp. The search for earliest decode timstamp is performed in this API. If you know your queue is in decode order, `firstDecodeTimeStamp` is a faster alternative. If the `getDecodeTimeStamp` handler is `nil`, `CMTime.invalid` will be returned.

get · iOS 13.0+

firstDecodeTimeStamp

TypeScript
get firstDecodeTimeStamp(): CMTime
Swift declaration
var firstDecodeTimeStamp: CMTime { get }

Gets the decode timestamp of the first buffer. This API is is a faster alternative to `minDecodeTimeStamp`, but only gives the same answer if your queue is in decode order. If the `getDecodeTimeStamp` handler is `nil`, `CMTime.invalid` will be returned.

method · iOS 13.0+

setValidationHandler

TypeScript
setValidationHandler(body: ((arg0: CMBufferQueue, arg1: unknown) => void)): void
Swift declaration
func setValidationHandler(_ body: @escaping (CMBufferQueue, CMBuffer) throws -> Void)

Sets a function that `enqueue` will call to validate buffers before adding them. `enqueue` will call this closure to validate buffers. Throw an error code if the buffer should be rejected; `enqueue` will throw this error to the caller. If you do not have a more descriptive error code, use `Error.invalidBuffer`. - Parameter body: Closure that will validate each buffer enqueued.

get · iOS 13.0+

endPresentationTimeStamp

TypeScript
get endPresentationTimeStamp(): CMTime
Swift declaration
var endPresentationTimeStamp: CMTime { get }

Gets the greatest end presentation timestamp. This is the maximum end time (PTS + duration) of buffers in the queue. If the `getPresentationTimeStamp` handler is `nil`, `CMTime.invalid` will be returned.

get · iOS 13.0+

maxPresentationTimeStamp

TypeScript
get maxPresentationTimeStamp(): CMTime
Swift declaration
var maxPresentationTimeStamp: CMTime { get }

Gets the greatest presentation timestamp. If the `getPresentationTimeStamp` handler is `nil`, `CMTime.invalid` will be returned.

get · iOS 13.0+

minPresentationTimeStamp

TypeScript
get minPresentationTimeStamp(): CMTime
Swift declaration
var minPresentationTimeStamp: CMTime { get }

Gets the earliest presentation timestamp. The search for earliest presentation timstamp is performed in this API. If you know your queue is sorted by presentation time, `firstPresentationTimeStamp` is a faster alternative. If the `getPresentationTimeStamp` handler is `nil`, `CMTime.invalid` will be returned.

get · iOS 13.0+

firstPresentationTimeStamp

TypeScript
get firstPresentationTimeStamp(): CMTime
Swift declaration
var firstPresentationTimeStamp: CMTime { get }

Gets the presentation timestamp of the first buffer. This API is is a faster alternative to `minPresentationTimeStamp`, but only works if you know your queue is sorted by presentation timestamp. If the `getPresentationTimeStamp` handler is `nil`, `CMTime.invalid` will be returned.

get · iOS 13.0+

head

TypeScript
get head(): (unknown) | null
Swift declaration
var head: CMBuffer? { get }

Retrieves the next-to-dequeue buffer but leaves it in the queue. Note that with non-FIFO queues it's not guaranteed that the next dequeue will return this particular buffer (if an intervening enqueue adds a buffer that will dequeue next).

method · iOS 13.0+

reset

TypeScript
reset(): void
Swift declaration
func reset() throws

Resets the `CMBufferQueue`. Empties the queue, and clears any EOD mark. All buffers in the queue are released. Triggers are not removed, however, and will be called appropriately as the queue duration goes to `.zero`.

method · iOS 13.0+

reset

TypeScript
reset64918(body: ((arg0: unknown) => void)): void
Swift declaration
func reset(_ body: (CMBuffer) throws -> ()) throws

Calls a closure for every buffer in the queue, then resets the queue. - Parameter body: Closure to be called for each buffer. The closure should not make other calls to the buffer queue.

get · iOS 13.0+

typeID

TypeScript
static get typeID(): number
Swift declaration
class var typeID: CFTypeID { get }

The `CFTypeID` corresponding to `CMBufferQueue`.

get · iOS 13.0+

buffers

TypeScript
get buffers(): CMBufferQueue_Buffers
Swift declaration
var buffers: CMBufferQueue.Buffers { get }

Accesses buffers in a `CMBufferQueue`.

method · iOS 13.0+

dequeue

TypeScript
dequeue(): (unknown) | null
Swift declaration
func dequeue() -> CMBuffer?

Dequeues a buffer. - Returns: The dequeued buffer. Will be `nil` if the queue is empty.

method · iOS 13.0+

enqueue

TypeScript
enqueue(buffer: unknown): void
Swift declaration
func enqueue(_ buffer: CMBuffer) throws

Enqueues a buffer. The `buffer` is retained by the queue, so the client can safely release the buffer if it has no further use for it. If the compare handler is not `nil`, this API performs an insertion sort using that compare operation. If the validation handler is not `nil`, this API calls it; if it throws, the buffer will not be enqueued and this API will rethrow the error. - Parameter buffer: The buffer to enqueue.

get · iOS 13.0+

isEmpty

TypeScript
get isEmpty(): boolean
Swift declaration
var isEmpty: Bool { get }

Returns whether or not the `CMBufferQueue` is empty.

get · iOS 13.0+

duration

TypeScript
get duration(): CMTime
Swift declaration
var duration: CMTime { get }

Gets the duration. The duration of the `CMBufferQueue` is the sum of all the individual buffer durations, as reported by the `getDuration` handler. If there are no buffers in the queue, `CMTime.zero` will be returned.

get · iOS 13.0+

totalSize

TypeScript
get totalSize(): number
Swift declaration
var totalSize: Int { get }

Gets the total size. The total size of the `CMBufferQueue` is the sum of all the individual buffer sizes, as reported by the `getTotalSize` handler. If there are no buffers in the queue, `0` will be returned.

Skipped declarations

No declarations were skipped in this snapshot.

All CoreMedia types →