//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-media")]
use objc2_core_media::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcompositiontrack?language=objc)
#[unsafe(super(AVAssetTrack, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "AVAssetTrack")]
pub struct AVCompositionTrack;
);
#[cfg(all(feature = "AVAssetTrack", feature = "AVAsynchronousKeyValueLoading"))]
extern_conformance!(
unsafe impl AVAsynchronousKeyValueLoading for AVCompositionTrack {}
);
#[cfg(feature = "AVAssetTrack")]
extern_conformance!(
unsafe impl NSCopying for AVCompositionTrack {}
);
#[cfg(feature = "AVAssetTrack")]
unsafe impl CopyingHelper for AVCompositionTrack {
type Result = Self;
}
#[cfg(feature = "AVAssetTrack")]
extern_conformance!(
unsafe impl NSObjectProtocol for AVCompositionTrack {}
);
#[cfg(feature = "AVAssetTrack")]
impl AVCompositionTrack {
extern_methods!(
#[cfg(all(feature = "AVAssetTrackSegment", feature = "AVCompositionTrackSegment"))]
/// Provides read-only access to the array of track segments, each an instance of AVCompositionTrackSegment.
///
/// Note that timeMapping.target.start of the first AVCompositionTrackSegment must be kCMTimeZero, and the timeMapping.target.start of each subsequent AVCompositionTrackSegment must equal CMTimeRangeGetEnd(the previous AVCompositionTrackSegment's timeMapping.target).
/// Use -validateTrackSegments:error: to perform a test to ensure that an array of AVCompositionTrackSegments conforms to this rule.
#[unsafe(method(segments))]
#[unsafe(method_family = none)]
pub unsafe fn segments(&self) -> Retained<NSArray<AVCompositionTrackSegment>>;
#[cfg(all(
feature = "AVAssetTrackSegment",
feature = "AVCompositionTrackSegment",
feature = "objc2-core-media"
))]
/// Supplies the AVCompositionTrackSegment from the segments array with a target timeRange that either contains the specified track time or is the closest to it among the target timeRanges of the track's segments.
///
/// Parameter `trackTime`: The trackTime for which an AVCompositionTrackSegment is requested.
///
/// Returns: An AVCompositionTrackSegment.
///
/// If the trackTime does not map to a sample presentation time (e.g. it's outside the track's timeRange), the segment closest in time to the specified trackTime is returned.
#[unsafe(method(segmentForTrackTime:))]
#[unsafe(method_family = none)]
pub unsafe fn segmentForTrackTime(
&self,
track_time: CMTime,
) -> Option<Retained<AVCompositionTrackSegment>>;
/// An array of AVCompositionTrackFormatDescriptionReplacement objects indicating original format descriptions and their replacements.
///
/// The value of this property is an array of AVCompositionTrackFormatDescriptionReplacement objects, each of which specifies an original format description together with its replacement format description (as specified by a previous call to -replaceFormatDescription:withFormatDescription:). Only format descriptions that are to be replaced will occur as the originalFormatDescription elements in the AVCompositionTrackFormatDescriptionReplacement objects in this array.
#[unsafe(method(formatDescriptionReplacements))]
#[unsafe(method_family = none)]
pub unsafe fn formatDescriptionReplacements(
&self,
) -> Retained<NSArray<AVCompositionTrackFormatDescriptionReplacement>>;
);
}
/// Methods declared on superclass `AVAssetTrack`.
#[cfg(feature = "AVAssetTrack")]
impl AVCompositionTrack {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmutablecompositiontrack?language=objc)
#[unsafe(super(AVCompositionTrack, AVAssetTrack, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "AVAssetTrack")]
pub struct AVMutableCompositionTrack;
);
#[cfg(all(feature = "AVAssetTrack", feature = "AVAsynchronousKeyValueLoading"))]
extern_conformance!(
unsafe impl AVAsynchronousKeyValueLoading for AVMutableCompositionTrack {}
);
#[cfg(feature = "AVAssetTrack")]
extern_conformance!(
unsafe impl NSCopying for AVMutableCompositionTrack {}
);
#[cfg(feature = "AVAssetTrack")]
unsafe impl CopyingHelper for AVMutableCompositionTrack {
type Result = Self;
}
#[cfg(feature = "AVAssetTrack")]
extern_conformance!(
unsafe impl NSObjectProtocol for AVMutableCompositionTrack {}
);
#[cfg(feature = "AVAssetTrack")]
impl AVMutableCompositionTrack {
extern_methods!(
/// Specifies whether the track is enabled or disabled. Default is YES.
#[unsafe(method(isEnabled))]
#[unsafe(method_family = none)]
pub unsafe fn isEnabled(&self) -> bool;
/// Setter for [`isEnabled`][Self::isEnabled].
#[unsafe(method(setEnabled:))]
#[unsafe(method_family = none)]
pub unsafe fn setEnabled(&self, enabled: bool);
#[cfg(feature = "objc2-core-media")]
/// Indicates a timescale in which time values for the track can be operated upon without extraneous numerical conversion.
///
/// If not set, the value is the naturalTimeScale of the first non-empty edit, or 600 if there are no non-empty edits.
/// Set to 0 to revert to default behavior.
#[unsafe(method(naturalTimeScale))]
#[unsafe(method_family = none)]
pub unsafe fn naturalTimeScale(&self) -> CMTimeScale;
#[cfg(feature = "objc2-core-media")]
/// Setter for [`naturalTimeScale`][Self::naturalTimeScale].
#[unsafe(method(setNaturalTimeScale:))]
#[unsafe(method_family = none)]
pub unsafe fn setNaturalTimeScale(&self, natural_time_scale: CMTimeScale);
/// Indicates the language associated with the track, as an ISO 639-2/T language code.
///
/// The default value is nil.
#[unsafe(method(languageCode))]
#[unsafe(method_family = none)]
pub unsafe fn languageCode(&self) -> Option<Retained<NSString>>;
/// Setter for [`languageCode`][Self::languageCode].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setLanguageCode:))]
#[unsafe(method_family = none)]
pub unsafe fn setLanguageCode(&self, language_code: Option<&NSString>);
/// Indicates the language tag associated with the track, as an IETF BCP 47 (RFC 4646) language identifier.
///
/// The default value is nil.
#[unsafe(method(extendedLanguageTag))]
#[unsafe(method_family = none)]
pub unsafe fn extendedLanguageTag(&self) -> Option<Retained<NSString>>;
/// Setter for [`extendedLanguageTag`][Self::extendedLanguageTag].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setExtendedLanguageTag:))]
#[unsafe(method_family = none)]
pub unsafe fn setExtendedLanguageTag(&self, extended_language_tag: Option<&NSString>);
#[cfg(feature = "objc2-core-foundation")]
/// The preferred transformation of the visual media data for display purposes.
///
/// The default value is CGAffineTransformIdentity.
#[unsafe(method(preferredTransform))]
#[unsafe(method_family = none)]
pub unsafe fn preferredTransform(&self) -> CGAffineTransform;
#[cfg(feature = "objc2-core-foundation")]
/// Setter for [`preferredTransform`][Self::preferredTransform].
#[unsafe(method(setPreferredTransform:))]
#[unsafe(method_family = none)]
pub unsafe fn setPreferredTransform(&self, preferred_transform: CGAffineTransform);
/// The preferred volume of the audible media data.
///
/// The default value is 1.0.
#[unsafe(method(preferredVolume))]
#[unsafe(method_family = none)]
pub unsafe fn preferredVolume(&self) -> c_float;
/// Setter for [`preferredVolume`][Self::preferredVolume].
#[unsafe(method(setPreferredVolume:))]
#[unsafe(method_family = none)]
pub unsafe fn setPreferredVolume(&self, preferred_volume: c_float);
#[cfg(all(feature = "AVAssetTrackSegment", feature = "AVCompositionTrackSegment"))]
/// Provides read/write access to the array of track segments, each an instance of AVCompositionTrackSegment.
///
/// Note that timeMapping.target.start of the first AVCompositionTrackSegment must be kCMTimeZero, and the timeMapping.target.start of each subsequent AVCompositionTrackSegment must equal CMTimeRangeGetEnd(the previous AVCompositionTrackSegment's timeMapping.target).
/// Use -validateTrackSegments:error: to perform a test to ensure that an array of AVCompositionTrackSegments conforms to this rule.
#[unsafe(method(segments))]
#[unsafe(method_family = none)]
pub unsafe fn segments(&self) -> Retained<NSArray<AVCompositionTrackSegment>>;
#[cfg(all(feature = "AVAssetTrackSegment", feature = "AVCompositionTrackSegment"))]
/// Setter for [`segments`][Self::segments].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setSegments:))]
#[unsafe(method_family = none)]
pub unsafe fn setSegments(&self, segments: Option<&NSArray<AVCompositionTrackSegment>>);
#[cfg(feature = "objc2-core-media")]
/// Inserts a timeRange of a source track into a track of a composition.
///
/// Parameter `timeRange`: Specifies the timeRange of the track to be inserted.
///
/// Parameter `track`: Specifies the source track to be inserted. Only AVAssetTracks of AVURLAssets and AVCompositions are supported (AVCompositions starting in macOS 10.10 and iOS 8.0).
///
/// Parameter `startTime`: Specifies the time at which the inserted track is to be presented by the composition track. You may pass kCMTimeInvalid for startTime to indicate that the timeRange should be appended to the end of the track.
///
/// Parameter `error`: Describes failures that may be reported to the user, e.g. the asset that was selected for insertion in the composition is restricted by copy-protection.
///
/// Returns: A BOOL value indicating the success of the insertion.
///
/// You provide a reference to an AVAssetTrack and the timeRange within it that you want to insert. You specify the start time in the target composition track at which the timeRange should be inserted.
///
/// Note that the inserted track timeRange will be presented at its natural duration and rate. It can be scaled to a different duration (and presented at a different rate) via -scaleTimeRange:toDuration:.
#[unsafe(method(insertTimeRange:ofTrack:atTime:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn insertTimeRange_ofTrack_atTime_error(
&self,
time_range: CMTimeRange,
track: &AVAssetTrack,
start_time: CMTime,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "objc2-core-media")]
/// Inserts the timeRanges of multiple source tracks into a track of a composition.
///
/// Parameter `timeRanges`: Specifies the timeRanges to be inserted. An NSArray of NSValues containing CMTimeRange. (See +[NSValue valueWithCMTimeRange:] in AVTime.h.)
///
/// Parameter `tracks`: Specifies the source tracks to be inserted. Only AVAssetTracks of AVURLAssets and AVCompositions are supported (AVCompositions starting in macOS 10.10 and iOS 8.0).
///
/// Parameter `startTime`: Specifies the time at which the inserted tracks are to be presented by the composition track. You may pass kCMTimeInvalid for startTime to indicate that the timeRanges should be appended to the end of the track.
///
/// Parameter `error`: Describes failures that may be reported to the user, e.g. the asset that was selected for insertion in the composition is restricted by copy-protection.
///
/// Returns: A BOOL value indicating the success of the insertion.
///
/// This method is equivalent to (but more efficient than) calling -insertTimeRange:ofTrack:atTime:error: for each timeRange/track pair. If this method returns an error, none of the time ranges will be inserted into the composition track. To specify an empty time range, pass NSNull for the track and a time range of starting at kCMTimeInvalid with a duration of the desired empty edit.
/// This method throws an exception if time ranges and tracks to not have the same array count.
#[unsafe(method(insertTimeRanges:ofTracks:atTime:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn insertTimeRanges_ofTracks_atTime_error(
&self,
time_ranges: &NSArray<NSValue>,
tracks: &NSArray<AVAssetTrack>,
start_time: CMTime,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "objc2-core-media")]
/// Adds or extends an empty timeRange within the composition track.
///
/// Parameter `timeRange`: Specifies the empty timeRange to be inserted.
///
/// If you insert an empty timeRange into the track, any media that was presented during that interval prior to the insertion will be presented instead immediately afterward.
/// The exact meaning of the term "empty timeRange" depends upon the mediaType of the track. For example, an empty timeRange in a sound track presents silence.
/// Note that you cannot add empty time ranges to the end of a composition track.
#[unsafe(method(insertEmptyTimeRange:))]
#[unsafe(method_family = none)]
pub unsafe fn insertEmptyTimeRange(&self, time_range: CMTimeRange);
#[cfg(feature = "objc2-core-media")]
/// Removes a specified timeRange from the track.
///
/// Parameter `timeRange`: Specifies the timeRange to be removed.
///
/// Removal of a timeRange does not cause the track to be removed from the composition. Instead it removes or truncates track segments that intersect with the timeRange.
#[unsafe(method(removeTimeRange:))]
#[unsafe(method_family = none)]
pub unsafe fn removeTimeRange(&self, time_range: CMTimeRange);
#[cfg(feature = "objc2-core-media")]
/// Changes the duration of a timeRange of the track.
///
/// Parameter `timeRange`: Specifies the timeRange of the track to be scaled.
///
/// Parameter `duration`: Specifies the new duration of the timeRange.
///
/// Each trackSegment affected by the scaling operation will be presented at a rate equal to source.duration / target.duration of its resulting timeMapping.
#[unsafe(method(scaleTimeRange:toDuration:))]
#[unsafe(method_family = none)]
pub unsafe fn scaleTimeRange_toDuration(&self, time_range: CMTimeRange, duration: CMTime);
#[cfg(all(feature = "AVAssetTrackSegment", feature = "AVCompositionTrackSegment"))]
/// Tests an array of AVCompositionTrackSegments to determine whether they conform to the timing rules noted above (see the property key
/// "
/// trackSegments").
///
/// Parameter `trackSegments`: The array of AVCompositionTrackSegments to be validated.
///
/// Parameter `error`: If validation fais, returns information about the failure.
///
/// Returns: YES if validation suceeds, otherwise NO.
///
/// The array is tested for suitability for setting as the value of the trackSegments property. If a portion of an existing trackSegments array is to be modified, the modification can be made via an instance of NSMutableArray, and the resulting array can be tested via -validateTrackSegments:error:.
#[unsafe(method(validateTrackSegments:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn validateTrackSegments_error(
&self,
track_segments: &NSArray<AVCompositionTrackSegment>,
) -> Result<(), Retained<NSError>>;
/// Establishes a track association of a specific type between two tracks.
///
/// Parameter `compositionTrack`: An AVCompositionTrack object that is to be associated with the receiver.
///
/// Parameter `trackAssociationType`: The type of track association to add between the receiver and the specified compositionTrack (for instance, AVTrackAssociationTypeChapterList).
#[unsafe(method(addTrackAssociationToTrack:type:))]
#[unsafe(method_family = none)]
pub unsafe fn addTrackAssociationToTrack_type(
&self,
composition_track: &AVCompositionTrack,
track_association_type: &AVTrackAssociationType,
);
/// Removes a track association of a specific type between two tracks.
///
/// Parameter `compositionTrack`: An AVCompositionTrack object that is associated with the receiver.
///
/// Parameter `trackAssociationType`: The type of track association to remove between the receiver and the specified compositionTrack (for instance, AVTrackAssociationTypeChapterList).
#[unsafe(method(removeTrackAssociationToTrack:type:))]
#[unsafe(method_family = none)]
pub unsafe fn removeTrackAssociationToTrack_type(
&self,
composition_track: &AVCompositionTrack,
track_association_type: &AVTrackAssociationType,
);
);
}
/// Methods declared on superclass `AVAssetTrack`.
#[cfg(feature = "AVAssetTrack")]
impl AVMutableCompositionTrack {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// A format description and its replacement.
///
/// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcompositiontrackformatdescriptionreplacement?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct AVCompositionTrackFormatDescriptionReplacement;
);
unsafe impl Send for AVCompositionTrackFormatDescriptionReplacement {}
unsafe impl Sync for AVCompositionTrackFormatDescriptionReplacement {}
extern_conformance!(
unsafe impl NSCoding for AVCompositionTrackFormatDescriptionReplacement {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for AVCompositionTrackFormatDescriptionReplacement {}
);
extern_conformance!(
unsafe impl NSSecureCoding for AVCompositionTrackFormatDescriptionReplacement {}
);
impl AVCompositionTrackFormatDescriptionReplacement {
extern_methods!(
#[cfg(feature = "objc2-core-media")]
/// The original format description.
#[unsafe(method(originalFormatDescription))]
#[unsafe(method_family = none)]
pub unsafe fn originalFormatDescription(&self) -> Retained<CMFormatDescription>;
#[cfg(feature = "objc2-core-media")]
/// The replacement format description.
#[unsafe(method(replacementFormatDescription))]
#[unsafe(method_family = none)]
pub unsafe fn replacementFormatDescription(&self) -> Retained<CMFormatDescription>;
);
}
/// Methods declared on superclass `NSObject`.
impl AVCompositionTrackFormatDescriptionReplacement {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
/// AVMutableCompositionTrackFormatDescriptionReplacement.
#[cfg(feature = "AVAssetTrack")]
impl AVMutableCompositionTrack {
extern_methods!(
#[cfg(feature = "objc2-core-media")]
/// Replaces one of the receiver's format descriptions with another format description or cancels a previous replacement.
///
/// Parameter `originalFormatDescription`: A CMFormatDescription occurring in the underlying asset track.
///
/// Parameter `replacementFormatDescription`: A CMFormatDescription to replace the specified format description or NULL to indicate that a previous replacement of originalFormatDescription should be cancelled.
///
/// You can use this method to make surgical changes to a track's format descriptions, such as adding format description extensions to a format description or changing the audio channel layout of an audio track. You should note that a format description can have extensions of type kCMFormatDescriptionExtension_VerbatimSampleDescription and kCMFormatDescriptionExtension_VerbatimISOSampleEntry; if you modify a copy of a format description, you should delete those extensions from the copy or your changes might be ignored. Also note that format description replacements are not transferred when performing editing operations on AVMutableCompositionTrack objects; for instance, inserting a range of a composition track into another composition track does not transfer any replacement format descriptions.
/// This method throws an exception if the media type of the replacement does not match the original format description.
#[unsafe(method(replaceFormatDescription:withFormatDescription:))]
#[unsafe(method_family = none)]
pub unsafe fn replaceFormatDescription_withFormatDescription(
&self,
original_format_description: &CMFormatDescription,
replacement_format_description: Option<&CMFormatDescription>,
);
);
}
/// SynchronousTrackInterface.
///
/// Redeclarations of async-only AVAssetTrack interfaces to allow synchronous usage in the synchronous subclass.
///
/// See AVAssetTrack's interface for more information about these interfaces.
#[cfg(feature = "AVAssetTrack")]
impl AVCompositionTrack {
extern_methods!(
#[cfg(feature = "AVMediaFormat")]
#[unsafe(method(hasMediaCharacteristic:))]
#[unsafe(method_family = none)]
pub unsafe fn hasMediaCharacteristic(
&self,
media_characteristic: &AVMediaCharacteristic,
) -> bool;
#[cfg(feature = "objc2-core-media")]
#[unsafe(method(samplePresentationTimeForTrackTime:))]
#[unsafe(method_family = none)]
pub unsafe fn samplePresentationTimeForTrackTime(&self, track_time: CMTime) -> CMTime;
#[cfg(all(feature = "AVMetadataFormat", feature = "AVMetadataItem"))]
#[unsafe(method(metadataForFormat:))]
#[unsafe(method_family = none)]
pub unsafe fn metadataForFormat(
&self,
format: &AVMetadataFormat,
) -> Retained<NSArray<AVMetadataItem>>;
#[unsafe(method(associatedTracksOfType:))]
#[unsafe(method_family = none)]
pub unsafe fn associatedTracksOfType(
&self,
track_association_type: &AVTrackAssociationType,
) -> Retained<NSArray<AVAssetTrack>>;
);
}