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"))]
28extern_conformance!(
29    unsafe impl CAMediaTiming for AVPlayerLayer {}
30);
31
32#[cfg(feature = "objc2-quartz-core")]
33#[cfg(not(target_os = "watchos"))]
34extern_conformance!(
35    unsafe impl NSCoding for AVPlayerLayer {}
36);
37
38#[cfg(feature = "objc2-quartz-core")]
39#[cfg(not(target_os = "watchos"))]
40extern_conformance!(
41    unsafe impl NSObjectProtocol for AVPlayerLayer {}
42);
43
44#[cfg(feature = "objc2-quartz-core")]
45#[cfg(not(target_os = "watchos"))]
46extern_conformance!(
47    unsafe impl NSSecureCoding for AVPlayerLayer {}
48);
49
50#[cfg(feature = "objc2-quartz-core")]
51#[cfg(not(target_os = "watchos"))]
52impl AVPlayerLayer {
53    extern_methods!(
54        #[cfg(feature = "AVPlayer")]
55        /// Returns an instance of AVPlayerLayer to display the visual output of the specified AVPlayer.
56        ///
57        /// Returns: An instance of AVPlayerLayer.
58        #[unsafe(method(playerLayerWithPlayer:))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn playerLayerWithPlayer(player: Option<&AVPlayer>) -> Retained<AVPlayerLayer>;
61
62        #[cfg(feature = "AVPlayer")]
63        /// Indicates the instance of AVPlayer for which the AVPlayerLayer displays visual output
64        #[unsafe(method(player))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn player(&self, mtm: MainThreadMarker) -> Option<Retained<AVPlayer>>;
67
68        #[cfg(feature = "AVPlayer")]
69        /// Setter for [`player`][Self::player].
70        #[unsafe(method(setPlayer:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn setPlayer(&self, player: Option<&AVPlayer>);
73
74        #[cfg(feature = "AVAnimation")]
75        /// A string defining how the video is displayed within an AVPlayerLayer bounds rect.
76        ///
77        /// Options are AVLayerVideoGravityResizeAspect, AVLayerVideoGravityResizeAspectFill
78        /// and AVLayerVideoGravityResize. AVLayerVideoGravityResizeAspect is default.
79        /// See
80        /// <AVFoundation
81        /// /AVAnimation.h> for a description of these options.
82        #[unsafe(method(videoGravity))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn videoGravity(&self) -> Retained<AVLayerVideoGravity>;
85
86        #[cfg(feature = "AVAnimation")]
87        /// Setter for [`videoGravity`][Self::videoGravity].
88        ///
89        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
90        #[unsafe(method(setVideoGravity:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn setVideoGravity(&self, video_gravity: &AVLayerVideoGravity);
93
94        /// Boolean indicating that the first video frame has been made ready for display for the current item of the associated AVPlayer.
95        ///
96        /// Use this property as an indicator of when best to show or animate-in an AVPlayerLayer into view.
97        /// 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.
98        /// This property remains NO for an AVPlayer currentItem whose AVAsset contains no enabled video tracks.
99        /// This property is key-value observable.
100        #[unsafe(method(isReadyForDisplay))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn isReadyForDisplay(&self) -> bool;
103
104        #[cfg(feature = "objc2-core-foundation")]
105        /// The current size and position of the video image as displayed within the receiver's bounds.
106        #[unsafe(method(videoRect))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn videoRect(&self) -> CGRect;
109
110        /// The client requirements for the visual output displayed in AVPlayerLayer during playback.
111        ///
112        /// Pixel buffer attribute keys are defined in
113        /// <CoreVideo
114        /// /CVPixelBuffer.h>
115        /// This property is key-value observable.
116        #[unsafe(method(pixelBufferAttributes))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn pixelBufferAttributes(
119            &self,
120        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
121
122        /// Setter for [`pixelBufferAttributes`][Self::pixelBufferAttributes].
123        ///
124        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
125        ///
126        /// # Safety
127        ///
128        /// `pixel_buffer_attributes` generic should be of the correct type.
129        #[unsafe(method(setPixelBufferAttributes:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn setPixelBufferAttributes(
132            &self,
133            pixel_buffer_attributes: Option<&NSDictionary<NSString, AnyObject>>,
134        );
135
136        #[cfg(feature = "objc2-core-video")]
137        /// 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.
138        ///
139        /// 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.
140        ///
141        /// Do not write to the returned CVPixelBuffer's attachments or pixel data.
142        #[unsafe(method(copyDisplayedPixelBuffer))]
143        #[unsafe(method_family = copy)]
144        pub unsafe fn copyDisplayedPixelBuffer(&self) -> Option<Retained<CVPixelBuffer>>;
145    );
146}
147
148/// Methods declared on superclass `CALayer`.
149#[cfg(feature = "objc2-quartz-core")]
150#[cfg(not(target_os = "watchos"))]
151impl AVPlayerLayer {
152    extern_methods!(
153        /// Layer creation and initialization. *
154        #[unsafe(method(layer))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn layer() -> Retained<Self>;
157
158        #[unsafe(method(init))]
159        #[unsafe(method_family = init)]
160        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
161
162        /// # Safety
163        ///
164        /// `layer` should be of the correct type.
165        #[unsafe(method(initWithLayer:))]
166        #[unsafe(method_family = init)]
167        pub unsafe fn initWithLayer(this: Allocated<Self>, layer: &AnyObject) -> Retained<Self>;
168    );
169}
170
171/// Methods declared on superclass `NSObject`.
172#[cfg(feature = "objc2-quartz-core")]
173#[cfg(not(target_os = "watchos"))]
174impl AVPlayerLayer {
175    extern_methods!(
176        #[unsafe(method(new))]
177        #[unsafe(method_family = new)]
178        pub unsafe fn new() -> Retained<Self>;
179    );
180}