objc2_av_foundation/generated/
AVPlayerLayer.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-video")]
9use objc2_core_video::*;
10use objc2_foundation::*;
11#[cfg(feature = "objc2-quartz-core")]
12#[cfg(not(target_os = "watchos"))]
13use objc2_quartz_core::*;
14
15use crate::*;
16
17extern_class!(
18    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerlayer?language=objc)
19    #[unsafe(super(CALayer, NSObject))]
20    #[derive(Debug, PartialEq, Eq, Hash)]
21    #[cfg(feature = "objc2-quartz-core")]
22    #[cfg(not(target_os = "watchos"))]
23    pub struct AVPlayerLayer;
24);
25
26#[cfg(feature = "objc2-quartz-core")]
27#[cfg(not(target_os = "watchos"))]
28unsafe impl CAMediaTiming for AVPlayerLayer {}
29
30#[cfg(feature = "objc2-quartz-core")]
31#[cfg(not(target_os = "watchos"))]
32unsafe impl NSCoding for AVPlayerLayer {}
33
34#[cfg(feature = "objc2-quartz-core")]
35#[cfg(not(target_os = "watchos"))]
36unsafe impl NSObjectProtocol for AVPlayerLayer {}
37
38#[cfg(feature = "objc2-quartz-core")]
39#[cfg(not(target_os = "watchos"))]
40unsafe impl NSSecureCoding for AVPlayerLayer {}
41
42#[cfg(feature = "objc2-quartz-core")]
43#[cfg(not(target_os = "watchos"))]
44impl AVPlayerLayer {
45    extern_methods!(
46        #[cfg(feature = "AVPlayer")]
47        /// Returns an instance of AVPlayerLayer to display the visual output of the specified AVPlayer.
48        ///
49        /// Returns: An instance of AVPlayerLayer.
50        #[unsafe(method(playerLayerWithPlayer:))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn playerLayerWithPlayer(player: Option<&AVPlayer>) -> Retained<AVPlayerLayer>;
53
54        #[cfg(feature = "AVPlayer")]
55        /// Indicates the instance of AVPlayer for which the AVPlayerLayer displays visual output
56        #[unsafe(method(player))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn player(&self, mtm: MainThreadMarker) -> Option<Retained<AVPlayer>>;
59
60        #[cfg(feature = "AVPlayer")]
61        /// Setter for [`player`][Self::player].
62        #[unsafe(method(setPlayer:))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn setPlayer(&self, player: Option<&AVPlayer>);
65
66        #[cfg(feature = "AVAnimation")]
67        /// A string defining how the video is displayed within an AVPlayerLayer bounds rect.
68        ///
69        /// Options are AVLayerVideoGravityResizeAspect, AVLayerVideoGravityResizeAspectFill
70        /// and AVLayerVideoGravityResize. AVLayerVideoGravityResizeAspect is default.
71        /// See
72        /// <AVFoundation
73        /// /AVAnimation.h> for a description of these options.
74        #[unsafe(method(videoGravity))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn videoGravity(&self) -> Retained<AVLayerVideoGravity>;
77
78        #[cfg(feature = "AVAnimation")]
79        /// Setter for [`videoGravity`][Self::videoGravity].
80        #[unsafe(method(setVideoGravity:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn setVideoGravity(&self, video_gravity: &AVLayerVideoGravity);
83
84        /// Boolean indicating that the first video frame has been made ready for display for the current item of the associated AVPlayer.
85        ///
86        /// Use this property as an indicator of when best to show or animate-in an AVPlayerLayer into view.
87        /// An AVPlayerLayer may be displayed, or made visible, while this property is NO, however the layer will not have any user-visible content until the value becomes YES. Note that if an animation is added to an AVPlayerLayer before it becomes readyForDisplay the video image displayed inside might not animate with the receiver.
88        /// This property remains NO for an AVPlayer currentItem whose AVAsset contains no enabled video tracks.
89        /// This property is key-value observable.
90        #[unsafe(method(isReadyForDisplay))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn isReadyForDisplay(&self) -> bool;
93
94        #[cfg(feature = "objc2-core-foundation")]
95        /// The current size and position of the video image as displayed within the receiver's bounds.
96        #[unsafe(method(videoRect))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn videoRect(&self) -> CGRect;
99
100        /// The client requirements for the visual output displayed in AVPlayerLayer during playback.
101        ///
102        /// Pixel buffer attribute keys are defined in
103        /// <CoreVideo
104        /// /CVPixelBuffer.h>
105        /// This property is key-value observable.
106        #[unsafe(method(pixelBufferAttributes))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn pixelBufferAttributes(
109            &self,
110        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
111
112        /// Setter for [`pixelBufferAttributes`][Self::pixelBufferAttributes].
113        #[unsafe(method(setPixelBufferAttributes:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn setPixelBufferAttributes(
116            &self,
117            pixel_buffer_attributes: Option<&NSDictionary<NSString, AnyObject>>,
118        );
119
120        #[cfg(feature = "objc2-core-video")]
121        /// Returns a retained reference to the pixel buffer currently displayed in this AVPlayerLayer. This will return NULL if the displayed pixel buffer is protected, no image is currently being displayed, if the current player's rate is non-zero or if the image is unavailable.
122        ///
123        /// This will only return the current image while the media is paused, otherwise this will return nil. Clients must release the pixel buffer after use.
124        ///
125        /// Do not write to the returned CVPixelBuffer's attachments or pixel data.
126        #[unsafe(method(copyDisplayedPixelBuffer))]
127        #[unsafe(method_family = copy)]
128        pub unsafe fn copyDisplayedPixelBuffer(&self) -> Option<Retained<CVPixelBuffer>>;
129    );
130}
131
132/// Methods declared on superclass `CALayer`.
133#[cfg(feature = "objc2-quartz-core")]
134#[cfg(not(target_os = "watchos"))]
135impl AVPlayerLayer {
136    extern_methods!(
137        /// Layer creation and initialization. *
138        #[unsafe(method(layer))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn layer() -> Retained<Self>;
141
142        #[unsafe(method(init))]
143        #[unsafe(method_family = init)]
144        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
145
146        #[unsafe(method(initWithLayer:))]
147        #[unsafe(method_family = init)]
148        pub unsafe fn initWithLayer(this: Allocated<Self>, layer: &AnyObject) -> Retained<Self>;
149    );
150}
151
152/// Methods declared on superclass `NSObject`.
153#[cfg(feature = "objc2-quartz-core")]
154#[cfg(not(target_os = "watchos"))]
155impl AVPlayerLayer {
156    extern_methods!(
157        #[unsafe(method(new))]
158        #[unsafe(method_family = new)]
159        pub unsafe fn new() -> Retained<Self>;
160    );
161}