Instructs the receiver to invoke a block repeatedly, at its convenience, to gather media data for writing to the output.
- iOS 4.1+
- macOS 10.7+
- Mac Catalyst 13.0+
- tvOS 9.0+
The queue on which
blockshould be invoked.
The block the input should invoke to obtain media data.
The block should append media data to the input either until the input’s
ready property becomes
NO or until there is no more media data to supply (at which point it may choose to mark the input as finished using
mark). The block should then exit. After the block exits, if the input has not been marked as finished, once the input has processed the media data it has received and becomes ready for more media data again, it will invoke the block again in order to obtain more.
A typical use of this method, with a block that supplies media data to an input while respecting the input’s
ready property, might look like this:
You should not use this method with a push-style buffer source, such as
AVCapture, because such a combination will typically require intermediate queueing of buffers. Instead, this method is better suited to a pull-style buffer source such as an
When using a push-style buffer source, it is generally better to immediately append each buffer to the asset writer input, directly as it is received using
append. Using this strategy, it is often possible to avoid having to queue up buffers in between the buffer source and the asset writer input. Note that many of these push-style buffer sources also produce buffers in real-time, in which case you should set