An object that defines an interface for reading sample references from a single asset track.


class AVAssetReaderSampleReferenceOutput : AVAssetReaderOutput


AVAssetReaderSampleReferenceOutput is a concrete subclass AVAssetReaderOutput. The sample reference is from a single AVAssetTrack of an AVAsset instance contained in an AVAssetReader object.

Clients can extract information about the location of samples in a track—the file URL and offset—by adding an instance of this class to an AVAssetReader object using the add(_:). The kCMSampleBufferAttachmentKey_SampleReferenceURL and kCMSampleBufferAttachmentKey_SampleReferenceByteOffset attachments on the extracted sample buffers describe the location of the sample data. Find more information about sample buffers describing sample references in the CMSampleBuffer.

You can also append sample buffers extracted using this class to an AVAssetWriterInput instance to create movie tracks that are not self-contained and reference data in the original file instead. To write tracks that are not self-contained, use instances of AVAssetWriter configured to write files of type mov.

Since you can't extract sample data and return it by instances of AVAssetReaderSampleReferenceOutput, ignore the value of the alwaysCopiesSampleData property.


Creating Sample Reference Output Instances

init(track: AVAssetTrack)

Creates a newly allocated sample reference output object for supplying sample references.

Getting the Track

var track: AVAssetTrack

The track from which the sample references are extracted.


Inherits From

Conforms To

See Also

File Import

class AVAssetReader

A reader object used to obtain the media data of an asset, either file-based or consisting of an assemblage of media data from multiple sources.

class AVAssetReaderAudioMixOutput

An object that defines an interface for reading audio samples that result from mixing the audio from one or more tracks.

class AVAssetReaderTrackOutput

An object that defines an interface for reading media data from a single track of an asset reader's asset.

class AVAssetReaderVideoCompositionOutput

An object that reads video frames composited from the frames in one or more tracks of a reader's assets.

class AVAssetReaderOutput

An abstract class that defines an interface for reading a single collection of samples of a common media type from an asset reader object.

class AVAssetReaderOutputMetadataAdaptor

An object that defines an interface for reading metadata.

class AVAssetImageGenerator

An object that provides thumbnail or preview images of assets independently of playback.