objc2_av_foundation/generated/AVPlayerItemOutput.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-media")]
9use objc2_core_media::*;
10#[cfg(feature = "objc2-core-video")]
11use objc2_core_video::*;
12use objc2_foundation::*;
13
14use crate::*;
15
16extern_class!(
17 /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemoutput?language=objc)
18 #[unsafe(super(NSObject))]
19 #[derive(Debug, PartialEq, Eq, Hash)]
20 pub struct AVPlayerItemOutput;
21);
22
23unsafe impl NSObjectProtocol for AVPlayerItemOutput {}
24
25impl AVPlayerItemOutput {
26 extern_methods!(
27 #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-media"))]
28 /// Convert a host time, expressed in seconds, to item time.
29 ///
30 /// Converts a host time value (for example a CADisplayLink timestamp, or the value returned by CACurrentMediaTime()) to the equivalent time on the item's timebase.
31 ///
32 /// Note: The Core Animation CADisplayLink timestamp property expresses the most recent, or previous, screen refresh time. You need to increment this timestamp by the CADisplayLink's duration property to find the next appropriate item time.
33 ///
34 /// Parameter `hostTimeInSeconds`: The timestamp value to convert to item time.
35 ///
36 /// Returns: The equivalent item time.
37 #[unsafe(method(itemTimeForHostTime:))]
38 #[unsafe(method_family = none)]
39 pub unsafe fn itemTimeForHostTime(&self, host_time_in_seconds: CFTimeInterval) -> CMTime;
40
41 #[cfg(feature = "objc2-core-media")]
42 /// Convenience method to convert a Mach host time to item time.
43 ///
44 /// Converts Mach host time to the equivalent time on the item's timebase.
45 /// mach_absolute_time() returns time awake since boot in system-specific rational units that can be queried by calling mach_timebase_info().
46 ///
47 /// Parameter `machAbsoluteTime`: The Mach host time to convert to item time.
48 ///
49 /// Returns: The equivalent item time.
50 #[unsafe(method(itemTimeForMachAbsoluteTime:))]
51 #[unsafe(method_family = none)]
52 pub unsafe fn itemTimeForMachAbsoluteTime(&self, mach_absolute_time: i64) -> CMTime;
53
54 #[cfg(all(feature = "objc2-core-media", feature = "objc2-core-video"))]
55 /// Convenience method to convert a CoreVideo timestamp to the equivalent time on the item's timebase.
56 ///
57 /// Note: A CVDisplayLink provides a parameter inOutputTimestamp that expresses a future screen refresh time. You can use this value directly to find the next appropriate item time.
58 /// Use `itemTimeForHostTime` if you were using this method previously to find the item time and have to switch over due to CVDisplayLink deprecation.
59 ///
60 /// Parameter `timestamp`: The CoreVideo timestamp value to convert to item time.
61 ///
62 /// Returns: The equivalent item time.
63 #[unsafe(method(itemTimeForCVTimeStamp:))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn itemTimeForCVTimeStamp(&self, timestamp: CVTimeStamp) -> CMTime;
66
67 /// Indicates whether the output, when added to an AVPlayerItem, will be used in addition to normal rendering of media data by the player or instead of normal rendering.
68 ///
69 /// The default value is NO, indicating that the output will be used in addition to normal rendering. If you want to render the media data provided by the output yourself instead of allowing it to be rendered as in normally would be by AVPlayer, set suppressesPlayerRendering to YES.
70 ///
71 /// Whenever any output is added to an AVPlayerItem that has suppressesPlayerRendering set to YES, the media data supplied to the output will not be rendered by AVPlayer. Other media data associated with the item but not provided to such an output is not affected. For example, if an output of class AVPlayerItemVideoOutput with a value of YES for suppressesPlayerRendering is added to an AVPlayerItem, video media for that item will not be rendered by the AVPlayer, while audio media, subtitle media, and other kinds of media, if present, will be rendered.
72 #[unsafe(method(suppressesPlayerRendering))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn suppressesPlayerRendering(&self) -> bool;
75
76 /// Setter for [`suppressesPlayerRendering`][Self::suppressesPlayerRendering].
77 #[unsafe(method(setSuppressesPlayerRendering:))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn setSuppressesPlayerRendering(&self, suppresses_player_rendering: bool);
80 );
81}
82
83/// Methods declared on superclass `NSObject`.
84impl AVPlayerItemOutput {
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() -> Retained<Self>;
93 );
94}
95
96extern_class!(
97 /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemvideooutput?language=objc)
98 #[unsafe(super(AVPlayerItemOutput, NSObject))]
99 #[derive(Debug, PartialEq, Eq, Hash)]
100 pub struct AVPlayerItemVideoOutput;
101);
102
103unsafe impl NSObjectProtocol for AVPlayerItemVideoOutput {}
104
105impl AVPlayerItemVideoOutput {
106 extern_methods!(
107 /// Returns an instance of AVPlayerItemVideoOutput, initialized with the specified pixel buffer attributes, for video image output.
108 ///
109 /// Parameter `pixelBufferAttributes`: The client requirements for output CVPixelBuffers, expressed using the constants in
110 /// <CoreVideo
111 /// /CVPixelBuffer.h>.
112 ///
113 /// Returns: An instance of AVPlayerItemVideoOutput.
114 #[unsafe(method(initWithPixelBufferAttributes:))]
115 #[unsafe(method_family = init)]
116 pub unsafe fn initWithPixelBufferAttributes(
117 this: Allocated<Self>,
118 pixel_buffer_attributes: Option<&NSDictionary<NSString, AnyObject>>,
119 ) -> Retained<Self>;
120
121 /// Returns an instance of AVPlayerItemVideoOutput, initialized with the specified output settings, for video image output.
122 ///
123 /// Parameter `outputSettings`: The client requirements for output CVPixelBuffers, expressed using the constants in AVVideoSettings.h.
124 ///
125 /// For uncompressed video output, start with kCVPixelBuffer* keys in
126 /// <CoreVideo
127 /// /CVPixelBuffer.h>.
128 ///
129 /// In addition to the keys in CVPixelBuffer.h, uncompressed video settings dictionaries may also contain the following keys:
130 ///
131 /// AVVideoAllowWideColorKey
132 ///
133 ///
134 /// Returns: An instance of AVPlayerItemVideoOutput.
135 ///
136 /// This method throws an exception for any of the following reasons:
137 /// - the output settings dictionary is empty
138 /// - the settings will yield compressed output
139 /// - the settings do not honor the requirements listed above for outputSettings
140 #[unsafe(method(initWithOutputSettings:))]
141 #[unsafe(method_family = init)]
142 pub unsafe fn initWithOutputSettings(
143 this: Allocated<Self>,
144 output_settings: Option<&NSDictionary<NSString, AnyObject>>,
145 ) -> Retained<Self>;
146
147 #[cfg(feature = "objc2-core-media")]
148 /// Query if any new video output is available for an item time.
149 ///
150 /// This method returns YES if there is available video output, appropriate for display, at the specified item time not marked as acquired. If you require multiple objects to acquire video output from the same AVPlayerItem, you should instantiate more than one AVPlayerItemVideoOutput and add each via addOutput:. Each AVPlayerItemVideoOutput maintains a separate record of client acquisition.
151 ///
152 /// Parameter `itemTime`: The item time to query.
153 ///
154 /// Returns: A BOOL indicating if there is newer output.
155 #[unsafe(method(hasNewPixelBufferForItemTime:))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn hasNewPixelBufferForItemTime(&self, item_time: CMTime) -> bool;
158
159 #[cfg(all(feature = "objc2-core-media", feature = "objc2-core-video"))]
160 /// Retrieves an image that is appropriate for display at the specified item time, and marks the image as acquired.
161 ///
162 /// The client is responsible for calling CVBufferRelease on the returned CVPixelBuffer when finished with it.
163 ///
164 /// Typically you would call this method in response to a CADisplayLink delegate invocation and if hasNewPixelBufferForItemTime: also returns YES.
165 ///
166 /// The buffer reference retrieved from copyPixelBufferForItemTime:itemTimeForDisplay: may itself be NULL. A reference to a NULL pixel buffer communicates that nothing should be displayed for the supplied item time.
167 ///
168 /// Parameter `itemTime`: A CMTime that expresses a desired item time.
169 ///
170 /// Parameter `itemTimeForDisplay`: A CMTime pointer whose value will contain the true display deadline for the copied pixel buffer. Can be NULL.
171 #[unsafe(method(copyPixelBufferForItemTime:itemTimeForDisplay:))]
172 #[unsafe(method_family = copy)]
173 pub unsafe fn copyPixelBufferForItemTime_itemTimeForDisplay(
174 &self,
175 item_time: CMTime,
176 out_item_time_for_display: *mut CMTime,
177 ) -> Option<Retained<CVPixelBuffer>>;
178
179 /// Informs the receiver that the AVPlayerItemVideoOutput client is entering a quiescent state.
180 ///
181 /// Parameter `interval`: A wall clock time interval.
182 ///
183 /// Message this method before you suspend your use of a CADisplayLink. The interval you provide will be used to message your delegate, in advance, that it should resume the display link. If the interval you provide is large, effectively requesting wakeup earlier than the AVPlayerItemVideoOutput is prepared to act, the delegate will be invoked as soon as possible. Do not use this method to force a delegate invocation for each sample.
184 #[unsafe(method(requestNotificationOfMediaDataChangeWithAdvanceInterval:))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn requestNotificationOfMediaDataChangeWithAdvanceInterval(
187 &self,
188 interval: NSTimeInterval,
189 );
190
191 /// The receiver's delegate.
192 #[unsafe(method(delegate))]
193 #[unsafe(method_family = none)]
194 pub unsafe fn delegate(
195 &self,
196 ) -> Option<Retained<ProtocolObject<dyn AVPlayerItemOutputPullDelegate>>>;
197 );
198}
199
200/// Methods declared on superclass `NSObject`.
201impl AVPlayerItemVideoOutput {
202 extern_methods!(
203 #[unsafe(method(init))]
204 #[unsafe(method_family = init)]
205 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
206
207 #[unsafe(method(new))]
208 #[unsafe(method_family = new)]
209 pub unsafe fn new() -> Retained<Self>;
210 );
211}
212
213extern_protocol!(
214 /// Defines common delegate methods for objects participating in AVPlayerItemOutput pull sample output acquisition.
215 ///
216 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemoutputpulldelegate?language=objc)
217 pub unsafe trait AVPlayerItemOutputPullDelegate: NSObjectProtocol {
218 /// A method invoked once, prior to a new sample, if the AVPlayerItemOutput sender was previously messaged requestNotificationOfMediaDataChangeWithAdvanceInterval:.
219 ///
220 /// This method is invoked once after the sender is messaged requestNotificationOfMediaDataChangeWithAdvanceInterval:.
221 #[optional]
222 #[unsafe(method(outputMediaDataWillChange:))]
223 #[unsafe(method_family = none)]
224 unsafe fn outputMediaDataWillChange(&self, sender: &AVPlayerItemOutput);
225
226 /// A method invoked when the output is commencing a new sequence.
227 ///
228 /// This method is invoked after any seeking and change in playback direction. If you are maintaining any queued future samples, copied previously, you may want to discard these after receiving this message.
229 #[optional]
230 #[unsafe(method(outputSequenceWasFlushed:))]
231 #[unsafe(method_family = none)]
232 unsafe fn outputSequenceWasFlushed(&self, output: &AVPlayerItemOutput);
233 }
234);
235
236extern_class!(
237 /// A subclass of AVPlayerItemOutput that can vend media with a legible characteristic as NSAttributedStrings.
238 ///
239 /// An instance of AVPlayerItemLegibleOutput is typically initialized using the -init method.
240 ///
241 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemlegibleoutput?language=objc)
242 #[unsafe(super(AVPlayerItemOutput, NSObject))]
243 #[derive(Debug, PartialEq, Eq, Hash)]
244 pub struct AVPlayerItemLegibleOutput;
245);
246
247unsafe impl NSObjectProtocol for AVPlayerItemLegibleOutput {}
248
249impl AVPlayerItemLegibleOutput {
250 extern_methods!(
251 /// The receiver's delegate.
252 ///
253 /// The delegate is held using a zeroing-weak reference, so this property will have a value of nil after a delegate that was previously set has been deallocated. This property is not key-value observable.
254 #[unsafe(method(delegate))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn delegate(
257 &self,
258 ) -> Option<Retained<ProtocolObject<dyn AVPlayerItemLegibleOutputPushDelegate>>>;
259
260 /// Permits advance invocation of the associated delegate, if any.
261 ///
262 /// If it is possible, an AVPlayerItemLegibleOutput will message its delegate advanceIntervalForDelegateInvocation seconds earlier than otherwise. If the value you provide is large, effectively requesting provision of samples earlier than the AVPlayerItemLegibleOutput is prepared to act on them, the delegate will be invoked as soon as possible.
263 #[unsafe(method(advanceIntervalForDelegateInvocation))]
264 #[unsafe(method_family = none)]
265 pub unsafe fn advanceIntervalForDelegateInvocation(&self) -> NSTimeInterval;
266
267 /// Setter for [`advanceIntervalForDelegateInvocation`][Self::advanceIntervalForDelegateInvocation].
268 #[unsafe(method(setAdvanceIntervalForDelegateInvocation:))]
269 #[unsafe(method_family = none)]
270 pub unsafe fn setAdvanceIntervalForDelegateInvocation(
271 &self,
272 advance_interval_for_delegate_invocation: NSTimeInterval,
273 );
274 );
275}
276
277/// Methods declared on superclass `NSObject`.
278impl AVPlayerItemLegibleOutput {
279 extern_methods!(
280 #[unsafe(method(init))]
281 #[unsafe(method_family = init)]
282 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
283
284 #[unsafe(method(new))]
285 #[unsafe(method_family = new)]
286 pub unsafe fn new() -> Retained<Self>;
287 );
288}
289
290/// AVPlayerItemLegibleOutput_NativeRepresentation.
291impl AVPlayerItemLegibleOutput {
292 extern_methods!(
293 /// Returns an instance of AVPlayerItemLegibleOutput with filtering enabled for AVPlayerItemLegibleOutputPushDelegate's legibleOutput:didOutputAttributedStrings:nativeSampleBuffers:forItemTime:.
294 ///
295 /// Parameter `subtypes`: NSArray of NSNumber FourCC codes, e.g.
296 /// @
297 /// [ [NSNumber numberWithUnsignedInt:'tx3g'] ]
298 ///
299 /// Returns: An instance of AVPlayerItemLegibleOutput.
300 ///
301 /// Add media subtype FourCC number objects to the subtypes array to elect to receive that type as a CMSampleBuffer instead of an NSAttributedString. Initializing an AVPlayerItemLegibleOutput using the -init method is equivalent to calling -initWithMediaSubtypesForNativeRepresentation: with an empty array, which means that all legible data, regardless of media subtype, will be delivered using NSAttributedString in a common format.
302 ///
303 /// If a media subtype for which there is no legible data in the current player item is included in the media subtypes array, no error will occur. AVPlayerItemLegibleOutput will not vend closed caption data as CMSampleBuffers, so it is an error to include 'c608' in the media subtypes array.
304 ///
305 /// This method throws an exception if any media subtype is kCMClosedCaptionFormatType_CEA608 (native representation is not available for media subtype).
306 #[unsafe(method(initWithMediaSubtypesForNativeRepresentation:))]
307 #[unsafe(method_family = init)]
308 pub unsafe fn initWithMediaSubtypesForNativeRepresentation(
309 this: Allocated<Self>,
310 subtypes: &NSArray<NSNumber>,
311 ) -> Retained<Self>;
312 );
313}
314
315/// The type of a text styling resolution.
316///
317/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemlegibleoutputtextstylingresolution?language=objc)
318// NS_TYPED_ENUM
319pub type AVPlayerItemLegibleOutputTextStylingResolution = NSString;
320
321extern "C" {
322 /// Specify this level of text styling resolution to receive attributed strings from an AVPlayerItemLegibleOutput that include the same level of styling information that AVFoundation would use itself to render text within an AVPlayerLayer. The text styling will accommodate user-level Media Accessibility settings.
323 ///
324 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemlegibleoutputtextstylingresolutiondefault?language=objc)
325 pub static AVPlayerItemLegibleOutputTextStylingResolutionDefault:
326 &'static AVPlayerItemLegibleOutputTextStylingResolution;
327}
328
329extern "C" {
330 /// Specify this level of text styling resolution to receive only the styling present in the source media and the styling provided via AVPlayerItem.textStyleRules.
331 ///
332 /// This level of resolution excludes styling provided by the user-level Media Accessibility settings. You would typically use it if you wish to override the styling specified in source media. If you do this, you are strongly encouraged to allow your custom styling in turn to be overriden by user preferences for text styling that are available as Media Accessibility settings.
333 ///
334 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemlegibleoutputtextstylingresolutionsourceandrulesonly?language=objc)
335 pub static AVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly:
336 &'static AVPlayerItemLegibleOutputTextStylingResolution;
337}
338
339/// AVPlayerItemLegibleOutput_TextStylingResolution.
340impl AVPlayerItemLegibleOutput {
341 extern_methods!(
342 /// A string identifier indicating the degree of text styling to be applied to attributed strings vended by the receiver
343 ///
344 /// Valid values are AVPlayerItemLegibleOutputTextStylingResolutionDefault and AVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly. An NSInvalidArgumentException is raised if this property is set to any other value. The default value is AVPlayerItemLegibleOutputTextStylingResolutionDefault, which indicates that attributed strings vended by the receiver will include the same level of styling information that would be used if AVFoundation were rendering the text via AVPlayerLayer.
345 #[unsafe(method(textStylingResolution))]
346 #[unsafe(method_family = none)]
347 pub unsafe fn textStylingResolution(
348 &self,
349 ) -> Retained<AVPlayerItemLegibleOutputTextStylingResolution>;
350
351 /// Setter for [`textStylingResolution`][Self::textStylingResolution].
352 #[unsafe(method(setTextStylingResolution:))]
353 #[unsafe(method_family = none)]
354 pub unsafe fn setTextStylingResolution(
355 &self,
356 text_styling_resolution: &AVPlayerItemLegibleOutputTextStylingResolution,
357 );
358 );
359}
360
361extern_protocol!(
362 /// Extends AVPlayerItemOutputPushDelegate to provide additional methods specific to attributed string output.
363 ///
364 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemlegibleoutputpushdelegate?language=objc)
365 pub unsafe trait AVPlayerItemLegibleOutputPushDelegate:
366 AVPlayerItemOutputPushDelegate
367 {
368 #[cfg(feature = "objc2-core-media")]
369 /// A delegate callback that delivers new textual samples.
370 ///
371 /// Parameter `output`: The AVPlayerItemLegibleOutput source.
372 ///
373 /// Parameter `strings`: An NSArray of NSAttributedString, each containing both the run of text and descriptive markup.
374 ///
375 /// Parameter `nativeSamples`: An NSArray of CMSampleBuffer objects, for media subtypes included in the array passed in to -initWithMediaSubtypesForNativeRepresentation:
376 ///
377 /// Parameter `itemTime`: The item time at which the strings should be presented.
378 ///
379 /// For each media subtype in the array passed in to -initWithMediaSubtypesForNativeRepresentation:, the delegate will receive sample buffers carrying data in its native format via the nativeSamples parameter, if there is media data of that subtype in the media resource. For all other media subtypes present in the media resource, the delegate will receive attributed strings in a common format via the strings parameter. See
380 /// <CoreMedia
381 /// /CMTextMarkup.h> for the string attributes that are used in the attributed strings.
382 #[optional]
383 #[unsafe(method(legibleOutput:didOutputAttributedStrings:nativeSampleBuffers:forItemTime:))]
384 #[unsafe(method_family = none)]
385 unsafe fn legibleOutput_didOutputAttributedStrings_nativeSampleBuffers_forItemTime(
386 &self,
387 output: &AVPlayerItemLegibleOutput,
388 strings: &NSArray<NSAttributedString>,
389 native_samples: &NSArray,
390 item_time: CMTime,
391 );
392 }
393);
394
395extern_protocol!(
396 /// Defines common delegate methods for objects participating in AVPlayerItemOutput push sample output acquisition.
397 ///
398 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemoutputpushdelegate?language=objc)
399 pub unsafe trait AVPlayerItemOutputPushDelegate: NSObjectProtocol {
400 /// A method invoked when the output is commencing a new sequence of media data.
401 ///
402 /// This method is invoked after any seeking and change in playback direction. If you are maintaining any queued future media data, received previously, you may want to discard these after receiving this message.
403 #[optional]
404 #[unsafe(method(outputSequenceWasFlushed:))]
405 #[unsafe(method_family = none)]
406 unsafe fn outputSequenceWasFlushed(&self, output: &AVPlayerItemOutput);
407 }
408);
409
410extern_class!(
411 /// A subclass of AVPlayerItemOutput that vends collections of metadata items carried in metadata tracks.
412 ///
413 ///
414 /// Setting the value of suppressesPlayerRendering on an instance of AVPlayerItemMetadataOutput has no effect.
415 ///
416 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemmetadataoutput?language=objc)
417 #[unsafe(super(AVPlayerItemOutput, NSObject))]
418 #[derive(Debug, PartialEq, Eq, Hash)]
419 pub struct AVPlayerItemMetadataOutput;
420);
421
422unsafe impl NSObjectProtocol for AVPlayerItemMetadataOutput {}
423
424impl AVPlayerItemMetadataOutput {
425 extern_methods!(
426 /// Creates an instance of AVPlayerItemMetadataOutput.
427 ///
428 /// Parameter `identifiers`: A array of metadata identifiers indicating the metadata items that the output should provide.
429 ///
430 /// See AVMetadataIdentifiers.h for publicly defined metadata identifiers. Pass nil to receive all of the timed metadata from all enabled AVPlayerItemTracks that carry timed metadata.
431 #[unsafe(method(initWithIdentifiers:))]
432 #[unsafe(method_family = init)]
433 pub unsafe fn initWithIdentifiers(
434 this: Allocated<Self>,
435 identifiers: Option<&NSArray<NSString>>,
436 ) -> Retained<Self>;
437
438 /// The receiver's delegate.
439 ///
440 /// The delegate is held using a zeroing-weak reference, so this property will have a value of nil after a delegate that was previously set has been deallocated. This property is not key-value observable.
441 #[unsafe(method(delegate))]
442 #[unsafe(method_family = none)]
443 pub unsafe fn delegate(
444 &self,
445 ) -> Option<Retained<ProtocolObject<dyn AVPlayerItemMetadataOutputPushDelegate>>>;
446
447 /// Permits advance invocation of the associated delegate, if any.
448 ///
449 /// If it is possible, an AVPlayerItemMetadataOutput will message its delegate advanceIntervalForDelegateInvocation seconds earlier than otherwise. If the value you provide is large, effectively requesting provision of samples earlier than the AVPlayerItemMetadataOutput is prepared to act on them, the delegate will be invoked as soon as possible.
450 #[unsafe(method(advanceIntervalForDelegateInvocation))]
451 #[unsafe(method_family = none)]
452 pub unsafe fn advanceIntervalForDelegateInvocation(&self) -> NSTimeInterval;
453
454 /// Setter for [`advanceIntervalForDelegateInvocation`][Self::advanceIntervalForDelegateInvocation].
455 #[unsafe(method(setAdvanceIntervalForDelegateInvocation:))]
456 #[unsafe(method_family = none)]
457 pub unsafe fn setAdvanceIntervalForDelegateInvocation(
458 &self,
459 advance_interval_for_delegate_invocation: NSTimeInterval,
460 );
461 );
462}
463
464/// Methods declared on superclass `NSObject`.
465impl AVPlayerItemMetadataOutput {
466 extern_methods!(
467 #[unsafe(method(init))]
468 #[unsafe(method_family = init)]
469 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
470
471 #[unsafe(method(new))]
472 #[unsafe(method_family = new)]
473 pub unsafe fn new() -> Retained<Self>;
474 );
475}
476
477extern_protocol!(
478 /// Extends AVPlayerItemOutputPushDelegate to provide additional methods specific to metadata output.
479 ///
480 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemmetadataoutputpushdelegate?language=objc)
481 pub unsafe trait AVPlayerItemMetadataOutputPushDelegate:
482 AVPlayerItemOutputPushDelegate
483 {
484 #[cfg(all(feature = "AVPlayerItemTrack", feature = "AVTimedMetadataGroup"))]
485 /// A delegate callback that delivers a new collection of metadata items.
486 ///
487 /// Parameter `output`: The AVPlayerItemMetadataOutput source.
488 ///
489 /// Parameter `groups`: An NSArray of AVTimedMetadataGroups that may contain metadata items with requested identifiers, according to the format descriptions associated with the underlying tracks.
490 ///
491 /// Parameter `track`: An instance of AVPlayerItemTrack that indicates the source of the metadata items in the group.
492 ///
493 /// Each group provided in a single invocation of this method will have timing that does not overlap with any other group in the array.
494 /// Note that for some timed metadata formats carried by HTTP live streaming, the timeRange of each group must be reported as kCMTimeIndefinite, because its duration will be unknown until the next metadata group in the stream arrives. In these cases, the groups parameter will always contain a single group.
495 /// Groups are typically packaged into arrays for delivery to your delegate according to the chunking or interleaving of the underlying metadata data.
496 /// Note that if the item carries multiple metadata tracks containing metadata with the same metadata identifiers, this method can be invoked for each one separately, each with reference to the associated AVPlayerItemTrack.
497 /// Note that the associated AVPlayerItemTrack parameter can be nil which implies that the metadata describes the asset as a whole, not just a single track of the asset.
498 #[optional]
499 #[unsafe(method(metadataOutput:didOutputTimedMetadataGroups:fromPlayerItemTrack:))]
500 #[unsafe(method_family = none)]
501 unsafe fn metadataOutput_didOutputTimedMetadataGroups_fromPlayerItemTrack(
502 &self,
503 output: &AVPlayerItemMetadataOutput,
504 groups: &NSArray<AVTimedMetadataGroup>,
505 track: Option<&AVPlayerItemTrack>,
506 );
507 }
508);
509
510extern_class!(
511 /// A subclass of AVPlayerItemOutput that can vend media with a legible characteristic as rendered CVPixelBufferRefs.
512 ///
513 /// An instance of AVPlayerItemRenderedLegibleOutput is initialized using the -init method.
514 ///
515 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemrenderedlegibleoutput?language=objc)
516 #[unsafe(super(AVPlayerItemOutput, NSObject))]
517 #[derive(Debug, PartialEq, Eq, Hash)]
518 pub struct AVPlayerItemRenderedLegibleOutput;
519);
520
521unsafe impl NSObjectProtocol for AVPlayerItemRenderedLegibleOutput {}
522
523impl AVPlayerItemRenderedLegibleOutput {
524 extern_methods!(
525 #[unsafe(method(init))]
526 #[unsafe(method_family = init)]
527 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
528
529 #[unsafe(method(new))]
530 #[unsafe(method_family = new)]
531 pub unsafe fn new() -> Retained<Self>;
532
533 #[cfg(feature = "objc2-core-foundation")]
534 /// Creates an instance of AVPlayerItemRenderedLegibleOutput.
535 ///
536 /// Parameter `videoDisplaySize`: CGSize for the video display area
537 ///
538 /// This is the only available initializer for AVPlayerItemRenderedLegibleOutput. The client can also choose to reset videoDisplaySize after initialization or during playback. Initializing and resetting videoDisplaySize with a zero height or width will result in an exception being thrown.
539 #[unsafe(method(initWithVideoDisplaySize:))]
540 #[unsafe(method_family = init)]
541 pub unsafe fn initWithVideoDisplaySize(
542 this: Allocated<Self>,
543 video_display_size: CGSize,
544 ) -> Retained<Self>;
545
546 /// The receiver's delegate.
547 ///
548 /// The delegate is held using a zeroing-weak reference, so this property will have a value of nil after a delegate that was previously set has been deallocated. This property is not key-value observable.
549 #[unsafe(method(delegate))]
550 #[unsafe(method_family = none)]
551 pub unsafe fn delegate(
552 &self,
553 ) -> Option<Retained<ProtocolObject<dyn AVPlayerItemRenderedLegibleOutputPushDelegate>>>;
554
555 /// Permits advance invocation of the associated delegate, if any.
556 ///
557 /// If it is possible, an AVPlayerItemRenderedLegibleOutput will message its delegate advanceIntervalForDelegateInvocation seconds earlier than otherwise. If the value you provide is large, effectively requesting provision of samples earlier than the AVPlayerItemRenderedLegibleOutput is prepared to act on them, the delegate will be invoked as soon as possible.
558 #[unsafe(method(advanceIntervalForDelegateInvocation))]
559 #[unsafe(method_family = none)]
560 pub unsafe fn advanceIntervalForDelegateInvocation(&self) -> NSTimeInterval;
561
562 /// Setter for [`advanceIntervalForDelegateInvocation`][Self::advanceIntervalForDelegateInvocation].
563 #[unsafe(method(setAdvanceIntervalForDelegateInvocation:))]
564 #[unsafe(method_family = none)]
565 pub unsafe fn setAdvanceIntervalForDelegateInvocation(
566 &self,
567 advance_interval_for_delegate_invocation: NSTimeInterval,
568 );
569
570 #[cfg(feature = "objc2-core-foundation")]
571 /// Permits rendering of pixel buffers according to the set width and height
572 ///
573 /// The client is expected to set videodisplay size during init and may also set it again during playback. The pixel buffers will be rendered according to the set width and height of display area. If this property is set during the presentation time of a vended caption image, a new caption image rendered according to new videoDisplaySize, will be vended out. Setting this property with a zero height or width will result in an exception being thrown and it is client's responsibility to handle it using appropriate catch block.
574 #[unsafe(method(videoDisplaySize))]
575 #[unsafe(method_family = none)]
576 pub unsafe fn videoDisplaySize(&self) -> CGSize;
577
578 #[cfg(feature = "objc2-core-foundation")]
579 /// Setter for [`videoDisplaySize`][Self::videoDisplaySize].
580 #[unsafe(method(setVideoDisplaySize:))]
581 #[unsafe(method_family = none)]
582 pub unsafe fn setVideoDisplaySize(&self, video_display_size: CGSize);
583 );
584}
585
586extern_protocol!(
587 /// Extends AVPlayerItemOutputPushDelegate to provide additional methods specific to pixel buffers output.
588 ///
589 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemrenderedlegibleoutputpushdelegate?language=objc)
590 pub unsafe trait AVPlayerItemRenderedLegibleOutputPushDelegate:
591 AVPlayerItemOutputPushDelegate
592 {
593 #[cfg(all(feature = "AVRenderedCaptionImage", feature = "objc2-core-media"))]
594 /// A delegate callback that delivers new rendered caption images
595 ///
596 /// Parameter `output`: The AVPlayerItemRenderedLegibleOutput source.
597 ///
598 /// Parameter `captionImages`: An NSArray of AVRenderedCaptionImage(s), consisting of a CVPixelBufferRef and its associated position (in pixels) relative to the video frame
599 ///
600 /// Parameter `itemTime`: The item time at which the caption images should be presented.
601 #[optional]
602 #[unsafe(method(renderedLegibleOutput:didOutputRenderedCaptionImages:forItemTime:))]
603 #[unsafe(method_family = none)]
604 unsafe fn renderedLegibleOutput_didOutputRenderedCaptionImages_forItemTime(
605 &self,
606 output: &AVPlayerItemRenderedLegibleOutput,
607 caption_images: &NSArray<AVRenderedCaptionImage>,
608 item_time: CMTime,
609 );
610 }
611);