objc2_av_kit/generated/AVPictureInPictureController_AVSampleBufferDisplayLayerSupport.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-av-foundation")]
7use objc2_av_foundation::*;
8#[cfg(feature = "objc2-core-media")]
9use objc2_core_media::*;
10
11use crate::*;
12
13#[cfg(feature = "AVPictureInPictureController")]
14impl AVPictureInPictureController {
15 extern_methods!(
16 /// Informs Picture in Picture controller that it should request an updated playback state from its sampleBufferPlaybackDelegate.
17 ///
18 /// This should always be called whenever playback is paused or unpaused, or the underlying content duration changes.
19 #[unsafe(method(invalidatePlaybackState))]
20 #[unsafe(method_family = none)]
21 pub unsafe fn invalidatePlaybackState(&self);
22 );
23}
24
25extern_protocol!(
26 /// A protocol for controlling playback from an AVSampleBufferDisplayLayer in Picture in Picture.
27 ///
28 /// See also [Apple's documentation](https://developer.apple.com/documentation/avkit/avpictureinpicturesamplebufferplaybackdelegate?language=objc)
29 pub unsafe trait AVPictureInPictureSampleBufferPlaybackDelegate:
30 NSObjectProtocol
31 {
32 #[cfg(feature = "AVPictureInPictureController")]
33 /// Parameter `pictureInPictureController`: The Picture in Picture controller.
34 ///
35 /// Parameter `playing`: Whether the content should play or pause.
36 ///
37 /// Informs delegate that the user initiated a request to play or pause the content.
38 #[unsafe(method(pictureInPictureController:setPlaying:))]
39 #[unsafe(method_family = none)]
40 unsafe fn pictureInPictureController_setPlaying(
41 &self,
42 picture_in_picture_controller: &AVPictureInPictureController,
43 playing: bool,
44 );
45
46 #[cfg(all(feature = "AVPictureInPictureController", feature = "objc2-core-media"))]
47 /// Parameter `pictureInPictureController`: The Picture in Picture controller.
48 ///
49 /// Allows delegate to inform Picture in Picture controller of the current playable time range. May be called multiple times during playback. Time ranges with finite duration should always contain the current time of the sample buffer display layer's timebase.
50 ///
51 /// Clients should return a time range with a duration of kCMTimeInfinity to indicate live content. When there is no content to play, they should return kCMTimeRangeInvalid. This method will be called whenever -[AVPictureInPictureController invalidatePlaybackState] is called and at other times as needed by the system.
52 ///
53 /// Returns: A CMTimeRange indicating the content's time range.
54 #[unsafe(method(pictureInPictureControllerTimeRangeForPlayback:))]
55 #[unsafe(method_family = none)]
56 unsafe fn pictureInPictureControllerTimeRangeForPlayback(
57 &self,
58 picture_in_picture_controller: &AVPictureInPictureController,
59 ) -> CMTimeRange;
60
61 #[cfg(feature = "AVPictureInPictureController")]
62 /// Parameter `pictureInPictureController`: The Picture in Picture controller.
63 ///
64 /// Allows delegate to indicate whether the playback UI should reflect a playing or paused state, regardless of what the current playback rate might be. May be called multiple times during playback.
65 ///
66 /// This method will be called whenever -[AVPictureInPictureController invalidatePlaybackState] is called and at other times as needed by the system.
67 ///
68 /// Returns: A boolean value indicating whether or not the playback UI should indicate playback has been paused or is playing.
69 #[unsafe(method(pictureInPictureControllerIsPlaybackPaused:))]
70 #[unsafe(method_family = none)]
71 unsafe fn pictureInPictureControllerIsPlaybackPaused(
72 &self,
73 picture_in_picture_controller: &AVPictureInPictureController,
74 ) -> bool;
75
76 #[cfg(all(feature = "AVPictureInPictureController", feature = "objc2-core-media"))]
77 /// Parameter `pictureInPictureController`: The Picture in Picture controller.
78 ///
79 /// Parameter `newRenderSize`: The rendered size, in pixels, of Picture in Picture content.
80 ///
81 /// This method is called when the system Picture in Picture window changes size. Delegate take the new render size and AVPictureInPictureController.isPictureInPictureActive into account when choosing media variants in order to avoid uncessary decoding overhead.
82 #[unsafe(method(pictureInPictureController:didTransitionToRenderSize:))]
83 #[unsafe(method_family = none)]
84 unsafe fn pictureInPictureController_didTransitionToRenderSize(
85 &self,
86 picture_in_picture_controller: &AVPictureInPictureController,
87 new_render_size: CMVideoDimensions,
88 );
89
90 #[cfg(all(
91 feature = "AVPictureInPictureController",
92 feature = "block2",
93 feature = "objc2-core-media"
94 ))]
95 /// Parameter `pictureInPictureController`: The Picture in Picture controller.
96 ///
97 /// Parameter `skipInterval`: The interval by which to skip playback.
98 ///
99 /// Parameter `completionHandler`: A closure that must be invoked to indicate that the skip operation has completed.
100 ///
101 /// Informs delegate that the user has requested skipping forward or backward by the time indicated by the interval.
102 ///
103 /// Clients may choose to seek by a different interval for efficiency reasons (for example, seeking to a keyframe) or if the requested interval falls outside of the playable timeline. Clients must invoke the completion handler to indicate the seek operation has finished or failed. By the time the completion handler has been invoked, the timebase should reflect the current time and playback rate. Failure to invoke this completion handler is an application error and will result in playback UI permanently stuck in a “seeking” state.
104 #[unsafe(method(pictureInPictureController:skipByInterval:completionHandler:))]
105 #[unsafe(method_family = none)]
106 unsafe fn pictureInPictureController_skipByInterval_completionHandler(
107 &self,
108 picture_in_picture_controller: &AVPictureInPictureController,
109 skip_interval: CMTime,
110 completion_handler: &block2::DynBlock<dyn Fn()>,
111 );
112
113 #[cfg(feature = "AVPictureInPictureController")]
114 /// Parameter `pictureInPictureController`: The Picture in Picture controller.
115 ///
116 /// Allows the delegate to indicate whether background audio playback should always be prohibited.
117 ///
118 /// If implemented, this optional method will be called once for each invocation of invalidatePlaybackState to allow the delegate to indicate whether or not audio playback should be prohibited when the picture in picture window is in the background.
119 ///
120 /// Note that background in this context has a seperate meaning from application background used in UIKit. Here, background defines the state of the picture in picture window itself rather than the application.
121 ///
122 /// Returns: A boolean value indicating whether or not background audio playback is always prohibited.
123 #[optional]
124 #[unsafe(method(pictureInPictureControllerShouldProhibitBackgroundAudioPlayback:))]
125 #[unsafe(method_family = none)]
126 unsafe fn pictureInPictureControllerShouldProhibitBackgroundAudioPlayback(
127 &self,
128 picture_in_picture_controller: &AVPictureInPictureController,
129 ) -> bool;
130 }
131);
132
133/// AVSampleBufferDisplayLayerSupport.
134#[cfg(feature = "AVPictureInPictureController")]
135impl AVPictureInPictureControllerContentSource {
136 extern_methods!(
137 #[cfg(feature = "objc2-av-foundation")]
138 #[cfg(not(target_os = "watchos"))]
139 /// Parameter `sampleBufferDisplayLayer`: The sample buffer display layer to be shown in Picture in Picture.
140 ///
141 /// Parameter `playbackDelegate`: The playback delegate for controlling sample buffer display layer's playback in Picture in Picture.
142 ///
143 /// Use this initializer for a content source with a sample buffer display layer and playback delegate.
144 #[unsafe(method(initWithSampleBufferDisplayLayer:playbackDelegate:))]
145 #[unsafe(method_family = init)]
146 pub unsafe fn initWithSampleBufferDisplayLayer_playbackDelegate(
147 this: Allocated<Self>,
148 sample_buffer_display_layer: &AVSampleBufferDisplayLayer,
149 playback_delegate: &ProtocolObject<dyn AVPictureInPictureSampleBufferPlaybackDelegate>,
150 ) -> Retained<Self>;
151
152 #[cfg(feature = "objc2-av-foundation")]
153 #[cfg(not(target_os = "watchos"))]
154 /// The receiver's sample buffer display layer.
155 #[unsafe(method(sampleBufferDisplayLayer))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn sampleBufferDisplayLayer(
158 &self,
159 ) -> Option<Retained<AVSampleBufferDisplayLayer>>;
160
161 /// The receiver's sample buffer playback delegate.
162 #[unsafe(method(sampleBufferPlaybackDelegate))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn sampleBufferPlaybackDelegate(
165 &self,
166 ) -> Option<Retained<ProtocolObject<dyn AVPictureInPictureSampleBufferPlaybackDelegate>>>;
167 );
168}