Trait AVAssetWriterDelegate

Source
pub unsafe trait AVAssetWriterDelegate: NSObjectProtocol {
    // Provided methods
    unsafe fn assetWriter_didOutputSegmentData_segmentType_segmentReport(
        &self,
        writer: &AVAssetWriter,
        segment_data: &NSData,
        segment_type: AVAssetSegmentType,
        segment_report: Option<&AVAssetSegmentReport>,
    )
       where Self: Sized + Message { ... }
    unsafe fn assetWriter_didOutputSegmentData_segmentType(
        &self,
        writer: &AVAssetWriter,
        segment_data: &NSData,
        segment_type: AVAssetSegmentType,
    )
       where Self: Sized + Message { ... }
}
Available on crate feature AVAssetWriter only.
Expand description

Provided Methods§

Source

unsafe fn assetWriter_didOutputSegmentData_segmentType_segmentReport( &self, writer: &AVAssetWriter, segment_data: &NSData, segment_type: AVAssetSegmentType, segment_report: Option<&AVAssetSegmentReport>, )
where Self: Sized + Message,

Available on crate feature AVAssetSegmentReport only.

A method invoked when a segment data is output.

Parameter writer: An AVAssetWriter instance.

Parameter segmentData: An instance of NSData containing a segment data.

Parameter segmentType: A segment type of the segment data. Segment types are declared in AVAssetSegmentReport.h.

Parameter segmentReport: An AVAssetSegmentReport instance.

If this method is implemented, normal file writing will be suppressed. The instance of AVAssetWriter must be initialized by -initWithContentType: initializer. Then, clients append media data to AVAssetWriterInputs added to the receiver, call -markAsFinished for each input to mark the input as finished and call -finishWritingWithCompletionHandler: to finish writing as is the case in normal file writing.

Do not use the movieFragmentInterval or shouldOptimizeForNetworkUse properties, as these properties are ignored in this mode of operation.

Clients that need to reference the NSData outside of the scope of this method must retain or copy it and then release it when they are finished with it.

The segmentReport provides information on the segment data. If there is no information available to report, the segmentReport may be nil. Clients that do not need information on consecutive segment data should implement the -assetWriter:didOutputSegmentData:segmentType: method instead of this one for greater efficiency, as this will signal the receiver to skip the preparation of segment reports. See more detailed description of AVAssetSegmentReport in AVAssetSegmentReport.h.

If the file type is AVFileTypeMPEG4 and the outputFileTypeProfile is AVFileTypeProfileMPEG4AppleHLS or AVFileTypeProfileMPEG4CMAFCompliant, when the segmentType is AVAssetSegmentTypeInitialization, the segment contains a ‘moov’ atom that does not contain any sample tables other than the sample descriptions, and is suitable for use as an initialization segment for the following segment data sequences. When the segmentType is AVAssetSegmentTypeSeparable, the segment contains a ‘moof’ atom that contains one ‘moof’ atom followed by one ‘mdat’ atom.

  1. If the value of preferredOutputSegmentInterval property is positive numeric, when (a sample’s output PTS - InitialSegmentStartTime) >= (interval * N) (N = 1, 2, 3…), the receiver waits for next sync sample and outputs a segment data that includes all samples appended since the previous interval to the delegate method when the sync sample appears, so that the next segment can start with the sync sample. In this configuration, passthrough (by passing nil to output settings for AVAssetWriterInputs) and compression are available. The media type of input can be AVMediaTypeVideo or AVMediaTypeAudio. Only one input of each media type can be added for compression and when (a sample’s PTS - InitialSegmentStartTime) >= (interval * N) (N = 1, 2, 3…), the sample will be forced to be encoded as sync sample so that the current segment will be closed immediately. For passthrough, only one input can be added.

  2. If the value of preferredOutputSegmentInterval property is kCMTimeIndefinite, every time a client calls -flushSegment the receiver outputs a segment data that includes all samples appended since the previous call to the delegate method. The delegate method may be called asynchronously, on a different thread from the one that calls -flushSegment. In this configuration, only passthrough is available. The media type of input can be AVMediaTypeVideo or AVMediaTypeAudio. Only one input of each media type can be added. The client should call -flushSegment prior to a sync sample so that the next segment can start with the sync sample. Otherwise, it is an error.

Source

unsafe fn assetWriter_didOutputSegmentData_segmentType( &self, writer: &AVAssetWriter, segment_data: &NSData, segment_type: AVAssetSegmentType, )
where Self: Sized + Message,

Available on crate feature AVAssetSegmentReport only.

A method invoked when a segment data is output.

Parameter writer: An AVAssetWriter instance.

Parameter segmentData: An instance of NSData containing a segment data.

Parameter segmentType: A segment type of the segment data. Segment types are declared in AVAssetSegmentReport.h.

The usage of this method is same as -assetWriter:didOutputSegmentData:segmentType:segmentReport: except that this method does not deliver AVAssetSegmentReport.

If clients implement the -assetWriter:didOutputSegmentData:segmentType:segmentReport: method, that method is called instead of this one.

Trait Implementations§

Source§

impl ProtocolType for dyn AVAssetWriterDelegate

Source§

const NAME: &'static str = "AVAssetWriterDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn AVAssetWriterDelegate

Implementations on Foreign Types§

Source§

impl<T> AVAssetWriterDelegate for ProtocolObject<T>

Implementors§