objc2_av_foundation/generated/
AVContentKeySession.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "dispatch2")]
6use dispatch2::*;
7use objc2::__framework_prelude::*;
8#[cfg(feature = "objc2-core-media")]
9use objc2_core_media::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14/// AVContentKeySystem string constants
15///
16/// Used by AVContentKeySession to determine the method of key delivery
17///
18/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeysystem?language=objc)
19// NS_TYPED_ENUM
20pub type AVContentKeySystem = NSString;
21
22extern "C" {
23    /// Used to specify FairPlay Streaming (FPS) as the method of key delivery.
24    ///
25    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeysystemfairplaystreaming?language=objc)
26    pub static AVContentKeySystemFairPlayStreaming: &'static AVContentKeySystem;
27}
28
29extern "C" {
30    /// Used to specify clear key as the method of key delivery.
31    ///
32    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeysystemclearkey?language=objc)
33    pub static AVContentKeySystemClearKey: &'static AVContentKeySystem;
34}
35
36extern "C" {
37    /// Used to specify a token that could be used to authorize playback of associated content key recipients.
38    ///
39    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeysystemauthorizationtoken?language=objc)
40    pub static AVContentKeySystemAuthorizationToken: &'static AVContentKeySystem;
41}
42
43/// Options keys used to specify additional information for generating server playback context (SPC) in
44/// -[AVContentKeySession invalidatePersistableContentKey:options:completionHandler:] and
45/// -[AVContentKeySession invalidateAllPersistableContentKeysForApp:options:completionHandler:]
46///
47/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeysessionserverplaybackcontextoption?language=objc)
48// NS_TYPED_ENUM
49pub type AVContentKeySessionServerPlaybackContextOption = NSString;
50
51extern "C" {
52    /// Specifies the versions of the content protection protocol supported by the application; as an NSArray of one or more NSNumber objects. If this option is not set, an appropriate protocol version will be selected based on sideband information such as an associated HLS playlist. If such information is not available, a protocol version of 1 is assumed
53    ///
54    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeysessionserverplaybackcontextoptionprotocolversions?language=objc)
55    pub static AVContentKeySessionServerPlaybackContextOptionProtocolVersions:
56        &'static AVContentKeySessionServerPlaybackContextOption;
57}
58
59extern "C" {
60    /// Specifies a nonce as a 8-byte NSData object to be included in the secure server playback context (SPC) in order to prevent replay attacks. If not specified default server challenge of 0 is assumed.
61    ///
62    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeysessionserverplaybackcontextoptionserverchallenge?language=objc)
63    pub static AVContentKeySessionServerPlaybackContextOptionServerChallenge:
64        &'static AVContentKeySessionServerPlaybackContextOption;
65}
66
67extern_class!(
68    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeysession?language=objc)
69    #[unsafe(super(NSObject))]
70    #[derive(Debug, PartialEq, Eq, Hash)]
71    pub struct AVContentKeySession;
72);
73
74unsafe impl Send for AVContentKeySession {}
75
76unsafe impl Sync for AVContentKeySession {}
77
78extern_conformance!(
79    unsafe impl NSObjectProtocol for AVContentKeySession {}
80);
81
82impl AVContentKeySession {
83    extern_methods!(
84        #[unsafe(method(init))]
85        #[unsafe(method_family = init)]
86        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
87
88        #[unsafe(method(new))]
89        #[unsafe(method_family = new)]
90        pub unsafe fn new() -> Retained<Self>;
91
92        /// Creates a new instance of AVContentKeySession to manage a collection of media content keys.
93        ///
94        /// Parameter `keySystem`: A valid key system for retrieving keys.
95        ///
96        /// Returns: A new AVContentKeySession.
97        ///
98        /// This method returns an AVContentKeySession instance that is capable of managing collection of media content keys corresponding to the input keySystem. An NSInvalidArgumentException will be raised if the value of keySystem is unsupported.
99        #[unsafe(method(contentKeySessionWithKeySystem:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn contentKeySessionWithKeySystem(
102            key_system: &AVContentKeySystem,
103        ) -> Retained<Self>;
104
105        /// Creates a new instance of AVContentKeySession to manage a collection of media content keys.
106        ///
107        /// Parameter `keySystem`: A valid key system for retrieving keys.
108        ///
109        /// Parameter `storageURL`: URL to a writable directory that the session will use to facilitate expired session reports after abnormal session termination.
110        ///
111        /// Returns: A new AVContentKeySession.
112        ///
113        /// This method returns an AVContentKeySession instance that is capable of managing collection of media content keys corresponding to the input keySystem. An NSInvalidArgumentException will be raised if the value of keySystem is unsupported.
114        #[unsafe(method(contentKeySessionWithKeySystem:storageDirectoryAtURL:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn contentKeySessionWithKeySystem_storageDirectoryAtURL(
117            key_system: &AVContentKeySystem,
118            storage_url: &NSURL,
119        ) -> Retained<Self>;
120
121        #[cfg(feature = "dispatch2")]
122        /// Sets the receiver's delegate. A delegate is required to handle content key initialization.
123        ///
124        /// Parameter `delegate`: An object conforming to the AVContentKeySessionDelegate protocol.
125        ///
126        /// Parameter `delegateQueue`: A dispatch queue on which delegate methods will be invoked whenever processes requiring content keys are executed asynchronously. Passing a value of nil for the delegateQueue parameter along with a non-nil value for the delegate parameter will result in an invalid argument exception.
127        #[unsafe(method(setDelegate:queue:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn setDelegate_queue(
130            &self,
131            delegate: Option<&ProtocolObject<dyn AVContentKeySessionDelegate>>,
132            delegate_queue: Option<&DispatchQueue>,
133        );
134
135        /// The receiver's delegate.
136        ///
137        /// The value of this property is an object conforming to the AVContentKeySessionDelegate protocol. The delegate is set using the setDelegate:queue: method.
138        #[unsafe(method(delegate))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn delegate(
141            &self,
142        ) -> Option<Retained<ProtocolObject<dyn AVContentKeySessionDelegate>>>;
143
144        #[cfg(feature = "dispatch2")]
145        /// The dispatch queue on which all delegate methods will be invoked whenever processes requiring content keys are executed asynchronously.
146        ///
147        /// The value of this property is a dispatch_queue_t. The queue is set using the setDelegate:queue: method.
148        #[unsafe(method(delegateQueue))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn delegateQueue(&self) -> Option<Retained<DispatchQueue>>;
151
152        /// The storage URL provided when the AVContentKeySession was created. May be nil.
153        ///
154        /// URL to a writable directory; may be nil. The session will use this to facilitate expired session reports after abnormal session termination.
155        #[unsafe(method(storageURL))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn storageURL(&self) -> Option<Retained<NSURL>>;
158
159        /// The key system used for retrieving keys
160        #[unsafe(method(keySystem))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn keySystem(&self) -> Retained<AVContentKeySystem>;
163
164        /// Tells the receiver to treat the session as having been intentionally and normally expired.
165        ///
166        /// When an instance of AVContentKeySession receives an expire message, all of its associated objects conforming to the AVContentKeyRecipient protocol will become inoperable. Send this message only after you have finished operating on the media data.
167        #[unsafe(method(expire))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn expire(&self);
170
171        /// An opaque identifier for the current content protection session.
172        ///
173        /// May be nil. Will call the delegate's contentKeySessionContentProtectionSessionIdentifierDidChange: when the identifier changes. The protection session ID is a unique string identifier generated by the AVContentKeySession that can be used by the application to identify content key session objects.
174        #[unsafe(method(contentProtectionSessionIdentifier))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn contentProtectionSessionIdentifier(&self) -> Option<Retained<NSData>>;
177
178        /// Informs the receiver that it should attempt to instantiate a content decryption key using the specified initialization data.
179        ///
180        /// Parameter `identifier`: Container- and protocol-specific identifier to be used to obtain a key response. Either identifier or initializationData must be non-nil. Both can be non-nil, if the content protection protocol requires both.
181        ///
182        /// Parameter `initializationData`: Container- and protocol-specific data to be used to obtain a key response. Either identifier or initializationData must be non-nil. Both can be non-nil, if the content protection protocol requires both.
183        ///
184        /// Parameter `options`: Additional information necessary to obtain the key, or nil if none. See AVContentKeyRequest*Key below.
185        ///
186        /// May be used to generate an AVContentKeyRequest from request initialization data already in hand, without awaiting such data during the processing of media data of an associated recipient.
187        #[unsafe(method(processContentKeyRequestWithIdentifier:initializationData:options:))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn processContentKeyRequestWithIdentifier_initializationData_options(
190            &self,
191            identifier: Option<&AnyObject>,
192            initialization_data: Option<&NSData>,
193            options: Option<&NSDictionary<NSString, AnyObject>>,
194        );
195
196        /// Informs the receiver that the already provided response data for an earlier AVContentKeyRequest will imminently expire.
197        ///
198        /// In response the receiver will invoke your delegate with a new content key request entreating it to renew the expiring response data, via -contentKeySession:didProvideRenewingContentKeyRequest:.
199        #[unsafe(method(renewExpiringResponseDataForContentKeyRequest:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn renewExpiringResponseDataForContentKeyRequest(
202            &self,
203            content_key_request: &AVContentKeyRequest,
204        );
205
206        #[cfg(feature = "block2")]
207        /// Creates a secure server playback context (SPC) that the client could send to the key server to obtain an expiration date for the provided persistable content key data.
208        ///
209        /// Parameter `persistableContentKeyData`: Persistable content key data that was previously created using -[AVContentKeyRequest persistableContentKeyFromKeyVendorResponse:options:error:] or obtained via AVContentKeySessionDelegate callback -contentKeySession:didUpdatePersistableContentKey:forContentKeyIdentifier:.
210        ///
211        /// Parameter `handler`: Once the secure token is ready, this block will be called with the token or an error describing the failure.
212        #[unsafe(method(makeSecureTokenForExpirationDateOfPersistableContentKey:completionHandler:))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn makeSecureTokenForExpirationDateOfPersistableContentKey_completionHandler(
215            &self,
216            persistable_content_key_data: &NSData,
217            handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
218        );
219
220        #[cfg(feature = "block2")]
221        /// Invalidates the persistable content key and creates a secure server playback context (SPC) that the client could send to the key server to verify the outcome of invalidation request.
222        ///
223        /// Parameter `persistableContentKeyData`: Persistable content key data that was previously created using -[AVContentKeyRequest persistableContentKeyFromKeyVendorResponse:options:error:] or obtained via AVContentKeySessionDelegate callback -contentKeySession:didUpdatePersistableContentKey:forContentKeyIdentifier:.
224        ///
225        /// Parameter `options`: Additional information necessary to generate the server playback context, or nil if none. See AVContentKeySessionServerPlaybackContextOption for supported options.
226        ///
227        /// Parameter `handler`: Once the server playback context is ready, this block will be called with the data or an error describing the failure.
228        ///
229        /// Once invalidated, a persistable content key cannot be used to answer key requests during later playback sessions.
230        #[unsafe(method(invalidatePersistableContentKey:options:completionHandler:))]
231        #[unsafe(method_family = none)]
232        pub unsafe fn invalidatePersistableContentKey_options_completionHandler(
233            &self,
234            persistable_content_key_data: &NSData,
235            options: Option<
236                &NSDictionary<AVContentKeySessionServerPlaybackContextOption, AnyObject>,
237            >,
238            handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
239        );
240
241        #[cfg(feature = "block2")]
242        /// Invalidates all persistable content keys associated with the application and creates a secure server playback context (SPC) that the client could send to the key server to verify the outcome of invalidation request.
243        ///
244        /// Parameter `appIdentifier`: An opaque identifier for the application. The contents of this identifier depend on the particular protocol in use by the entity that controls the use of the media data.
245        ///
246        /// Parameter `options`: Additional information necessary to generate the server playback context, or nil if none. See AVContentKeySessionServerPlaybackContextOption for supported options.
247        ///
248        /// Parameter `handler`: Once the server playback context is ready, this block will be called with the data or an error describing the failure.
249        ///
250        /// Once invalidated, persistable content keys cannot be used to answer key requests during later playback sessions.
251        #[unsafe(method(invalidateAllPersistableContentKeysForApp:options:completionHandler:))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn invalidateAllPersistableContentKeysForApp_options_completionHandler(
254            &self,
255            app_identifier: &NSData,
256            options: Option<
257                &NSDictionary<AVContentKeySessionServerPlaybackContextOption, AnyObject>,
258            >,
259            handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
260        );
261    );
262}
263
264/// AVContentKeyRecipients.
265impl AVContentKeySession {
266    extern_methods!(
267        /// Informs the receiver that the specified recipient will be used for the session.
268        ///
269        /// It is an error to add recipient to sessions that have received an expire message. It is also an error to add recipients after they have already begun to process media data (e.g. after an AVURLAsset has loaded the values of any of its keys). Such errors will result in NSInternalInconsistencyExceptions. Sending this message to an AVContentKeySession is atomic.
270        #[unsafe(method(addContentKeyRecipient:))]
271        #[unsafe(method_family = none)]
272        pub unsafe fn addContentKeyRecipient(
273            &self,
274            recipient: &ProtocolObject<dyn AVContentKeyRecipient>,
275        );
276
277        /// Informs the receiver that the specified recipient will no longer be used.
278        ///
279        /// After the specified recipient is removed from the receiver it will become inoperable. Remove the recipient only after you have finished operating on the media data associated with it. Sending this message to an AVContentKeySession is atomic.
280        #[unsafe(method(removeContentKeyRecipient:))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn removeContentKeyRecipient(
283            &self,
284            recipient: &ProtocolObject<dyn AVContentKeyRecipient>,
285        );
286
287        /// The array of recipients of content keys currently associated with the AVContentKeySession.
288        #[unsafe(method(contentKeyRecipients))]
289        #[unsafe(method_family = none)]
290        pub unsafe fn contentKeyRecipients(
291            &self,
292        ) -> Retained<NSArray<ProtocolObject<dyn AVContentKeyRecipient>>>;
293    );
294}
295
296/// AVContentKeySessionPendingExpiredSessionReports.
297impl AVContentKeySession {
298    extern_methods!(
299        /// Provides "expired session reports" for prior AVContentKeySessions created with the specified app identifier that have expired either normally or abnormally.
300        ///
301        /// Parameter `appIdentifier`: An opaque identifier for the application. The contents of this identifier depend on the particular protocol in use by the entity that controls the use of the media data.
302        ///
303        /// Parameter `storageURL`: URL to a directory previously used with one or more instances of AVContentKeySession for the storage of expired session reports.
304        ///
305        /// Returns: An NSArray containing instances of NSData, each containing a pending expired session report as a property-list serialization of an NSDictionary object. The contents of expired session reports depend on the particular protocol in use by the entity that controls the use of the media data.
306        ///
307        /// Note that no reports for sessions still in progress will be included.
308        #[unsafe(method(pendingExpiredSessionReportsWithAppIdentifier:storageDirectoryAtURL:))]
309        #[unsafe(method_family = none)]
310        pub unsafe fn pendingExpiredSessionReportsWithAppIdentifier_storageDirectoryAtURL(
311            app_identifier: &NSData,
312            storage_url: &NSURL,
313        ) -> Retained<NSArray<NSData>>;
314
315        /// Removes expired session reports for prior AVContentKeySessions from storage. Once they have been removed, they will no longer be available via subsequent invocations of +pendingExpiredSessionReportsWithAppIdentifier:.
316        ///
317        /// Parameter `expiredSessionReports`: An array of expired session reports to be discarded.
318        ///
319        /// Parameter `appIdentifier`: An opaque identifier for the application. The contents of this identifier depend on the particular protocol in use by the entity that controls the use of the media data.
320        ///
321        /// Parameter `storageURL`: URL to a writable folder.
322        ///
323        /// This method is most suitable for use only after the specified expired session reports have been sent to the entity that controls the use of the media data and the entity has acknowledged their receipt.
324        #[unsafe(method(removePendingExpiredSessionReports:withAppIdentifier:storageDirectoryAtURL:))]
325        #[unsafe(method_family = none)]
326        pub unsafe fn removePendingExpiredSessionReports_withAppIdentifier_storageDirectoryAtURL(
327            expired_session_reports: &NSArray<NSData>,
328            app_identifier: &NSData,
329            storage_url: &NSURL,
330        );
331    );
332}
333
334/// AVContentKeyRequestRetryReason string constants
335///
336/// Used to specify a reason for asking the client to retry a content key request.
337///
338/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeyrequestretryreason?language=objc)
339// NS_TYPED_ENUM
340pub type AVContentKeyRequestRetryReason = NSString;
341
342extern "C" {
343    /// Indicates that the content key request should be retried because the key response was not set soon enough either due the initial request/response was taking too long, or a lease was expiring in the meantime.
344    ///
345    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeyrequestretryreasontimedout?language=objc)
346    pub static AVContentKeyRequestRetryReasonTimedOut: &'static AVContentKeyRequestRetryReason;
347}
348
349extern "C" {
350    /// Indicates that the content key request should be retried because a key response with expired lease was set on the previous content key request.
351    ///
352    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeyrequestretryreasonreceivedresponsewithexpiredlease?language=objc)
353    pub static AVContentKeyRequestRetryReasonReceivedResponseWithExpiredLease:
354        &'static AVContentKeyRequestRetryReason;
355}
356
357extern "C" {
358    /// Indicates that the content key request should be retried because an obsolete key response was set on the previous content key request.
359    ///
360    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeyrequestretryreasonreceivedobsoletecontentkey?language=objc)
361    pub static AVContentKeyRequestRetryReasonReceivedObsoleteContentKey:
362        &'static AVContentKeyRequestRetryReason;
363}
364
365extern_protocol!(
366    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeysessiondelegate?language=objc)
367    pub unsafe trait AVContentKeySessionDelegate: NSObjectProtocol {
368        #[unsafe(method(contentKeySession:didProvideContentKeyRequest:))]
369        #[unsafe(method_family = none)]
370        unsafe fn contentKeySession_didProvideContentKeyRequest(
371            &self,
372            session: &AVContentKeySession,
373            key_request: &AVContentKeyRequest,
374        );
375
376        #[optional]
377        #[unsafe(method(contentKeySession:didProvideRenewingContentKeyRequest:))]
378        #[unsafe(method_family = none)]
379        unsafe fn contentKeySession_didProvideRenewingContentKeyRequest(
380            &self,
381            session: &AVContentKeySession,
382            key_request: &AVContentKeyRequest,
383        );
384
385        #[optional]
386        #[unsafe(method(contentKeySession:didProvidePersistableContentKeyRequest:))]
387        #[unsafe(method_family = none)]
388        unsafe fn contentKeySession_didProvidePersistableContentKeyRequest(
389            &self,
390            session: &AVContentKeySession,
391            key_request: &AVPersistableContentKeyRequest,
392        );
393
394        #[optional]
395        #[unsafe(method(contentKeySession:didUpdatePersistableContentKey:forContentKeyIdentifier:))]
396        #[unsafe(method_family = none)]
397        unsafe fn contentKeySession_didUpdatePersistableContentKey_forContentKeyIdentifier(
398            &self,
399            session: &AVContentKeySession,
400            persistable_content_key: &NSData,
401            key_identifier: &AnyObject,
402        );
403
404        #[optional]
405        #[unsafe(method(contentKeySession:contentKeyRequest:didFailWithError:))]
406        #[unsafe(method_family = none)]
407        unsafe fn contentKeySession_contentKeyRequest_didFailWithError(
408            &self,
409            session: &AVContentKeySession,
410            key_request: &AVContentKeyRequest,
411            err: &NSError,
412        );
413
414        #[optional]
415        #[unsafe(method(contentKeySession:shouldRetryContentKeyRequest:reason:))]
416        #[unsafe(method_family = none)]
417        unsafe fn contentKeySession_shouldRetryContentKeyRequest_reason(
418            &self,
419            session: &AVContentKeySession,
420            key_request: &AVContentKeyRequest,
421            retry_reason: &AVContentKeyRequestRetryReason,
422        ) -> bool;
423
424        #[optional]
425        #[unsafe(method(contentKeySession:contentKeyRequestDidSucceed:))]
426        #[unsafe(method_family = none)]
427        unsafe fn contentKeySession_contentKeyRequestDidSucceed(
428            &self,
429            session: &AVContentKeySession,
430            key_request: &AVContentKeyRequest,
431        );
432
433        #[optional]
434        #[unsafe(method(contentKeySessionContentProtectionSessionIdentifierDidChange:))]
435        #[unsafe(method_family = none)]
436        unsafe fn contentKeySessionContentProtectionSessionIdentifierDidChange(
437            &self,
438            session: &AVContentKeySession,
439        );
440
441        #[optional]
442        #[unsafe(method(contentKeySessionDidGenerateExpiredSessionReport:))]
443        #[unsafe(method_family = none)]
444        unsafe fn contentKeySessionDidGenerateExpiredSessionReport(
445            &self,
446            session: &AVContentKeySession,
447        );
448
449        #[optional]
450        #[unsafe(method(contentKeySession:externalProtectionStatusDidChangeForContentKey:))]
451        #[unsafe(method_family = none)]
452        unsafe fn contentKeySession_externalProtectionStatusDidChangeForContentKey(
453            &self,
454            session: &AVContentKeySession,
455            content_key: &AVContentKey,
456        );
457
458        #[optional]
459        #[unsafe(method(contentKeySession:didProvideContentKeyRequests:forInitializationData:))]
460        #[unsafe(method_family = none)]
461        unsafe fn contentKeySession_didProvideContentKeyRequests_forInitializationData(
462            &self,
463            session: &AVContentKeySession,
464            key_requests: &NSArray<AVContentKeyRequest>,
465            initialization_data: Option<&NSData>,
466        );
467    }
468);
469
470/// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeyrequeststatus?language=objc)
471// NS_ENUM
472#[repr(transparent)]
473#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
474pub struct AVContentKeyRequestStatus(pub NSInteger);
475impl AVContentKeyRequestStatus {
476    #[doc(alias = "AVContentKeyRequestStatusRequestingResponse")]
477    pub const RequestingResponse: Self = Self(0);
478    #[doc(alias = "AVContentKeyRequestStatusReceivedResponse")]
479    pub const ReceivedResponse: Self = Self(1);
480    #[doc(alias = "AVContentKeyRequestStatusRenewed")]
481    pub const Renewed: Self = Self(2);
482    #[doc(alias = "AVContentKeyRequestStatusRetried")]
483    pub const Retried: Self = Self(3);
484    #[doc(alias = "AVContentKeyRequestStatusCancelled")]
485    pub const Cancelled: Self = Self(4);
486    #[doc(alias = "AVContentKeyRequestStatusFailed")]
487    pub const Failed: Self = Self(5);
488}
489
490unsafe impl Encode for AVContentKeyRequestStatus {
491    const ENCODING: Encoding = NSInteger::ENCODING;
492}
493
494unsafe impl RefEncode for AVContentKeyRequestStatus {
495    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
496}
497
498extern "C" {
499    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeyrequestrequiresvalidationdatainsecuretokenkey?language=objc)
500    pub static AVContentKeyRequestRequiresValidationDataInSecureTokenKey: &'static NSString;
501}
502
503extern_class!(
504    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
505    ///
506    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeyrequest?language=objc)
507    #[unsafe(super(NSObject))]
508    #[derive(Debug, PartialEq, Eq, Hash)]
509    pub struct AVContentKeyRequest;
510);
511
512unsafe impl Send for AVContentKeyRequest {}
513
514unsafe impl Sync for AVContentKeyRequest {}
515
516extern_conformance!(
517    unsafe impl NSObjectProtocol for AVContentKeyRequest {}
518);
519
520impl AVContentKeyRequest {
521    extern_methods!(
522        /// This describes the state of the AVContentKeyRequest, value is one of AVContentKeyRequestStatus.
523        #[unsafe(method(status))]
524        #[unsafe(method_family = none)]
525        pub unsafe fn status(&self) -> AVContentKeyRequestStatus;
526
527        /// If the receiver's status is AVContentKeyRequestStatusFailed, this describes the error that caused the failure.
528        ///
529        /// The value of this property is an NSError that describes what caused the content key request to fail. If the receiver's status is not AVContentKeyRequestStatusFailed, the value of this property is nil.
530        #[unsafe(method(error))]
531        #[unsafe(method_family = none)]
532        pub unsafe fn error(&self) -> Option<Retained<NSError>>;
533
534        #[unsafe(method(identifier))]
535        #[unsafe(method_family = none)]
536        pub unsafe fn identifier(&self) -> Option<Retained<AnyObject>>;
537
538        #[unsafe(method(initializationData))]
539        #[unsafe(method_family = none)]
540        pub unsafe fn initializationData(&self) -> Option<Retained<NSData>>;
541
542        #[unsafe(method(options))]
543        #[unsafe(method_family = none)]
544        pub unsafe fn options(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
545
546        #[unsafe(method(canProvidePersistableContentKey))]
547        #[unsafe(method_family = none)]
548        pub unsafe fn canProvidePersistableContentKey(&self) -> bool;
549
550        #[unsafe(method(contentKeySpecifier))]
551        #[unsafe(method_family = none)]
552        pub unsafe fn contentKeySpecifier(&self) -> Retained<AVContentKeySpecifier>;
553
554        #[unsafe(method(contentKey))]
555        #[unsafe(method_family = none)]
556        pub unsafe fn contentKey(&self) -> Option<Retained<AVContentKey>>;
557
558        #[cfg(feature = "block2")]
559        /// Obtains a content key request data for a specific combination of application and content.
560        ///
561        /// Parameter `appIdentifier`: An opaque identifier for the application. The value of this identifier depends on the particular system used to provide the content key.
562        ///
563        /// Parameter `contentIdentifier`: An optional opaque identifier for the content. The value of this identifier depends on the particular system used to provide the content key.
564        ///
565        /// Parameter `options`: Additional information necessary to obtain the key, or nil if none. See AVContentKeyRequest*Key below.
566        ///
567        /// Parameter `handler`: Once the streaming content key request is prepared, this block will be called with the request data or an error describing the failure.
568        ///
569        /// If option AVContentKeyRequestProtocolVersionsKey is not specified the default protocol version of 1 is assumed.
570        #[unsafe(method(makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler:))]
571        #[unsafe(method_family = none)]
572        pub unsafe fn makeStreamingContentKeyRequestDataForApp_contentIdentifier_options_completionHandler(
573            &self,
574            app_identifier: &NSData,
575            content_identifier: Option<&NSData>,
576            options: Option<&NSDictionary<NSString, AnyObject>>,
577            handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
578        );
579
580        /// Informs the receiver to process the specified content key response.
581        ///
582        /// Parameter `keyResponse`: An instance of AVContentKeyResponse carrying a response to a content key request.
583        ///
584        /// After you receive an AVContentKeyRequest via -contentKeySession:didProvideContentKeyRequest: and after you invoke -[AVContentKeyRequest makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler:] on that request, you must obtain a response to the request in accordance with the protocol in use by the entity that controls the use of the media data. This is the method you use to provide the content key response to make protected content available for processing. If obtaining the content key response fails, use -processContentKeyResponseError:.
585        #[unsafe(method(processContentKeyResponse:))]
586        #[unsafe(method_family = none)]
587        pub unsafe fn processContentKeyResponse(&self, key_response: &AVContentKeyResponse);
588
589        /// Informs the receiver that obtaining a content key response has failed, resulting in failure handling.
590        ///
591        /// Parameter `error`: An instance of NSError that describes the specific failure that occurred.
592        #[unsafe(method(processContentKeyResponseError:))]
593        #[unsafe(method_family = none)]
594        pub unsafe fn processContentKeyResponseError(&self, error: &NSError);
595
596        /// Informs the receiver to process a persistable content key request.
597        ///
598        /// When you receive an AVContentKeyRequest via -contentKeySession:didProvideContentKeyRequest: and you want the resulting key response to produce a key that can persist across multiple playback sessions, you must invoke -respondByRequestingPersistableContentKeyRequest on that AVContentKeyRequest in order to signal that you want to process an AVPersistableContentKeyRequest instead. If the underlying protocol supports persistable content keys, in response your delegate will receive an AVPersistableContentKeyRequest via -contentKeySession:didProvidePersistableContentKeyRequest:. NSInternalInconsistencyException will be raised, if you are attempting to create and use a persistable key but your AVContentKeySession delegate does not respond to contentKeySession:didProvidePersistableContentKeyRequest:.
599        #[deprecated]
600        #[unsafe(method(respondByRequestingPersistableContentKeyRequest))]
601        #[unsafe(method_family = none)]
602        pub unsafe fn respondByRequestingPersistableContentKeyRequest(&self);
603
604        #[unsafe(method(respondByRequestingPersistableContentKeyRequestAndReturnError:_))]
605        #[unsafe(method_family = none)]
606        pub unsafe fn respondByRequestingPersistableContentKeyRequestAndReturnError(
607            &self,
608        ) -> Result<(), Retained<NSError>>;
609    );
610}
611
612/// Methods declared on superclass `NSObject`.
613impl AVContentKeyRequest {
614    extern_methods!(
615        #[unsafe(method(init))]
616        #[unsafe(method_family = init)]
617        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
618
619        #[unsafe(method(new))]
620        #[unsafe(method_family = new)]
621        pub unsafe fn new() -> Retained<Self>;
622    );
623}
624
625extern_class!(
626    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
627    ///
628    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avpersistablecontentkeyrequest?language=objc)
629    #[unsafe(super(AVContentKeyRequest, NSObject))]
630    #[derive(Debug, PartialEq, Eq, Hash)]
631    pub struct AVPersistableContentKeyRequest;
632);
633
634unsafe impl Send for AVPersistableContentKeyRequest {}
635
636unsafe impl Sync for AVPersistableContentKeyRequest {}
637
638extern_conformance!(
639    unsafe impl NSObjectProtocol for AVPersistableContentKeyRequest {}
640);
641
642impl AVPersistableContentKeyRequest {
643    extern_methods!(
644        /// Obtains a persistable content key from a context.
645        ///
646        /// Parameter `keyVendorResponse`: The response returned from the key vendor as a result of a request generated from makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler:.
647        ///
648        /// Parameter `options`: Additional information necessary to obtain the persistable content key, or nil if none.
649        ///
650        /// Parameter `outError`: If obtaining the persistable content key fails, will be set to an instance of NSError describing the failure.
651        ///
652        /// Returns: The persistable content key data that may be stored offline to answer future loading requests of the same content key.
653        ///
654        /// The data returned from this method may be used to immediately satisfy an AVPersistableContentKeyRequest, as well as any subsequent requests for the same key url using processContentKeyResponse: method. When you receive an AVContentKeyRequest via -contentKeySession:didProvideContentKeyRequest: and you want to use existing persistent content key from storage, you must invoke -respondByRequestingPersistableContentKeyRequest on that AVContentKeyRequest in order to signal that you want to process an AVPersistableContentKeyRequest instead. If the underlying protocol supports persistable content keys, in response your delegate will receive an AVPersistableContentKeyRequest via -contentKeySession:didProvidePersistableContentKeyRequest:. You can set the persistent key from storage on the AVPersistableContentKeyRequest using processContentKeyResponse:.
655        #[unsafe(method(persistableContentKeyFromKeyVendorResponse:options:error:_))]
656        #[unsafe(method_family = none)]
657        pub unsafe fn persistableContentKeyFromKeyVendorResponse_options_error(
658            &self,
659            key_vendor_response: &NSData,
660            options: Option<&NSDictionary<NSString, AnyObject>>,
661        ) -> Result<Retained<NSData>, Retained<NSError>>;
662    );
663}
664
665/// Methods declared on superclass `NSObject`.
666impl AVPersistableContentKeyRequest {
667    extern_methods!(
668        #[unsafe(method(init))]
669        #[unsafe(method_family = init)]
670        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
671
672        #[unsafe(method(new))]
673        #[unsafe(method_family = new)]
674        pub unsafe fn new() -> Retained<Self>;
675    );
676}
677
678/// AVContentKeyRequestRenewal.
679impl AVContentKeyRequest {
680    extern_methods!(
681        #[unsafe(method(renewsExpiringResponseData))]
682        #[unsafe(method_family = none)]
683        pub unsafe fn renewsExpiringResponseData(&self) -> bool;
684    );
685}
686
687extern_class!(
688    /// AVContentKeyResponse is used to represent the data returned from the key server when requesting a key for decrypting content.
689    ///
690    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
691    ///
692    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeyresponse?language=objc)
693    #[unsafe(super(NSObject))]
694    #[derive(Debug, PartialEq, Eq, Hash)]
695    pub struct AVContentKeyResponse;
696);
697
698unsafe impl Send for AVContentKeyResponse {}
699
700unsafe impl Sync for AVContentKeyResponse {}
701
702extern_conformance!(
703    unsafe impl NSObjectProtocol for AVContentKeyResponse {}
704);
705
706impl AVContentKeyResponse {
707    extern_methods!(
708        /// Create an AVContentKeyResponse from the server response to a key request made when using FairPlayStreaming (FPS) as the method of key delivery.
709        ///
710        /// Parameter `keyResponseData`: The response from the FairPlayStreaming key server
711        ///
712        /// Returns: A new AVContentKeyResponse holding data from a FairPlayStreaming key server that is used to decrypt the content
713        ///
714        /// The object created by this method is typically used with an AVContentKeyRequest created by an AVContentKeySession using keySystem AVContentKeySystemFairPlayStreaming. It is passed to AVContentKeyRequest -processContentKeyResponse: in order to supply the decryptor with key data
715        #[unsafe(method(contentKeyResponseWithFairPlayStreamingKeyResponseData:))]
716        #[unsafe(method_family = none)]
717        pub unsafe fn contentKeyResponseWithFairPlayStreamingKeyResponseData(
718            key_response_data: &NSData,
719        ) -> Retained<Self>;
720
721        /// Create an AVContentKeyResponse from the key and IV when using AVContentKeySystemClearKey as the key system
722        ///
723        ///
724        /// Parameter `keyData`: The key used for decrypting content.
725        ///
726        /// Parameter `initializationVector`: The initialization vector used for decrypting content, or nil if initialization vector is available in the media to be decrypted
727        ///
728        /// Returns: A new AVContentKeyResponse holding Clear Key data.
729        ///
730        /// The object created by this method is typically used with an AVContentKeyRequest created by an AVContentKeySession using keySystem AVContentKeySystemClearKey. It is passed to AVContentKeyRequest -processContentKeyResponse: in order to supply the decryptor with key data.
731        #[unsafe(method(contentKeyResponseWithClearKeyData:initializationVector:))]
732        #[unsafe(method_family = none)]
733        pub unsafe fn contentKeyResponseWithClearKeyData_initializationVector(
734            key_data: &NSData,
735            initialization_vector: Option<&NSData>,
736        ) -> Retained<Self>;
737
738        /// Create an AVContentKeyResponse from authorization token data when using AVContentKeySystemAuthorizationToken key system.
739        ///
740        /// Parameter `authorizationTokenData`: Data blob containing the authorization token.
741        ///
742        /// Returns: A new AVContentKeyResponse holding the authorization token data.
743        ///
744        /// The object created by this method is typically used with an AVContentKeyRequest created by an AVContentKeySession using keySystem AVContentKeySystemAuthorizationToken. It is passed to AVContentKeyRequest -processContentKeyResponse: in order to supply the authorization token data.
745        #[unsafe(method(contentKeyResponseWithAuthorizationTokenData:))]
746        #[unsafe(method_family = none)]
747        pub unsafe fn contentKeyResponseWithAuthorizationTokenData(
748            authorization_token_data: &NSData,
749        ) -> Retained<Self>;
750    );
751}
752
753/// Methods declared on superclass `NSObject`.
754impl AVContentKeyResponse {
755    extern_methods!(
756        #[unsafe(method(init))]
757        #[unsafe(method_family = init)]
758        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
759
760        #[unsafe(method(new))]
761        #[unsafe(method_family = new)]
762        pub unsafe fn new() -> Retained<Self>;
763    );
764}
765
766extern "C" {
767    /// Specifies the versions of the content protection protocol supported by the application as an NSArray of one or more NSNumber objects.
768    ///
769    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeyrequestprotocolversionskey?language=objc)
770    pub static AVContentKeyRequestProtocolVersionsKey: &'static NSString;
771}
772
773extern_protocol!(
774    /// Classes of objects that may require decryption keys for media data in order to enable processing, such as parsing or playback, conform to this protocol.
775    ///
776    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeyrecipient?language=objc)
777    pub unsafe trait AVContentKeyRecipient {
778        /// Informs the receiver that an AVContentKey has been obtained as the result of an invocation of -[AVContentKeyRequest processContentKeyResponse:].
779        ///
780        /// The recipient may employ the AVContentKey for use with objects that support manual attachment of keys, such as CMSampleBuffer via an invocation of AVSampleBufferAttachContentKey.
781        #[optional]
782        #[unsafe(method(contentKeySession:didProvideContentKey:))]
783        #[unsafe(method_family = none)]
784        unsafe fn contentKeySession_didProvideContentKey(
785            &self,
786            content_key_session: &AVContentKeySession,
787            content_key: &AVContentKey,
788        );
789
790        /// Indicates whether the receiver may require decryption keys for media data in order to enable processing.
791        ///
792        /// When the value of mayRequireContentKeysForMediaDataProcessing is YES, adding the receiver to an AVContentKeySession allows it to employ the session's already existing keys and also enables the handling of new key requests by the AVContentKeySession's delegate.
793        #[unsafe(method(mayRequireContentKeysForMediaDataProcessing))]
794        #[unsafe(method_family = none)]
795        unsafe fn mayRequireContentKeysForMediaDataProcessing(&self) -> bool;
796    }
797);
798
799extern_class!(
800    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
801    ///
802    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkeyspecifier?language=objc)
803    #[unsafe(super(NSObject))]
804    #[derive(Debug, PartialEq, Eq, Hash)]
805    pub struct AVContentKeySpecifier;
806);
807
808unsafe impl Send for AVContentKeySpecifier {}
809
810unsafe impl Sync for AVContentKeySpecifier {}
811
812extern_conformance!(
813    unsafe impl NSObjectProtocol for AVContentKeySpecifier {}
814);
815
816impl AVContentKeySpecifier {
817    extern_methods!(
818        /// Creates a new instance of AVContentKeySpecifier.
819        ///
820        /// Parameter `keySystem`: A valid key system for content keys.
821        ///
822        /// Parameter `contentKeyIdentifier`: Container and protocol-specific key identifier.
823        ///
824        /// Parameter `options`: Additional information necessary to obtain the key, can be empty if none needed.
825        ///
826        /// Returns: A new AVContentKeySpecifier
827        ///
828        /// This method returns an AVContentKeySpecifier instance that represents a content key in a specific content key system.
829        #[unsafe(method(contentKeySpecifierForKeySystem:identifier:options:))]
830        #[unsafe(method_family = none)]
831        pub unsafe fn contentKeySpecifierForKeySystem_identifier_options(
832            key_system: &AVContentKeySystem,
833            content_key_identifier: &AnyObject,
834            options: &NSDictionary<NSString, AnyObject>,
835        ) -> Retained<Self>;
836
837        /// Initialize an instance of AVContentKeySpecifier.
838        ///
839        /// Parameter `keySystem`: A valid key system for content keys.
840        ///
841        /// Parameter `contentKeyIdentifier`: Container and protocol-specific key identifier.
842        ///
843        /// Parameter `options`: Additional information necessary to obtain the key, can be empty if none needed.
844        ///
845        /// Returns: An instance of AVContentKeySpecifier
846        ///
847        /// This method returns an AVContentKeySpecifier instance that represents a content key in a specific content key system.
848        #[unsafe(method(initForKeySystem:identifier:options:))]
849        #[unsafe(method_family = init)]
850        pub unsafe fn initForKeySystem_identifier_options(
851            this: Allocated<Self>,
852            key_system: &AVContentKeySystem,
853            content_key_identifier: &AnyObject,
854            options: &NSDictionary<NSString, AnyObject>,
855        ) -> Retained<Self>;
856
857        /// A valid key system for content keys.
858        #[unsafe(method(keySystem))]
859        #[unsafe(method_family = none)]
860        pub unsafe fn keySystem(&self) -> Retained<AVContentKeySystem>;
861
862        /// Container and protocol-specific key identifier.
863        #[unsafe(method(identifier))]
864        #[unsafe(method_family = none)]
865        pub unsafe fn identifier(&self) -> Retained<AnyObject>;
866
867        #[unsafe(method(options))]
868        #[unsafe(method_family = none)]
869        pub unsafe fn options(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
870    );
871}
872
873/// Methods declared on superclass `NSObject`.
874impl AVContentKeySpecifier {
875    extern_methods!(
876        #[unsafe(method(init))]
877        #[unsafe(method_family = init)]
878        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
879
880        #[unsafe(method(new))]
881        #[unsafe(method_family = new)]
882        pub unsafe fn new() -> Retained<Self>;
883    );
884}
885
886/// The constants can be used to derive whether or not we have established sufficient protection to display content protected by this AVContentKey on some set of attached displays.
887///
888///
889/// Indicates that the current protection status has not yet been discovered for the attached display(s).
890///
891/// Indicates that sufficient protection with the attached display(s) has been established, content protected by the associated AVContentKey will be eligible to be displayed on the display(s).
892///
893/// Indicates that sufficient protection with the attached display(s) has failed to be established, content protected by the associated AVContentKey will not be displayed.
894///
895/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avexternalcontentprotectionstatus?language=objc)
896// NS_ENUM
897#[repr(transparent)]
898#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
899pub struct AVExternalContentProtectionStatus(pub NSInteger);
900impl AVExternalContentProtectionStatus {
901    #[doc(alias = "AVExternalContentProtectionStatusPending")]
902    pub const Pending: Self = Self(0);
903    #[doc(alias = "AVExternalContentProtectionStatusSufficient")]
904    pub const Sufficient: Self = Self(1);
905    #[doc(alias = "AVExternalContentProtectionStatusInsufficient")]
906    pub const Insufficient: Self = Self(2);
907}
908
909unsafe impl Encode for AVExternalContentProtectionStatus {
910    const ENCODING: Encoding = NSInteger::ENCODING;
911}
912
913unsafe impl RefEncode for AVExternalContentProtectionStatus {
914    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
915}
916
917extern_class!(
918    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
919    ///
920    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcontentkey?language=objc)
921    #[unsafe(super(NSObject))]
922    #[derive(Debug, PartialEq, Eq, Hash)]
923    pub struct AVContentKey;
924);
925
926unsafe impl Send for AVContentKey {}
927
928unsafe impl Sync for AVContentKey {}
929
930extern_conformance!(
931    unsafe impl NSObjectProtocol for AVContentKey {}
932);
933
934impl AVContentKey {
935    extern_methods!(
936        #[unsafe(method(contentKeySpecifier))]
937        #[unsafe(method_family = none)]
938        pub unsafe fn contentKeySpecifier(&self) -> Retained<AVContentKeySpecifier>;
939
940        /// The external protection status for the AVContentKey based on all attached displays.
941        ///
942        /// This property is not key-value observable, instead the contentKeySession:externalProtectionStatusDidChangeForContentKey: delegate method should be used.
943        #[unsafe(method(externalContentProtectionStatus))]
944        #[unsafe(method_family = none)]
945        pub unsafe fn externalContentProtectionStatus(&self) -> AVExternalContentProtectionStatus;
946
947        /// Revokes the decryption context of the content key, and removes it from its associated AVContentKeySession.
948        ///
949        /// Once revoked, the AVContentKey is no longer eligible to be used with any media.
950        /// If the key is required again, or if the key is requested to be loaded by the application, a new AVContentKeyRequest will be dispatched to the delegate.
951        /// If there is media playback occurring which is dependent on the content key it will fail and may result in an error being generated with the playback halting.
952        #[unsafe(method(revoke))]
953        #[unsafe(method_family = none)]
954        pub unsafe fn revoke(&self);
955    );
956}
957
958/// Methods declared on superclass `NSObject`.
959impl AVContentKey {
960    extern_methods!(
961        #[unsafe(method(init))]
962        #[unsafe(method_family = init)]
963        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
964
965        #[unsafe(method(new))]
966        #[unsafe(method_family = new)]
967        pub unsafe fn new() -> Retained<Self>;
968    );
969}
970
971/// Attaches an AVContentKey to a CMSampleBuffer for the purpose of content decryption.
972///
973/// Parameter `sbuf`: The sample buffer to which the content key is to be attached.
974///
975/// Parameter `contentKey`: The content key to be attached.
976///
977/// Parameter `outError`: If the result is NO and errorOut is non-NULL, the location referenced by errorOut receives an instance of NSError that describes the reason for failure to attach the content key.
978///
979/// The client is expected to attach AVContentKeys to CMSampleBuffers that have been created by the client for enqueueing with AVSampleBufferDisplayLayer or AVSampleBufferAudioRenderer, for which the AVContentKeySpecifier matches indications of suitability that are available to the client according to the content key system that's in use.
980#[cfg(feature = "objc2-core-media")]
981#[inline]
982pub unsafe extern "C-unwind" fn AVSampleBufferAttachContentKey(
983    sbuf: &CMSampleBuffer,
984    content_key: &AVContentKey,
985    out_error: *mut *mut NSError,
986) -> bool {
987    extern "C-unwind" {
988        fn AVSampleBufferAttachContentKey(
989            sbuf: &CMSampleBuffer,
990            content_key: &AVContentKey,
991            out_error: *mut *mut NSError,
992        ) -> Bool;
993    }
994    unsafe { AVSampleBufferAttachContentKey(sbuf, content_key, out_error) }.as_bool()
995}