|Type||Topic||Plugin||Version||macOS||Windows||Linux||Console & Web||iOS|
|class||AVFoundation||MBS AVFoundation Plugin||13.2||Yes||No||No||Yes, macOS only||No|
A CMSampleBuffer can contain a CMBlockBuffer of one or more media samples or a CVImageBuffer, a reference to the format description for the stream of CMSampleBuffers, size and timing information for each of the contained media samples, and both buffer-level and sample-level attachments. The buffer-level attachments of a CMSampleBuffer are distinct from the attachments of its contained CMBlockBuffer. An example of a sample-level attachment is an annotation about video frame dependencies (eg. "droppable", "other frames depend on me", "I depend on other frames", etc). Each sample (video frame) in the CMSampleBuffer would need its own attachment in this case. Another sample-level attachment example is SMPTE timecode acquired during capture. To get and set a CMSampleBuffer's buffer-level attachments, use the APIs in in CMAttachmentBearer.h (CMGetAttachment et al).
It is possible for a CMSampleBuffer to describe samples it does not yet contain. For example, some media services may have access to sample size, timing and format information before the data is read. Such services may create CMSampleBuffers with that information and insert them into queues early, and attach (or fill) the CMBlockBuffers of media data later, when the data becomes ready. To this end, CMSampleBuffers have the concept of data-readiness, which can be tested, set, forced to become ready "now", etc. It is also possible for a CMSampleBuffer to contain nothing but a special buffer-level attachment that describes a media stream event (eg. "discontinuity: drain and reset decoder before processing the next CMSampleBuffer"). Such a special attachment can also be attached to regular CMSampleBuffers (ie. that contain media sample data), and if so, the event it describes is defined to occur after the samples in that CMSampleBuffer.
The MBS Plugin implements a subset of what's available. If you need more, please do not hesitate to contact us.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.
- 15 properties
- property DataIsReady as boolean
- property DecodeTimeStamp as CMTimeMBS
- property Duration as CMTimeMBS
- property FormatDescription as CMFormatDescriptionMBS
- property Handle as Integer
- property ImageBuffer as CVImageBufferMBS
- property IsValid as boolean
- property Lasterror as Integer
- property NumberOfSamples as Integer
- property OutputDecodeTimeStamp as CMTimeMBS
- property OutputDuration as CMTimeMBS
- property OutputPresentationTimeStamp as CMTimeMBS
- property PresentationTimeStamp as CMTimeMBS
- property Text as String
- property TotalSampleSize as UInt64
- 7 methods
- 15 constants
An allocation failed.
Attempt was made to set a dataBuffer on a CMSampleBuffer that already has one.
Output array was not large enough for the array being requested.
Attempt to get sample size information when there was none.
Attempt to get sample timing information when there was none.
Buffer could not be made ready.
Sample buffer does not contain sample sizes. This can happen when the samples in the buffer are non-contiguous (eg. non-interleaved audio, where the channel values for a single sample are scattered through the buffer).
the sample buffer was invalidated.
Timing info or size array entry count was not 0, 1, or numSamples.
The format of the given media does not match the given format description (eg. a format description paired with a CVImageBuffer that fails CMVideoFormatDescriptionMatchesImageBuffer).
The media type specified by a format description is not valid for the given operation (eg. a CMSampleBuffer with a non-audio format description passed to GetAudioStreamPacketDescriptions).
Buffer contains bad data. Only returned by CMSampleBuffer functions that inspect its sample data.
Nil or 0 was passed for a required parameter.
Sample index was not between 0 and numSamples-1, inclusive.
Buffer unexpectedly contains a non-numeric sample timing info.
This class has no sub classes.
Some methods using this class:
- AVAssetReaderOutputMBS.NextSampleBuffer as CMSampleBufferMBS
- AVAssetWriterInputMBS.appendSampleBuffer(sampleBuffer as CMSampleBufferMBS) as boolean
- AVCaptureStillImageOutputMBS.jpegStillImageNSDataRepresentation(jpegSampleBuffer as CMSampleBufferMBS) as memoryblock
- AVSampleBufferDisplayLayerMBS.enqueueSampleBuffer(sampleBuffer as CMSampleBufferMBS)
Some events for this class:
- AVFoundationMBS.captureOutputDidDropSampleBuffer(captureOutput as AVCaptureOutputMBS, OutputSampleBuffer as CMSampleBufferMBS, connection as AVCaptureConnectionMBS)
- AVFoundationMBS.captureOutputDidOutputSampleBuffer(captureOutput as AVCaptureOutputMBS, OutputSampleBuffer as CMSampleBufferMBS, connection as AVCaptureConnectionMBS)
- AVFoundationMBS.captureStillImageAsynchronouslyCompleted(CaptureStillImageOutput as AVCaptureStillImageOutputMBS, prepareJpegStillImage as boolean, tag as Variant, error as NSErrorMBS, imageDataSampleBuffer as CMSampleBufferMBS, JpegStillImage as memoryblock)
- AVFoundationMBS.legibleOutputDidOutputAttributedStrings(output as AVPlayerItemLegibleOutputMBS, strings() as Variant, nativeSamples() as CMSampleBufferMBS, itemTime as CMTimeMBS)
- AVFoundationMBS.requestMediaDataWhenReadyOnQueueProgress(assetWriterInput as AVAssetWriterInputMBS, assetReaderOutput as AVAssetReaderOutputMBS, convertedByteCount as Int64, LastBuffer as CMSampleBufferMBS, tag as Variant)
Some examples which use this class:
- /AVFoundation/Extract video frames
- /AVFoundation/Screen Input
- /AVFoundation/Still Photos
The items on this page are in the following plugins: MBS AVFoundation Plugin.
MBS Xojo tutorial videos