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