objc2_av_foundation/generated/
AVPlayerItemTrack.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern "C" {
11    /// Use with videoFieldMode property to request deinterlacing of video fields.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemtrackvideofieldmodedeinterlacefields?language=objc)
14    pub static AVPlayerItemTrackVideoFieldModeDeinterlaceFields: &'static NSString;
15}
16
17extern_class!(
18    /// An AVPlayerItemTrack carries a reference to an AVAssetTrack as well as presentation settings for that track.
19    ///
20    ///
21    /// Note that inspection of assets tracks is provided by AVAssetTrack.
22    /// This class is intended to represent presentation state for a track of an asset that's played by an AVPlayer and AVPlayerItem.
23    ///
24    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemtrack?language=objc)
25    #[unsafe(super(NSObject))]
26    #[thread_kind = MainThreadOnly]
27    #[derive(Debug, PartialEq, Eq, Hash)]
28    pub struct AVPlayerItemTrack;
29);
30
31unsafe impl NSObjectProtocol for AVPlayerItemTrack {}
32
33impl AVPlayerItemTrack {
34    extern_methods!(
35        #[cfg(feature = "AVAssetTrack")]
36        /// Indicates the AVAssetTrack for which the AVPlayerItemTrack represents presentation state.
37        ///
38        /// This property is not observable.
39        /// Clients must serialize their access to the resulting AVAssetTrack and related objects on the associated AVPlayer's
40        /// notification queue.  By default, this queue is the main queue.
41        #[unsafe(method(assetTrack))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn assetTrack(&self) -> Option<Retained<AVAssetTrack>>;
44
45        /// Indicates whether the track is enabled for presentation during playback.
46        ///
47        /// Before macOS 13, iOS 16, tvOS 16, and watchOS 9, this property must be accessed on the main thread/queue.
48        #[unsafe(method(isEnabled))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn isEnabled(&self) -> bool;
51
52        /// Setter for [`isEnabled`][Self::isEnabled].
53        #[unsafe(method(setEnabled:))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn setEnabled(&self, enabled: bool);
56
57        /// If the media type of the assetTrack is AVMediaTypeVideo, indicates the current frame rate of the track as it plays, in units of frames per second. If the item is not playing, or if the media type of the track is not video, the value of this property is 0.
58        ///
59        /// This property is not observable.
60        ///
61        /// Before macOS 13, iOS 16, tvOS 16, and watchOS 9, this property must be accessed on the main thread/queue.
62        #[unsafe(method(currentVideoFrameRate))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn currentVideoFrameRate(&self) -> c_float;
65
66        /// If the media type of the assetTrack is AVMediaTypeVideo, specifies the handling of video frames that contain multiple fields.
67        ///
68        /// A value of nil indicates default processing of video frames. If you want video fields to be deinterlaced, set videoFieldMode to AVPlayerItemTrackVideoFieldModeDeinterlaceFields.
69        /// You can test whether video being played has multiple fields by examining the underlying AVAssetTrack's format descriptions. See -[AVAssetTrack formatDescriptions] and, for video format descriptions, kCMFormatDescriptionExtension_FieldCount.
70        ///
71        /// Before macOS 13, iOS 16, tvOS 16, and watchOS 9, this property must be accessed on the main thread/queue.
72        #[unsafe(method(videoFieldMode))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn videoFieldMode(&self) -> Option<Retained<NSString>>;
75
76        /// Setter for [`videoFieldMode`][Self::videoFieldMode].
77        #[unsafe(method(setVideoFieldMode:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn setVideoFieldMode(&self, video_field_mode: Option<&NSString>);
80    );
81}
82
83/// Methods declared on superclass `NSObject`.
84impl AVPlayerItemTrack {
85    extern_methods!(
86        #[unsafe(method(init))]
87        #[unsafe(method_family = init)]
88        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
89
90        #[unsafe(method(new))]
91        #[unsafe(method_family = new)]
92        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
93    );
94}