objc2_av_foundation/generated/
AVMetrics.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-media")]
7use objc2_core_media::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_protocol!(
13    /// This protocol needs to be implemented by interfaces intending to publish metric events to the event stream.
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetriceventstreampublisher?language=objc)
16    pub unsafe trait AVMetricEventStreamPublisher {}
17);
18
19extern_protocol!(
20    /// This protocol needs to be implemented by the subscriber delegate to receive subscribed metric events.
21    ///
22    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetriceventstreamsubscriber?language=objc)
23    pub unsafe trait AVMetricEventStreamSubscriber {
24        /// Delegate callback to receive metric events.
25        ///
26        /// Parameter `event`: The metric event.
27        ///
28        /// Parameter `publisher`: The publisher which generated the current event.
29        #[unsafe(method(publisher:didReceiveEvent:))]
30        #[unsafe(method_family = none)]
31        unsafe fn publisher_didReceiveEvent(
32            &self,
33            publisher: &ProtocolObject<dyn AVMetricEventStreamPublisher>,
34            event: &AVMetricEvent,
35        );
36    }
37);
38
39extern_class!(
40    /// AVMetricEventStream allows clients to add publishers and then subscribe to specific metric event classes from those publishers. Publishers are AVFoundation instances implementing AVMetricEventStreamPublisher. The interface allows clients to receive metric events via a subscriber delegate which implements AVMetricEventStreamSubscriber.
41    ///
42    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetriceventstream?language=objc)
43    #[unsafe(super(NSObject))]
44    #[derive(Debug, PartialEq, Eq, Hash)]
45    pub struct AVMetricEventStream;
46);
47
48unsafe impl NSObjectProtocol for AVMetricEventStream {}
49
50impl AVMetricEventStream {
51    extern_methods!(
52        #[unsafe(method(init))]
53        #[unsafe(method_family = init)]
54        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
55
56        #[unsafe(method(new))]
57        #[unsafe(method_family = new)]
58        pub unsafe fn new() -> Retained<Self>;
59
60        /// Returns an autoreleased instance.
61        #[unsafe(method(eventStream))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn eventStream() -> Retained<Self>;
64
65        /// The publisher should be an AVFoundation instance conforming to AVMetricEventStreamPublisher.
66        #[unsafe(method(addPublisher:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn addPublisher(
69            &self,
70            publisher: &ProtocolObject<dyn AVMetricEventStreamPublisher>,
71        ) -> bool;
72
73        /// Subscribe to a specific metric event class.
74        ///
75        /// Parameter `metricEventClass`: Type of metric event class to subscribe to.
76        #[unsafe(method(subscribeToMetricEvent:))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn subscribeToMetricEvent(&self, metric_event_class: &AnyClass);
79
80        /// Subscribe to set of metric event classes.
81        ///
82        /// Parameter `metricEventClasses`: Set of metric event classes to subscribe to.
83        #[unsafe(method(subscribeToMetricEvents:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn subscribeToMetricEvents(&self, metric_event_classes: &NSArray<AnyClass>);
86
87        /// Subscribe to all metric event classes.
88        #[unsafe(method(subscribeToAllMetricEvents))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn subscribeToAllMetricEvents(&self);
91    );
92}
93
94extern_class!(
95    /// An abstract base class representing metric events.
96    ///
97    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
98    ///
99    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetricevent?language=objc)
100    #[unsafe(super(NSObject))]
101    #[derive(Debug, PartialEq, Eq, Hash)]
102    pub struct AVMetricEvent;
103);
104
105unsafe impl Send for AVMetricEvent {}
106
107unsafe impl Sync for AVMetricEvent {}
108
109unsafe impl NSCoding for AVMetricEvent {}
110
111unsafe impl NSObjectProtocol for AVMetricEvent {}
112
113unsafe impl NSSecureCoding for AVMetricEvent {}
114
115impl AVMetricEvent {
116    extern_methods!(
117        #[unsafe(method(init))]
118        #[unsafe(method_family = init)]
119        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
120
121        #[unsafe(method(new))]
122        #[unsafe(method_family = new)]
123        pub unsafe fn new() -> Retained<Self>;
124
125        /// Returns the date when the event occurred.
126        #[unsafe(method(date))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn date(&self) -> Retained<NSDate>;
129
130        #[cfg(feature = "objc2-core-media")]
131        /// Returns the time in the media timeline when the event occured.
132        #[unsafe(method(mediaTime))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn mediaTime(&self) -> CMTime;
135
136        /// A GUID that identifies the media session. If not available, value is nil.
137        #[unsafe(method(sessionID))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn sessionID(&self) -> Option<Retained<NSString>>;
140    );
141}
142
143extern_class!(
144    /// Represents a metric event when an error occurred.
145    ///
146    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
147    ///
148    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetricerrorevent?language=objc)
149    #[unsafe(super(AVMetricEvent, NSObject))]
150    #[derive(Debug, PartialEq, Eq, Hash)]
151    pub struct AVMetricErrorEvent;
152);
153
154unsafe impl Send for AVMetricErrorEvent {}
155
156unsafe impl Sync for AVMetricErrorEvent {}
157
158unsafe impl NSCoding for AVMetricErrorEvent {}
159
160unsafe impl NSObjectProtocol for AVMetricErrorEvent {}
161
162unsafe impl NSSecureCoding for AVMetricErrorEvent {}
163
164impl AVMetricErrorEvent {
165    extern_methods!(
166        #[unsafe(method(init))]
167        #[unsafe(method_family = init)]
168        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
169
170        #[unsafe(method(new))]
171        #[unsafe(method_family = new)]
172        pub unsafe fn new() -> Retained<Self>;
173
174        /// Returns whether the error was recoverable.
175        #[unsafe(method(didRecover))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn didRecover(&self) -> bool;
178
179        /// Returns the error encountered.
180        #[unsafe(method(error))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn error(&self) -> Retained<NSError>;
183    );
184}
185
186extern_class!(
187    /// Represents a metric event associated with media resource requests.
188    ///
189    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
190    ///
191    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetricmediaresourcerequestevent?language=objc)
192    #[unsafe(super(AVMetricEvent, NSObject))]
193    #[derive(Debug, PartialEq, Eq, Hash)]
194    pub struct AVMetricMediaResourceRequestEvent;
195);
196
197unsafe impl Send for AVMetricMediaResourceRequestEvent {}
198
199unsafe impl Sync for AVMetricMediaResourceRequestEvent {}
200
201unsafe impl NSCoding for AVMetricMediaResourceRequestEvent {}
202
203unsafe impl NSObjectProtocol for AVMetricMediaResourceRequestEvent {}
204
205unsafe impl NSSecureCoding for AVMetricMediaResourceRequestEvent {}
206
207impl AVMetricMediaResourceRequestEvent {
208    extern_methods!(
209        #[unsafe(method(init))]
210        #[unsafe(method_family = init)]
211        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
212
213        #[unsafe(method(new))]
214        #[unsafe(method_family = new)]
215        pub unsafe fn new() -> Retained<Self>;
216
217        /// Returns the URL of the resource request. If no value is available, returns nil.
218        #[unsafe(method(url))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn url(&self) -> Option<Retained<NSURL>>;
221
222        /// The IP address of the server. If not available, the value is nil.
223        #[unsafe(method(serverAddress))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn serverAddress(&self) -> Option<Retained<NSString>>;
226
227        /// Returns the start time of the resource request.
228        #[unsafe(method(requestStartTime))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn requestStartTime(&self) -> Retained<NSDate>;
231
232        /// Returns the end time of the resource request.
233        #[unsafe(method(requestEndTime))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn requestEndTime(&self) -> Retained<NSDate>;
236
237        /// Returns the start time of the resource request response.
238        #[unsafe(method(responseStartTime))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn responseStartTime(&self) -> Retained<NSDate>;
241
242        /// Returns the end time of the resource request response.
243        #[unsafe(method(responseEndTime))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn responseEndTime(&self) -> Retained<NSDate>;
246
247        /// Returns the byte range downloaded for the resource request. If not available, the range start and end will be 0.
248        #[unsafe(method(byteRange))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn byteRange(&self) -> NSRange;
251
252        /// Returns true if the resource was read from the cache.
253        #[unsafe(method(wasReadFromCache))]
254        #[unsafe(method_family = none)]
255        pub unsafe fn wasReadFromCache(&self) -> bool;
256
257        /// Returns the error event, if any, encountered during the resource request. If no value is present, returns nil.
258        #[unsafe(method(errorEvent))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn errorEvent(&self) -> Option<Retained<AVMetricErrorEvent>>;
261
262        /// Returns the NSURLSessionTaskMetrics associated with the resource request. If no value is present, returns nil
263        #[unsafe(method(networkTransactionMetrics))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn networkTransactionMetrics(&self)
266            -> Option<Retained<NSURLSessionTaskMetrics>>;
267    );
268}
269
270extern_class!(
271    /// Represents a metric event associated with a HLS playlist resource request.
272    ///
273    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
274    ///
275    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetrichlsplaylistrequestevent?language=objc)
276    #[unsafe(super(AVMetricEvent, NSObject))]
277    #[derive(Debug, PartialEq, Eq, Hash)]
278    pub struct AVMetricHLSPlaylistRequestEvent;
279);
280
281unsafe impl Send for AVMetricHLSPlaylistRequestEvent {}
282
283unsafe impl Sync for AVMetricHLSPlaylistRequestEvent {}
284
285unsafe impl NSCoding for AVMetricHLSPlaylistRequestEvent {}
286
287unsafe impl NSObjectProtocol for AVMetricHLSPlaylistRequestEvent {}
288
289unsafe impl NSSecureCoding for AVMetricHLSPlaylistRequestEvent {}
290
291impl AVMetricHLSPlaylistRequestEvent {
292    extern_methods!(
293        #[unsafe(method(init))]
294        #[unsafe(method_family = init)]
295        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
296
297        #[unsafe(method(new))]
298        #[unsafe(method_family = new)]
299        pub unsafe fn new() -> Retained<Self>;
300
301        /// Returns the URL of the playlist. If no value is available, returns nil.
302        #[unsafe(method(url))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn url(&self) -> Option<Retained<NSURL>>;
305
306        /// Returns true if the playlist request is for a multivariant playlist.
307        #[unsafe(method(isMultivariantPlaylist))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn isMultivariantPlaylist(&self) -> bool;
310
311        #[cfg(feature = "AVMediaFormat")]
312        /// Returns the media type.  If the value cannot be determined, returns AVMediaTypeMuxed.
313        #[unsafe(method(mediaType))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn mediaType(&self) -> Retained<AVMediaType>;
316
317        /// Returns the media resource request event which was used to satisfy the playlist.
318        #[unsafe(method(mediaResourceRequestEvent))]
319        #[unsafe(method_family = none)]
320        pub unsafe fn mediaResourceRequestEvent(
321            &self,
322        ) -> Option<Retained<AVMetricMediaResourceRequestEvent>>;
323    );
324}
325
326extern_class!(
327    /// Represents a metric event associated with a HLS media segment resource request.
328    ///
329    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
330    ///
331    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetrichlsmediasegmentrequestevent?language=objc)
332    #[unsafe(super(AVMetricEvent, NSObject))]
333    #[derive(Debug, PartialEq, Eq, Hash)]
334    pub struct AVMetricHLSMediaSegmentRequestEvent;
335);
336
337unsafe impl Send for AVMetricHLSMediaSegmentRequestEvent {}
338
339unsafe impl Sync for AVMetricHLSMediaSegmentRequestEvent {}
340
341unsafe impl NSCoding for AVMetricHLSMediaSegmentRequestEvent {}
342
343unsafe impl NSObjectProtocol for AVMetricHLSMediaSegmentRequestEvent {}
344
345unsafe impl NSSecureCoding for AVMetricHLSMediaSegmentRequestEvent {}
346
347impl AVMetricHLSMediaSegmentRequestEvent {
348    extern_methods!(
349        #[unsafe(method(init))]
350        #[unsafe(method_family = init)]
351        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
352
353        #[unsafe(method(new))]
354        #[unsafe(method_family = new)]
355        pub unsafe fn new() -> Retained<Self>;
356
357        /// Returns the URL of the media segment. If no value is available, returns nil.
358        #[unsafe(method(url))]
359        #[unsafe(method_family = none)]
360        pub unsafe fn url(&self) -> Option<Retained<NSURL>>;
361
362        /// Returns true if the media segment request is for a map segment.
363        #[unsafe(method(isMapSegment))]
364        #[unsafe(method_family = none)]
365        pub unsafe fn isMapSegment(&self) -> bool;
366
367        #[cfg(feature = "AVMediaFormat")]
368        /// Returns the media type.  If the value cannot be determined, returns AVMediaTypeMuxed.
369        #[unsafe(method(mediaType))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn mediaType(&self) -> Retained<AVMediaType>;
372
373        /// Returns the byte range for the media segment. If not available, the range start and end will be 0.
374        #[unsafe(method(byteRange))]
375        #[unsafe(method_family = none)]
376        pub unsafe fn byteRange(&self) -> NSRange;
377
378        /// Returns the URL of the index file in which this segment was declared. If not available, returns nil.
379        #[unsafe(method(indexFileURL))]
380        #[unsafe(method_family = none)]
381        pub unsafe fn indexFileURL(&self) -> Retained<NSURL>;
382
383        /// Returns the media resource request event which was used to satisfy the media segment.
384        #[unsafe(method(mediaResourceRequestEvent))]
385        #[unsafe(method_family = none)]
386        pub unsafe fn mediaResourceRequestEvent(
387            &self,
388        ) -> Option<Retained<AVMetricMediaResourceRequestEvent>>;
389    );
390}
391
392extern_class!(
393    /// Represents a metric event associated with a HLS content key resource request.
394    ///
395    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
396    ///
397    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetriccontentkeyrequestevent?language=objc)
398    #[unsafe(super(AVMetricEvent, NSObject))]
399    #[derive(Debug, PartialEq, Eq, Hash)]
400    pub struct AVMetricContentKeyRequestEvent;
401);
402
403unsafe impl Send for AVMetricContentKeyRequestEvent {}
404
405unsafe impl Sync for AVMetricContentKeyRequestEvent {}
406
407unsafe impl NSCoding for AVMetricContentKeyRequestEvent {}
408
409unsafe impl NSObjectProtocol for AVMetricContentKeyRequestEvent {}
410
411unsafe impl NSSecureCoding for AVMetricContentKeyRequestEvent {}
412
413impl AVMetricContentKeyRequestEvent {
414    extern_methods!(
415        #[unsafe(method(init))]
416        #[unsafe(method_family = init)]
417        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
418
419        #[unsafe(method(new))]
420        #[unsafe(method_family = new)]
421        pub unsafe fn new() -> Retained<Self>;
422
423        #[cfg(feature = "AVContentKeySession")]
424        /// Returns the content key specifier for the request.
425        #[unsafe(method(contentKeySpecifier))]
426        #[unsafe(method_family = none)]
427        pub unsafe fn contentKeySpecifier(&self) -> Retained<AVContentKeySpecifier>;
428
429        #[cfg(feature = "AVMediaFormat")]
430        /// Returns the media type.  If the value cannot be determined, returns AVMediaTypeMuxed.
431        #[unsafe(method(mediaType))]
432        #[unsafe(method_family = none)]
433        pub unsafe fn mediaType(&self) -> Retained<AVMediaType>;
434
435        /// Returns whether the content key resource request was initiated by the client.
436        #[unsafe(method(isClientInitiated))]
437        #[unsafe(method_family = none)]
438        pub unsafe fn isClientInitiated(&self) -> bool;
439
440        /// Returns the media resource request event which was used to satisfy the content key.
441        #[unsafe(method(mediaResourceRequestEvent))]
442        #[unsafe(method_family = none)]
443        pub unsafe fn mediaResourceRequestEvent(
444            &self,
445        ) -> Option<Retained<AVMetricMediaResourceRequestEvent>>;
446    );
447}
448
449extern_class!(
450    /// Represents a metric event when playback was likely to play through without stalling.
451    ///
452    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
453    ///
454    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetricplayeritemlikelytokeepupevent?language=objc)
455    #[unsafe(super(AVMetricEvent, NSObject))]
456    #[derive(Debug, PartialEq, Eq, Hash)]
457    pub struct AVMetricPlayerItemLikelyToKeepUpEvent;
458);
459
460unsafe impl Send for AVMetricPlayerItemLikelyToKeepUpEvent {}
461
462unsafe impl Sync for AVMetricPlayerItemLikelyToKeepUpEvent {}
463
464unsafe impl NSCoding for AVMetricPlayerItemLikelyToKeepUpEvent {}
465
466unsafe impl NSObjectProtocol for AVMetricPlayerItemLikelyToKeepUpEvent {}
467
468unsafe impl NSSecureCoding for AVMetricPlayerItemLikelyToKeepUpEvent {}
469
470impl AVMetricPlayerItemLikelyToKeepUpEvent {
471    extern_methods!(
472        #[unsafe(method(init))]
473        #[unsafe(method_family = init)]
474        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
475
476        #[unsafe(method(new))]
477        #[unsafe(method_family = new)]
478        pub unsafe fn new() -> Retained<Self>;
479
480        #[cfg(feature = "AVAssetVariant")]
481        /// Returns the variant selected at the time likely to keep up is achieved. If no value is present, returns nil.
482        #[unsafe(method(variant))]
483        #[unsafe(method_family = none)]
484        pub unsafe fn variant(&self) -> Option<Retained<AVAssetVariant>>;
485
486        /// Returns the total time taken to reach likely to keep up.
487        #[unsafe(method(timeTaken))]
488        #[unsafe(method_family = none)]
489        pub unsafe fn timeTaken(&self) -> NSTimeInterval;
490
491        /// This property provides a collection of time ranges for which the player has the media data readily available. The ranges provided might be discontinuous.
492        ///
493        /// Returns an NSArray of NSValues containing CMTimeRanges.
494        #[unsafe(method(loadedTimeRanges))]
495        #[unsafe(method_family = none)]
496        pub unsafe fn loadedTimeRanges(&self) -> Retained<NSArray<NSValue>>;
497    );
498}
499
500extern_class!(
501    /// Represents a metric event when playback was first likely to play through without stalling.
502    ///
503    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
504    ///
505    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetricplayeriteminitiallikelytokeepupevent?language=objc)
506    #[unsafe(super(AVMetricPlayerItemLikelyToKeepUpEvent, AVMetricEvent, NSObject))]
507    #[derive(Debug, PartialEq, Eq, Hash)]
508    pub struct AVMetricPlayerItemInitialLikelyToKeepUpEvent;
509);
510
511unsafe impl Send for AVMetricPlayerItemInitialLikelyToKeepUpEvent {}
512
513unsafe impl Sync for AVMetricPlayerItemInitialLikelyToKeepUpEvent {}
514
515unsafe impl NSCoding for AVMetricPlayerItemInitialLikelyToKeepUpEvent {}
516
517unsafe impl NSObjectProtocol for AVMetricPlayerItemInitialLikelyToKeepUpEvent {}
518
519unsafe impl NSSecureCoding for AVMetricPlayerItemInitialLikelyToKeepUpEvent {}
520
521impl AVMetricPlayerItemInitialLikelyToKeepUpEvent {
522    extern_methods!(
523        #[unsafe(method(init))]
524        #[unsafe(method_family = init)]
525        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
526
527        #[unsafe(method(new))]
528        #[unsafe(method_family = new)]
529        pub unsafe fn new() -> Retained<Self>;
530
531        /// Returns the playlist request events required to reach likely to keep up.
532        #[unsafe(method(playlistRequestEvents))]
533        #[unsafe(method_family = none)]
534        pub unsafe fn playlistRequestEvents(
535            &self,
536        ) -> Retained<NSArray<AVMetricHLSPlaylistRequestEvent>>;
537
538        /// Returns the media segment request events required to reach likely to keep up.
539        #[unsafe(method(mediaSegmentRequestEvents))]
540        #[unsafe(method_family = none)]
541        pub unsafe fn mediaSegmentRequestEvents(
542            &self,
543        ) -> Retained<NSArray<AVMetricHLSMediaSegmentRequestEvent>>;
544
545        /// Returns the content key request required to reach likely to keep up.
546        #[unsafe(method(contentKeyRequestEvents))]
547        #[unsafe(method_family = none)]
548        pub unsafe fn contentKeyRequestEvents(
549            &self,
550        ) -> Retained<NSArray<AVMetricContentKeyRequestEvent>>;
551    );
552}
553
554extern_class!(
555    /// Represents a metric event when playback rate change occurred.
556    ///
557    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
558    ///
559    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetricplayeritemratechangeevent?language=objc)
560    #[unsafe(super(AVMetricEvent, NSObject))]
561    #[derive(Debug, PartialEq, Eq, Hash)]
562    pub struct AVMetricPlayerItemRateChangeEvent;
563);
564
565unsafe impl Send for AVMetricPlayerItemRateChangeEvent {}
566
567unsafe impl Sync for AVMetricPlayerItemRateChangeEvent {}
568
569unsafe impl NSCoding for AVMetricPlayerItemRateChangeEvent {}
570
571unsafe impl NSObjectProtocol for AVMetricPlayerItemRateChangeEvent {}
572
573unsafe impl NSSecureCoding for AVMetricPlayerItemRateChangeEvent {}
574
575impl AVMetricPlayerItemRateChangeEvent {
576    extern_methods!(
577        #[unsafe(method(init))]
578        #[unsafe(method_family = init)]
579        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
580
581        #[unsafe(method(new))]
582        #[unsafe(method_family = new)]
583        pub unsafe fn new() -> Retained<Self>;
584
585        /// Returns the playback rate after the rate change event.
586        #[unsafe(method(rate))]
587        #[unsafe(method_family = none)]
588        pub unsafe fn rate(&self) -> c_double;
589
590        /// Returns the playback rate before the rate change event.
591        #[unsafe(method(previousRate))]
592        #[unsafe(method_family = none)]
593        pub unsafe fn previousRate(&self) -> c_double;
594
595        #[cfg(feature = "AVAssetVariant")]
596        /// Returns the variant being played at the time of rate change. If no value is present, returns nil.
597        #[unsafe(method(variant))]
598        #[unsafe(method_family = none)]
599        pub unsafe fn variant(&self) -> Option<Retained<AVAssetVariant>>;
600    );
601}
602
603extern_class!(
604    /// Represents a metric event when playback stalled.
605    ///
606    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
607    ///
608    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetricplayeritemstallevent?language=objc)
609    #[unsafe(super(AVMetricPlayerItemRateChangeEvent, AVMetricEvent, NSObject))]
610    #[derive(Debug, PartialEq, Eq, Hash)]
611    pub struct AVMetricPlayerItemStallEvent;
612);
613
614unsafe impl Send for AVMetricPlayerItemStallEvent {}
615
616unsafe impl Sync for AVMetricPlayerItemStallEvent {}
617
618unsafe impl NSCoding for AVMetricPlayerItemStallEvent {}
619
620unsafe impl NSObjectProtocol for AVMetricPlayerItemStallEvent {}
621
622unsafe impl NSSecureCoding for AVMetricPlayerItemStallEvent {}
623
624impl AVMetricPlayerItemStallEvent {
625    extern_methods!(
626        #[unsafe(method(init))]
627        #[unsafe(method_family = init)]
628        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
629
630        #[unsafe(method(new))]
631        #[unsafe(method_family = new)]
632        pub unsafe fn new() -> Retained<Self>;
633    );
634}
635
636extern_class!(
637    /// Represents a metric event when playback seeked.
638    ///
639    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
640    ///
641    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetricplayeritemseekevent?language=objc)
642    #[unsafe(super(AVMetricPlayerItemRateChangeEvent, AVMetricEvent, NSObject))]
643    #[derive(Debug, PartialEq, Eq, Hash)]
644    pub struct AVMetricPlayerItemSeekEvent;
645);
646
647unsafe impl Send for AVMetricPlayerItemSeekEvent {}
648
649unsafe impl Sync for AVMetricPlayerItemSeekEvent {}
650
651unsafe impl NSCoding for AVMetricPlayerItemSeekEvent {}
652
653unsafe impl NSObjectProtocol for AVMetricPlayerItemSeekEvent {}
654
655unsafe impl NSSecureCoding for AVMetricPlayerItemSeekEvent {}
656
657impl AVMetricPlayerItemSeekEvent {
658    extern_methods!(
659        #[unsafe(method(init))]
660        #[unsafe(method_family = init)]
661        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
662
663        #[unsafe(method(new))]
664        #[unsafe(method_family = new)]
665        pub unsafe fn new() -> Retained<Self>;
666    );
667}
668
669extern_class!(
670    /// Represents a metric event when playback seek completed.
671    ///
672    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
673    ///
674    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetricplayeritemseekdidcompleteevent?language=objc)
675    #[unsafe(super(AVMetricPlayerItemRateChangeEvent, AVMetricEvent, NSObject))]
676    #[derive(Debug, PartialEq, Eq, Hash)]
677    pub struct AVMetricPlayerItemSeekDidCompleteEvent;
678);
679
680unsafe impl Send for AVMetricPlayerItemSeekDidCompleteEvent {}
681
682unsafe impl Sync for AVMetricPlayerItemSeekDidCompleteEvent {}
683
684unsafe impl NSCoding for AVMetricPlayerItemSeekDidCompleteEvent {}
685
686unsafe impl NSObjectProtocol for AVMetricPlayerItemSeekDidCompleteEvent {}
687
688unsafe impl NSSecureCoding for AVMetricPlayerItemSeekDidCompleteEvent {}
689
690impl AVMetricPlayerItemSeekDidCompleteEvent {
691    extern_methods!(
692        #[unsafe(method(init))]
693        #[unsafe(method_family = init)]
694        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
695
696        #[unsafe(method(new))]
697        #[unsafe(method_family = new)]
698        pub unsafe fn new() -> Retained<Self>;
699
700        /// Returns whether the seek was performed within the available buffer.
701        #[unsafe(method(didSeekInBuffer))]
702        #[unsafe(method_family = none)]
703        pub unsafe fn didSeekInBuffer(&self) -> bool;
704    );
705}
706
707extern_class!(
708    /// Represents a metric event when variant switch was completed.
709    ///
710    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
711    ///
712    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetricplayeritemvariantswitchevent?language=objc)
713    #[unsafe(super(AVMetricEvent, NSObject))]
714    #[derive(Debug, PartialEq, Eq, Hash)]
715    pub struct AVMetricPlayerItemVariantSwitchEvent;
716);
717
718unsafe impl Send for AVMetricPlayerItemVariantSwitchEvent {}
719
720unsafe impl Sync for AVMetricPlayerItemVariantSwitchEvent {}
721
722unsafe impl NSCoding for AVMetricPlayerItemVariantSwitchEvent {}
723
724unsafe impl NSObjectProtocol for AVMetricPlayerItemVariantSwitchEvent {}
725
726unsafe impl NSSecureCoding for AVMetricPlayerItemVariantSwitchEvent {}
727
728impl AVMetricPlayerItemVariantSwitchEvent {
729    extern_methods!(
730        #[unsafe(method(init))]
731        #[unsafe(method_family = init)]
732        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
733
734        #[unsafe(method(new))]
735        #[unsafe(method_family = new)]
736        pub unsafe fn new() -> Retained<Self>;
737
738        #[cfg(feature = "AVAssetVariant")]
739        /// Returns the variant before the switch. If no value is available, returns nil
740        #[unsafe(method(fromVariant))]
741        #[unsafe(method_family = none)]
742        pub unsafe fn fromVariant(&self) -> Option<Retained<AVAssetVariant>>;
743
744        #[cfg(feature = "AVAssetVariant")]
745        /// Returns the variant after the switch.
746        #[unsafe(method(toVariant))]
747        #[unsafe(method_family = none)]
748        pub unsafe fn toVariant(&self) -> Retained<AVAssetVariant>;
749
750        /// This property provides a collection of time ranges for which the player has the media data readily available. The ranges provided might be discontinuous.
751        ///
752        /// Returns an NSArray of NSValues containing CMTimeRanges.
753        #[unsafe(method(loadedTimeRanges))]
754        #[unsafe(method_family = none)]
755        pub unsafe fn loadedTimeRanges(&self) -> Retained<NSArray<NSValue>>;
756
757        /// Returns if the switch did succeed.
758        #[unsafe(method(didSucceed))]
759        #[unsafe(method_family = none)]
760        pub unsafe fn didSucceed(&self) -> bool;
761    );
762}
763
764extern_class!(
765    /// Represents a metric event when variant switch was attempted.
766    ///
767    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
768    ///
769    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetricplayeritemvariantswitchstartevent?language=objc)
770    #[unsafe(super(AVMetricEvent, NSObject))]
771    #[derive(Debug, PartialEq, Eq, Hash)]
772    pub struct AVMetricPlayerItemVariantSwitchStartEvent;
773);
774
775unsafe impl Send for AVMetricPlayerItemVariantSwitchStartEvent {}
776
777unsafe impl Sync for AVMetricPlayerItemVariantSwitchStartEvent {}
778
779unsafe impl NSCoding for AVMetricPlayerItemVariantSwitchStartEvent {}
780
781unsafe impl NSObjectProtocol for AVMetricPlayerItemVariantSwitchStartEvent {}
782
783unsafe impl NSSecureCoding for AVMetricPlayerItemVariantSwitchStartEvent {}
784
785impl AVMetricPlayerItemVariantSwitchStartEvent {
786    extern_methods!(
787        #[unsafe(method(init))]
788        #[unsafe(method_family = init)]
789        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
790
791        #[unsafe(method(new))]
792        #[unsafe(method_family = new)]
793        pub unsafe fn new() -> Retained<Self>;
794
795        #[cfg(feature = "AVAssetVariant")]
796        /// Returns the variant from which the switch is attempted. If no value is available, returns nil
797        #[unsafe(method(fromVariant))]
798        #[unsafe(method_family = none)]
799        pub unsafe fn fromVariant(&self) -> Option<Retained<AVAssetVariant>>;
800
801        #[cfg(feature = "AVAssetVariant")]
802        /// Returns the variant to which the switch is attempted.
803        #[unsafe(method(toVariant))]
804        #[unsafe(method_family = none)]
805        pub unsafe fn toVariant(&self) -> Retained<AVAssetVariant>;
806
807        /// This property provides a collection of time ranges for which the player has the media data readily available. The ranges provided might be discontinuous.
808        ///
809        /// Returns an NSArray of NSValues containing CMTimeRanges.
810        #[unsafe(method(loadedTimeRanges))]
811        #[unsafe(method_family = none)]
812        pub unsafe fn loadedTimeRanges(&self) -> Retained<NSArray<NSValue>>;
813    );
814}
815
816extern_class!(
817    /// Represents a summary metric event with aggregated metrics for the entire playback session.
818    ///
819    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
820    ///
821    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmetricplayeritemplaybacksummaryevent?language=objc)
822    #[unsafe(super(AVMetricEvent, NSObject))]
823    #[derive(Debug, PartialEq, Eq, Hash)]
824    pub struct AVMetricPlayerItemPlaybackSummaryEvent;
825);
826
827unsafe impl Send for AVMetricPlayerItemPlaybackSummaryEvent {}
828
829unsafe impl Sync for AVMetricPlayerItemPlaybackSummaryEvent {}
830
831unsafe impl NSCoding for AVMetricPlayerItemPlaybackSummaryEvent {}
832
833unsafe impl NSObjectProtocol for AVMetricPlayerItemPlaybackSummaryEvent {}
834
835unsafe impl NSSecureCoding for AVMetricPlayerItemPlaybackSummaryEvent {}
836
837impl AVMetricPlayerItemPlaybackSummaryEvent {
838    extern_methods!(
839        #[unsafe(method(init))]
840        #[unsafe(method_family = init)]
841        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
842
843        #[unsafe(method(new))]
844        #[unsafe(method_family = new)]
845        pub unsafe fn new() -> Retained<Self>;
846
847        /// Returns the error event if any. If no value is available, returns nil.
848        #[unsafe(method(errorEvent))]
849        #[unsafe(method_family = none)]
850        pub unsafe fn errorEvent(&self) -> Option<Retained<AVMetricErrorEvent>>;
851
852        /// Returns the total count of recoverable errors encountered during playback. If no errors were encountered, returns 0.
853        #[unsafe(method(recoverableErrorCount))]
854        #[unsafe(method_family = none)]
855        pub unsafe fn recoverableErrorCount(&self) -> NSInteger;
856
857        /// Returns the total count of stalls encountered during playback. If no stalls were encountered, returns 0.
858        #[unsafe(method(stallCount))]
859        #[unsafe(method_family = none)]
860        pub unsafe fn stallCount(&self) -> NSInteger;
861
862        /// Returns the total count of variant switch encountered during playback.
863        #[unsafe(method(variantSwitchCount))]
864        #[unsafe(method_family = none)]
865        pub unsafe fn variantSwitchCount(&self) -> NSInteger;
866
867        /// Returns the total duration of playback in seconds.
868        #[unsafe(method(playbackDuration))]
869        #[unsafe(method_family = none)]
870        pub unsafe fn playbackDuration(&self) -> NSInteger;
871
872        /// Returns the total number of media requests performed by the player.
873        #[unsafe(method(mediaResourceRequestCount))]
874        #[unsafe(method_family = none)]
875        pub unsafe fn mediaResourceRequestCount(&self) -> NSInteger;
876
877        /// Returns the total time spent recovering from a stall event.
878        #[unsafe(method(timeSpentRecoveringFromStall))]
879        #[unsafe(method_family = none)]
880        pub unsafe fn timeSpentRecoveringFromStall(&self) -> NSTimeInterval;
881
882        /// Returns the total time spent in initial startup of playback.
883        #[unsafe(method(timeSpentInInitialStartup))]
884        #[unsafe(method_family = none)]
885        pub unsafe fn timeSpentInInitialStartup(&self) -> NSTimeInterval;
886
887        /// Returns the playtime weighted average bitrate played in bits / second.
888        #[unsafe(method(timeWeightedAverageBitrate))]
889        #[unsafe(method_family = none)]
890        pub unsafe fn timeWeightedAverageBitrate(&self) -> NSInteger;
891
892        /// Returns the playtime weighted peak bitrate played in bits / second.
893        #[unsafe(method(timeWeightedPeakBitrate))]
894        #[unsafe(method_family = none)]
895        pub unsafe fn timeWeightedPeakBitrate(&self) -> NSInteger;
896    );
897}