objc2_av_foundation/generated/
AVAssetResourceLoader.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::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourceloader?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct AVAssetResourceLoader;
17);
18
19extern_conformance!(
20    unsafe impl NSObjectProtocol for AVAssetResourceLoader {}
21);
22
23impl AVAssetResourceLoader {
24    extern_methods!(
25        #[unsafe(method(init))]
26        #[unsafe(method_family = init)]
27        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
28
29        #[unsafe(method(new))]
30        #[unsafe(method_family = new)]
31        pub unsafe fn new() -> Retained<Self>;
32
33        #[cfg(feature = "dispatch2")]
34        /// Sets the receiver's delegate that will mediate resource loading and the dispatch queue on which delegate methods will be invoked.
35        ///
36        /// Parameter `delegate`: An object conforming to the AVAssetResourceLoaderDelegate protocol.
37        ///
38        /// Parameter `delegateQueue`: A dispatch queue on which all delegate methods will be invoked.
39        ///
40        /// If you employ an AVAssetResourceLoader delegate that loads media data for playback, you should set the value of your AVPlayer’s automaticallyWaitsToMinimizeStalling property to NO. Allowing the value of automaticallyWaitsToMinimizeStalling to remain YES — its default value — when an AVAssetResourceLoader delegate is used for the loading of media data can result in poor start-up times for playback and poor recovery from stalls, because the behaviors provided by AVPlayer when automaticallyWaitsToMinimizeStalling has a value of YES depend on predictions of the future availability of media data that that do not function as expected when data is loaded via a client-controlled means, using the AVAssetResourceLoader delegate interface.
41        ///
42        /// You can allow the value of automaticallyWaitsToMinimizeStalling to remain YES if you use an AVAssetResourceLoader delegate to manage content keys for FairPlay Streaming, to provide dynamically-generated master playlists for HTTP Live Streaming, or to respond to authentication challenges, but not to load media data for playback.
43        ///
44        /// # Safety
45        ///
46        /// `delegate_queue` possibly has additional threading requirements.
47        #[unsafe(method(setDelegate:queue:))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn setDelegate_queue(
50            &self,
51            delegate: Option<&ProtocolObject<dyn AVAssetResourceLoaderDelegate>>,
52            delegate_queue: Option<&DispatchQueue>,
53        );
54
55        /// The receiver's delegate.
56        ///
57        /// The value of this property is an object conforming to the AVAssetResourceLoaderDelegate protocol. The delegate is set using the setDelegate:queue: method. The delegate is held using a zeroing-weak reference, so this property will have a value of nil after a delegate that was previously set has been deallocated.
58        #[unsafe(method(delegate))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn delegate(
61            &self,
62        ) -> Option<Retained<ProtocolObject<dyn AVAssetResourceLoaderDelegate>>>;
63
64        #[cfg(feature = "dispatch2")]
65        /// The dispatch queue on which all delegate methods will be invoked.
66        ///
67        /// The value of this property is a dispatch_queue_t. The queue is set using the setDelegate:queue: method.
68        #[unsafe(method(delegateQueue))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn delegateQueue(&self) -> Option<Retained<DispatchQueue>>;
71    );
72}
73
74extern_protocol!(
75    /// The AVAssetResourceLoaderDelegate protocol defines methods that allow your code to handle resource loading requests coming from an AVURLAsset.
76    ///
77    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourceloaderdelegate?language=objc)
78    pub unsafe trait AVAssetResourceLoaderDelegate: NSObjectProtocol {
79        /// Invoked when assistance is required of the application to load a resource.
80        ///
81        /// Parameter `resourceLoader`: The instance of AVAssetResourceLoader for which the loading request is being made.
82        ///
83        /// Parameter `loadingRequest`: An instance of AVAssetResourceLoadingRequest that provides information about the requested resource.
84        ///
85        /// Returns: YES if the delegate can load the resource indicated by the AVAssetResourceLoadingRequest; otherwise NO.
86        ///
87        /// Delegates receive this message when assistance is required of the application to load a resource. For example, this method is invoked to load decryption keys that have been specified using custom URL schemes.
88        /// If the result is YES, the resource loader expects invocation, either subsequently or immediately, of either -[AVAssetResourceLoadingRequest finishLoading] or -[AVAssetResourceLoadingRequest finishLoadingWithError:]. If you intend to finish loading the resource after your handling of this message returns, you must retain the instance of AVAssetResourceLoadingRequest until after loading is finished.
89        /// If the result is NO, the resource loader treats the loading of the resource as having failed.
90        /// Note that if the delegate's implementation of -resourceLoader:shouldWaitForLoadingOfRequestedResource: returns YES without finishing the loading request immediately, it may be invoked again with another loading request before the prior request is finished; therefore in such cases the delegate should be prepared to manage multiple loading requests.
91        ///
92        /// If an AVURLAsset is added to an AVContentKeySession object and a delegate is set on its AVAssetResourceLoader, that delegate's resourceLoader:shouldWaitForLoadingOfRequestedResource: method must specify which custom URL requests should be handled as content keys. This is done by returning YES and passing either AVStreamingKeyDeliveryPersistentContentKeyType or AVStreamingKeyDeliveryContentKeyType into -[AVAssetResourceLoadingContentInformationRequest setContentType:] and then calling -[AVAssetResourceLoadingRequest finishLoading].
93        #[optional]
94        #[unsafe(method(resourceLoader:shouldWaitForLoadingOfRequestedResource:))]
95        #[unsafe(method_family = none)]
96        unsafe fn resourceLoader_shouldWaitForLoadingOfRequestedResource(
97            &self,
98            resource_loader: &AVAssetResourceLoader,
99            loading_request: &AVAssetResourceLoadingRequest,
100        ) -> bool;
101
102        /// Invoked when assistance is required of the application to renew a resource.
103        ///
104        /// Parameter `resourceLoader`: The instance of AVAssetResourceLoader for which the loading request is being made.
105        ///
106        /// Parameter `renewalRequest`: An instance of AVAssetResourceRenewalRequest that provides information about the requested resource.
107        ///
108        /// Returns: YES if the delegate can renew the resource indicated by the AVAssetResourceLoadingRequest; otherwise NO.
109        ///
110        /// Delegates receive this message when assistance is required of the application to renew a resource previously loaded by resourceLoader:shouldWaitForLoadingOfRequestedResource:. For example, this method is invoked to renew decryption keys that require renewal, as indicated in a response to a prior invocation of resourceLoader:shouldWaitForLoadingOfRequestedResource:.
111        /// If the result is YES, the resource loader expects invocation, either subsequently or immediately, of either -[AVAssetResourceRenewalRequest finishLoading] or -[AVAssetResourceRenewalRequest finishLoadingWithError:]. If you intend to finish loading the resource after your handling of this message returns, you must retain the instance of AVAssetResourceRenewalRequest until after loading is finished.
112        /// If the result is NO, the resource loader treats the loading of the resource as having failed.
113        /// Note that if the delegate's implementation of -resourceLoader:shouldWaitForRenewalOfRequestedResource: returns YES without finishing the loading request immediately, it may be invoked again with another loading request before the prior request is finished; therefore in such cases the delegate should be prepared to manage multiple loading requests.
114        ///
115        /// If an AVURLAsset is added to an AVContentKeySession object and a delegate is set on its AVAssetResourceLoader, that delegate's resourceLoader:shouldWaitForRenewalOfRequestedResource:renewalRequest method must specify which custom URL requests should be handled as content keys. This is done by returning YES and passing either AVStreamingKeyDeliveryPersistentContentKeyType or AVStreamingKeyDeliveryContentKeyType into -[AVAssetResourceLoadingContentInformationRequest setContentType:] and then calling -[AVAssetResourceLoadingRequest finishLoading].
116        #[optional]
117        #[unsafe(method(resourceLoader:shouldWaitForRenewalOfRequestedResource:))]
118        #[unsafe(method_family = none)]
119        unsafe fn resourceLoader_shouldWaitForRenewalOfRequestedResource(
120            &self,
121            resource_loader: &AVAssetResourceLoader,
122            renewal_request: &AVAssetResourceRenewalRequest,
123        ) -> bool;
124
125        /// Informs the delegate that a prior loading request has been cancelled.
126        ///
127        /// Parameter `loadingRequest`: The loading request that has been cancelled.
128        ///
129        /// Previously issued loading requests can be cancelled when data from the resource is no longer required or when a loading request is superseded by new requests for data from the same resource. For example, if to complete a seek operation it becomes necessary to load a range of bytes that's different from a range previously requested, the prior request may be cancelled while the delegate is still handling it.
130        #[optional]
131        #[unsafe(method(resourceLoader:didCancelLoadingRequest:))]
132        #[unsafe(method_family = none)]
133        unsafe fn resourceLoader_didCancelLoadingRequest(
134            &self,
135            resource_loader: &AVAssetResourceLoader,
136            loading_request: &AVAssetResourceLoadingRequest,
137        );
138
139        /// Invoked when assistance is required of the application to respond to an authentication challenge.
140        ///
141        /// Parameter `resourceLoader`: The instance of AVAssetResourceLoader asking for help with an authentication challenge.
142        ///
143        /// Parameter `authenticationChallenge`: An instance of NSURLAuthenticationChallenge.
144        ///
145        /// Delegates receive this message when assistance is required of the application to respond to an authentication challenge.
146        /// If the result is YES, the resource loader expects you to send an appropriate response, either subsequently or immediately, to the NSURLAuthenticationChallenge's sender, i.e. [authenticationChallenge sender], via use of one of the messages defined in the NSURLAuthenticationChallengeSender protocol (see NSAuthenticationChallenge.h). If you intend to respond to the authentication challenge after your handling of -resourceLoader:shouldWaitForResponseToAuthenticationChallenge: returns, you must retain the instance of NSURLAuthenticationChallenge until after your response has been made.
147        #[optional]
148        #[unsafe(method(resourceLoader:shouldWaitForResponseToAuthenticationChallenge:))]
149        #[unsafe(method_family = none)]
150        unsafe fn resourceLoader_shouldWaitForResponseToAuthenticationChallenge(
151            &self,
152            resource_loader: &AVAssetResourceLoader,
153            authentication_challenge: &NSURLAuthenticationChallenge,
154        ) -> bool;
155
156        /// Informs the delegate that a prior authentication challenge has been cancelled.
157        ///
158        /// Parameter `authenticationChallenge`: The authentication challenge that has been cancelled.
159        #[optional]
160        #[unsafe(method(resourceLoader:didCancelAuthenticationChallenge:))]
161        #[unsafe(method_family = none)]
162        unsafe fn resourceLoader_didCancelAuthenticationChallenge(
163            &self,
164            resource_loader: &AVAssetResourceLoader,
165            authentication_challenge: &NSURLAuthenticationChallenge,
166        );
167    }
168);
169
170extern_class!(
171    /// AVAssetResourceLoadingRequestor represents the originator of loading request
172    ///
173    ///
174    /// Information about the originator of a loading request, in order to decide whether or how to fulfill the request.
175    ///
176    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourceloadingrequestor?language=objc)
177    #[unsafe(super(NSObject))]
178    #[derive(Debug, PartialEq, Eq, Hash)]
179    pub struct AVAssetResourceLoadingRequestor;
180);
181
182extern_conformance!(
183    unsafe impl NSObjectProtocol for AVAssetResourceLoadingRequestor {}
184);
185
186impl AVAssetResourceLoadingRequestor {
187    extern_methods!(
188        #[unsafe(method(init))]
189        #[unsafe(method_family = init)]
190        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
191
192        #[unsafe(method(new))]
193        #[unsafe(method_family = new)]
194        pub unsafe fn new() -> Retained<Self>;
195
196        /// Whether the requestor provides expired session reports (see AVContentKeySession)
197        #[unsafe(method(providesExpiredSessionReports))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn providesExpiredSessionReports(&self) -> bool;
200    );
201}
202
203extern_class!(
204    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourceloadingrequest?language=objc)
205    #[unsafe(super(NSObject))]
206    #[derive(Debug, PartialEq, Eq, Hash)]
207    pub struct AVAssetResourceLoadingRequest;
208);
209
210extern_conformance!(
211    unsafe impl NSObjectProtocol for AVAssetResourceLoadingRequest {}
212);
213
214impl AVAssetResourceLoadingRequest {
215    extern_methods!(
216        #[unsafe(method(init))]
217        #[unsafe(method_family = init)]
218        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
219
220        #[unsafe(method(new))]
221        #[unsafe(method_family = new)]
222        pub unsafe fn new() -> Retained<Self>;
223
224        /// An NSURLRequest for the requested resource.
225        #[unsafe(method(request))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn request(&self) -> Retained<NSURLRequest>;
228
229        /// Indicates whether loading of the resource has been finished.
230        ///
231        /// The value of this property becomes YES only in response to an invocation of either -finishLoading or -finishLoadingWithError:.
232        #[unsafe(method(isFinished))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn isFinished(&self) -> bool;
235
236        /// Indicates whether the request has been cancelled.
237        ///
238        /// The value of this property becomes YES when the resource loader cancels the loading of a request, just prior to sending the message -resourceLoader:didCancelLoadingRequest: to its delegate.
239        #[unsafe(method(isCancelled))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn isCancelled(&self) -> bool;
242
243        /// An instance of AVAssetResourceLoadingContentInformationRequest that you must populate with information about the resource before responding to any AVAssetResourceLoadingDataRequests for the resource.  The value of this property will be nil if no such information is being requested.
244        #[unsafe(method(contentInformationRequest))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn contentInformationRequest(
247            &self,
248        ) -> Option<Retained<AVAssetResourceLoadingContentInformationRequest>>;
249
250        /// An instance of AVAssetResourceLoadingDataRequest that indicates the range of resource data that's being requested.  If an AVAssetResourceLoadingContentInformationRequest has been provided, you must set its properties appropriately before responding to any AVAssetResourceLoadingDataRequests.  The value of this property will be nil if no data is being requested.
251        #[unsafe(method(dataRequest))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn dataRequest(&self) -> Option<Retained<AVAssetResourceLoadingDataRequest>>;
254
255        /// Set the value of this property to an instance of NSURLResponse indicating a response to the loading request. If no response is needed, leave the value of this property set to nil.
256        #[unsafe(method(response))]
257        #[unsafe(method_family = none)]
258        pub unsafe fn response(&self) -> Option<Retained<NSURLResponse>>;
259
260        /// Setter for [`response`][Self::response].
261        ///
262        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
263        #[unsafe(method(setResponse:))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn setResponse(&self, response: Option<&NSURLResponse>);
266
267        /// Set the value of this property to an instance of NSURLRequest indicating a redirection of the loading request to another URL. If no redirection is needed, leave the value of this property set to nil.
268        ///
269        /// AVAssetResourceLoader supports redirects to HTTP URLs only. Redirects to other URLs will result in a loading failure.
270        #[unsafe(method(redirect))]
271        #[unsafe(method_family = none)]
272        pub unsafe fn redirect(&self) -> Option<Retained<NSURLRequest>>;
273
274        /// Setter for [`redirect`][Self::redirect].
275        ///
276        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
277        #[unsafe(method(setRedirect:))]
278        #[unsafe(method_family = none)]
279        pub unsafe fn setRedirect(&self, redirect: Option<&NSURLRequest>);
280
281        /// The AVAssetResourceLoadingRequestor that made this request
282        #[unsafe(method(requestor))]
283        #[unsafe(method_family = none)]
284        pub unsafe fn requestor(&self) -> Retained<AVAssetResourceLoadingRequestor>;
285
286        /// Causes the receiver to treat the processing of the request as complete.
287        ///
288        /// If a dataRequest is present, and the resource does not contain the full extent of the data that has been requested according to the values of the requestedOffset and requestedLength properties of the dataRequest, or if requestsAllDataToEndOfResource has a value of YES, -finishLoading may be invoked after providing as much of the requested data as the resource contains. If the contentInformationRequest property is not nil and specifies a non-empty allowedContentTypes array, the contentInformationRequest's contentType property must be set to a value within allowedContentTypes. Otherwise, this method will throw an exception.
289        #[unsafe(method(finishLoading))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn finishLoading(&self);
292
293        /// Causes the receiver to treat the request as having failed.
294        ///
295        /// Parameter `error`: An instance of NSError indicating the reason for failure.
296        #[unsafe(method(finishLoadingWithError:))]
297        #[unsafe(method_family = none)]
298        pub unsafe fn finishLoadingWithError(&self, error: Option<&NSError>);
299    );
300}
301
302extern_class!(
303    /// AVAssetResourceRenewalRequest encapsulates information about a resource request issued by a resource loader for the purpose of renewing a request previously issued.
304    ///
305    ///
306    /// When an AVURLAsset needs to renew a resource (because contentInformationRequest.renewalDate has been set on a previous loading request), it asks its AVAssetResourceLoader object to assist. The resource loader encapsulates the request information by creating an instance of this object, which it then hands to its delegate for processing. The delegate uses the information in this object to perform the request and report on the success or failure of the operation.
307    ///
308    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourcerenewalrequest?language=objc)
309    #[unsafe(super(AVAssetResourceLoadingRequest, NSObject))]
310    #[derive(Debug, PartialEq, Eq, Hash)]
311    pub struct AVAssetResourceRenewalRequest;
312);
313
314extern_conformance!(
315    unsafe impl NSObjectProtocol for AVAssetResourceRenewalRequest {}
316);
317
318impl AVAssetResourceRenewalRequest {
319    extern_methods!();
320}
321
322/// Methods declared on superclass `AVAssetResourceLoadingRequest`.
323impl AVAssetResourceRenewalRequest {
324    extern_methods!(
325        #[unsafe(method(init))]
326        #[unsafe(method_family = init)]
327        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
328
329        #[unsafe(method(new))]
330        #[unsafe(method_family = new)]
331        pub unsafe fn new() -> Retained<Self>;
332    );
333}
334
335extern_class!(
336    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourceloadingcontentinformationrequest?language=objc)
337    #[unsafe(super(NSObject))]
338    #[derive(Debug, PartialEq, Eq, Hash)]
339    pub struct AVAssetResourceLoadingContentInformationRequest;
340);
341
342extern_conformance!(
343    unsafe impl NSObjectProtocol for AVAssetResourceLoadingContentInformationRequest {}
344);
345
346impl AVAssetResourceLoadingContentInformationRequest {
347    extern_methods!(
348        #[unsafe(method(init))]
349        #[unsafe(method_family = init)]
350        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
351
352        #[unsafe(method(new))]
353        #[unsafe(method_family = new)]
354        pub unsafe fn new() -> Retained<Self>;
355
356        /// A UTI that indicates the type of data contained by the requested resource.
357        ///
358        /// Before you finish loading an AVAssetResourceLoadingRequest, if its contentInformationRequest is not nil, you should set the value of this property to a UTI indicating the type of data contained by the requested resource.
359        #[unsafe(method(contentType))]
360        #[unsafe(method_family = none)]
361        pub unsafe fn contentType(&self) -> Option<Retained<NSString>>;
362
363        /// Setter for [`contentType`][Self::contentType].
364        ///
365        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
366        #[unsafe(method(setContentType:))]
367        #[unsafe(method_family = none)]
368        pub unsafe fn setContentType(&self, content_type: Option<&NSString>);
369
370        /// An array showing the types of data which will be accepted as a valid response for the requested resource.
371        ///
372        /// If an AVAssetResourceLoadingRequest's contentInformationRequest is not nil, ensure that the value assigned to the contentType property is in this array. Otherwise, calling -finishLoading on the associated request will result in an exception.
373        #[unsafe(method(allowedContentTypes))]
374        #[unsafe(method_family = none)]
375        pub unsafe fn allowedContentTypes(&self) -> Option<Retained<NSArray<NSString>>>;
376
377        /// Indicates the length of the requested resource, in bytes.
378        ///
379        /// Before you finish loading an AVAssetResourceLoadingRequest, if its contentInformationRequest is not nil, you should set the value of this property to the number of bytes contained by the requested resource.
380        #[unsafe(method(contentLength))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn contentLength(&self) -> c_longlong;
383
384        /// Setter for [`contentLength`][Self::contentLength].
385        #[unsafe(method(setContentLength:))]
386        #[unsafe(method_family = none)]
387        pub unsafe fn setContentLength(&self, content_length: c_longlong);
388
389        /// Indicates whether random access to arbitrary ranges of bytes of the resource is supported. Such support also allows portions of the resource to be requested more than once.
390        ///
391        /// Before you finish loading an AVAssetResourceLoadingRequest, if its contentInformationRequest is not nil, you should set the value of this property to YES if you support random access to arbitrary ranges of bytes of the resource. If you do not set this property to YES for resources that must be loaded incrementally, loading of the resource may fail. Such resources include anything that contains media data.
392        #[unsafe(method(isByteRangeAccessSupported))]
393        #[unsafe(method_family = none)]
394        pub unsafe fn isByteRangeAccessSupported(&self) -> bool;
395
396        /// Setter for [`isByteRangeAccessSupported`][Self::isByteRangeAccessSupported].
397        #[unsafe(method(setByteRangeAccessSupported:))]
398        #[unsafe(method_family = none)]
399        pub unsafe fn setByteRangeAccessSupported(&self, byte_range_access_supported: bool);
400
401        /// For resources that expire, the date at which a new AVAssetResourceLoadingRequest will be issued for a renewal of this resource, if the media system still requires it.
402        ///
403        /// Before you finish loading an AVAssetResourceLoadingRequest, if the resource is prone to expiry you should set the value of this property to the date at which a renewal should be triggered. This value should be set sufficiently early enough to allow an AVAssetResourceRenewalRequest, delivered to your delegate via -resourceLoader:shouldWaitForRenewalOfRequestedResource:, to finish before the actual expiry time. Otherwise media playback may fail.
404        #[unsafe(method(renewalDate))]
405        #[unsafe(method_family = none)]
406        pub unsafe fn renewalDate(&self) -> Option<Retained<NSDate>>;
407
408        /// Setter for [`renewalDate`][Self::renewalDate].
409        ///
410        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
411        #[unsafe(method(setRenewalDate:))]
412        #[unsafe(method_family = none)]
413        pub unsafe fn setRenewalDate(&self, renewal_date: Option<&NSDate>);
414
415        /// Indicates whether asset data loading can expect data to be produced immediately.
416        ///
417        /// Before you finish loading an AVAssetResourceLoadingRequest, if its contentInformationRequest is not nil, you may set this property to YES to indicate that all asset data can be produced immediately, e.g., because the data is fully cached, or because the custom URL scheme ultimately refers to files on local storage. This allows significant data flow optimizations. For backward compatibility, this property defaults to NO.
418        #[unsafe(method(isEntireLengthAvailableOnDemand))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn isEntireLengthAvailableOnDemand(&self) -> bool;
421
422        /// Setter for [`isEntireLengthAvailableOnDemand`][Self::isEntireLengthAvailableOnDemand].
423        #[unsafe(method(setEntireLengthAvailableOnDemand:))]
424        #[unsafe(method_family = none)]
425        pub unsafe fn setEntireLengthAvailableOnDemand(
426            &self,
427            entire_length_available_on_demand: bool,
428        );
429    );
430}
431
432extern_class!(
433    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourceloadingdatarequest?language=objc)
434    #[unsafe(super(NSObject))]
435    #[derive(Debug, PartialEq, Eq, Hash)]
436    pub struct AVAssetResourceLoadingDataRequest;
437);
438
439extern_conformance!(
440    unsafe impl NSObjectProtocol for AVAssetResourceLoadingDataRequest {}
441);
442
443impl AVAssetResourceLoadingDataRequest {
444    extern_methods!(
445        #[unsafe(method(init))]
446        #[unsafe(method_family = init)]
447        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
448
449        #[unsafe(method(new))]
450        #[unsafe(method_family = new)]
451        pub unsafe fn new() -> Retained<Self>;
452
453        /// The position within the resource of the first byte requested.
454        #[unsafe(method(requestedOffset))]
455        #[unsafe(method_family = none)]
456        pub unsafe fn requestedOffset(&self) -> c_longlong;
457
458        /// The length of the data requested.
459        ///
460        /// Note that requestsAllDataToEndOfResource will be set to YES when the entire remaining length of the resource is being requested from requestedOffset to the end of the resource. This can occur even when the content length has not yet been reported by you via a prior finished loading request.
461        /// When requestsAllDataToEndOfResource has a value of YES, you should disregard the value of requestedLength and incrementally provide as much data starting from the requestedOffset as the resource contains, until you have provided all of the available data successfully and invoked -finishLoading, until you have encountered a failure and invoked -finishLoadingWithError:, or until you have received -resourceLoader:didCancelLoadingRequest: for the AVAssetResourceLoadingRequest from which the AVAssetResourceLoadingDataRequest was obtained.
462        /// When requestsAllDataToEndOfResource is YES and the content length has not yet been provided by you via a prior finished loading request, the value of requestedLength is set to NSIntegerMax. Starting in macOS 10.11 and iOS 9.0, in 32-bit applications requestedLength is also set to NSIntegerMax when all of the remaining resource data is being requested and the known length of the remaining data exceeds NSIntegerMax.
463        #[unsafe(method(requestedLength))]
464        #[unsafe(method_family = none)]
465        pub unsafe fn requestedLength(&self) -> NSInteger;
466
467        /// Specifies that the entire remaining length of the resource from requestedOffset to the end of the resource is being requested.
468        ///
469        /// When requestsAllDataToEndOfResource has a value of YES, you should disregard the value of requestedLength and incrementally provide as much data starting from the requestedOffset as the resource contains, until you have provided all of the available data successfully and invoked -finishLoading, until you have encountered a failure and invoked -finishLoadingWithError:, or until you have received -resourceLoader:didCancelLoadingRequest: for the AVAssetResourceLoadingRequest from which the AVAssetResourceLoadingDataRequest was obtained.
470        #[unsafe(method(requestsAllDataToEndOfResource))]
471        #[unsafe(method_family = none)]
472        pub unsafe fn requestsAllDataToEndOfResource(&self) -> bool;
473
474        /// The position within the resource of the next byte within the resource following the bytes that have already been provided via prior invocations of -respondWithData.
475        #[unsafe(method(currentOffset))]
476        #[unsafe(method_family = none)]
477        pub unsafe fn currentOffset(&self) -> c_longlong;
478
479        /// Provides data to the receiver.
480        ///
481        /// Parameter `data`: An instance of NSData containing some or all of the requested bytes.
482        ///
483        /// May be invoked multiple times on the same instance of AVAssetResourceLoadingDataRequest to provide the full range of requested data incrementally. Upon each invocation, the value of currentOffset will be updated to accord with the amount of data provided.
484        /// The instance of NSData that you provide may be retained for use in parsing or other processing for an indefinite period of time after this method returns. For this reason, if you are providing an instance of NSMutableData, you should avoid mutating it further after sharing its contents. If you are managing your own memory pool for I/O and resource loading, consider using -[NSData initWithBytesNoCopy:length:deallocator:] in order to receive notification of the earliest opportunity for safe recycling of the underlying memory.
485        #[unsafe(method(respondWithData:))]
486        #[unsafe(method_family = none)]
487        pub unsafe fn respondWithData(&self, data: &NSData);
488    );
489}
490
491/// AVAssetResourceLoaderContentKeySupport.
492impl AVAssetResourceLoader {
493    extern_methods!(
494        /// When YES, eligible content keys will be loaded as eagerly as possible, potentially handled by the delegate. Setting to YES may result in network activity.
495        ///
496        /// Any work done as a result of setting this property will be performed asynchronously.
497        #[unsafe(method(preloadsEligibleContentKeys))]
498        #[unsafe(method_family = none)]
499        pub unsafe fn preloadsEligibleContentKeys(&self) -> bool;
500
501        /// Setter for [`preloadsEligibleContentKeys`][Self::preloadsEligibleContentKeys].
502        #[unsafe(method(setPreloadsEligibleContentKeys:))]
503        #[unsafe(method_family = none)]
504        pub unsafe fn setPreloadsEligibleContentKeys(&self, preloads_eligible_content_keys: bool);
505    );
506}
507
508/// AVAssetResourceLoaderCommonMediaClientDataSupport.
509impl AVAssetResourceLoader {
510    extern_methods!(
511        #[unsafe(method(sendsCommonMediaClientDataAsHTTPHeaders))]
512        #[unsafe(method_family = none)]
513        pub unsafe fn sendsCommonMediaClientDataAsHTTPHeaders(&self) -> bool;
514
515        /// Setter for [`sendsCommonMediaClientDataAsHTTPHeaders`][Self::sendsCommonMediaClientDataAsHTTPHeaders].
516        #[unsafe(method(setSendsCommonMediaClientDataAsHTTPHeaders:))]
517        #[unsafe(method_family = none)]
518        pub unsafe fn setSendsCommonMediaClientDataAsHTTPHeaders(
519            &self,
520            sends_common_media_client_data_as_http_headers: bool,
521        );
522    );
523}
524
525/// AVAssetResourceLoadingRequestContentKeyRequestSupport.
526#[deprecated = "AVAssetResourceLoader based key loading is no longer supported, transition to AVContentKeySession"]
527impl AVAssetResourceLoadingRequest {
528    extern_methods!(
529        /// Obtains a streaming content key request for a specific combination of application and content.
530        ///
531        /// Parameter `appIdentifier`: An opaque identifier for the application. The value of this identifier depends on the particular system used to provide the decryption key.
532        ///
533        /// Parameter `contentIdentifier`: An opaque identifier for the content. The value of this identifier depends on the particular system used to provide the decryption key.
534        ///
535        /// Parameter `options`: Additional information necessary to obtain the key, or nil if none.
536        ///
537        /// Parameter `outError`: If obtaining the streaming content key request fails, will be set to an instance of NSError describing the failure.
538        ///
539        /// Returns: The key request data that must be transmitted to the key vendor to obtain the content key.
540        ///
541        /// # Safety
542        ///
543        /// `options` generic should be of the correct type.
544        #[deprecated = "Use -[AVContentKeyRequest makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler:] instead"]
545        #[unsafe(method(streamingContentKeyRequestDataForApp:contentIdentifier:options:error:_))]
546        #[unsafe(method_family = none)]
547        pub unsafe fn streamingContentKeyRequestDataForApp_contentIdentifier_options_error(
548            &self,
549            app_identifier: &NSData,
550            content_identifier: &NSData,
551            options: Option<&NSDictionary<NSString, AnyObject>>,
552        ) -> Result<Retained<NSData>, Retained<NSError>>;
553
554        /// Obtains a persistable content key from a context.
555        ///
556        /// Parameter `keyVendorResponse`: The response returned from the key vendor as a result of a request generated from streamingContentKeyRequestDataForApp:contentIdentifier:options:error:.
557        ///
558        /// Parameter `options`: Additional information necessary to obtain the persistable content key, or nil if none.
559        ///
560        /// Parameter `outError`: If obtaining the persistable content key fails, will be set to an instance of NSError describing the failure.
561        ///
562        /// Returns: The persistable content key data that may be stored offline to answer future loading requests of the same content key.
563        ///
564        /// The data returned from this method may be used to immediately satisfy an AVAssetResourceLoadingDataRequest, as well as any subsequent requests for the same key url. The value of AVAssetResourceLoadingContentInformationRequest.contentType must be set to AVStreamingKeyDeliveryPersistentContentKeyType when responding with data created with this method.
565        ///
566        /// # Safety
567        ///
568        /// `options` generic should be of the correct type.
569        #[deprecated = "Use -[AVPersistableContentKeyRequest persistableContentKeyFromKeyVendorResponse:options:error:] instead"]
570        #[unsafe(method(persistentContentKeyFromKeyVendorResponse:options:error:_))]
571        #[unsafe(method_family = none)]
572        pub unsafe fn persistentContentKeyFromKeyVendorResponse_options_error(
573            &self,
574            key_vendor_response: &NSData,
575            options: Option<&NSDictionary<NSString, AnyObject>>,
576        ) -> Result<Retained<NSData>, Retained<NSError>>;
577    );
578}
579
580extern "C" {
581    /// Specifies whether the content key request should require a persistable key to be returned from the key vendor. Value should be a NSNumber created with +[NSNumber numberWithBool:].
582    ///
583    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourceloadingrequeststreamingcontentkeyrequestrequirespersistentkey?language=objc)
584    #[deprecated = "Use -[AVPersistableContentKeyRequest persistableContentKeyFromKeyVendorResponse:options:error:] instead"]
585    pub static AVAssetResourceLoadingRequestStreamingContentKeyRequestRequiresPersistentKey:
586        &'static NSString;
587}
588
589/// AVAssetResourceLoadingRequestDeprecated.
590impl AVAssetResourceLoadingRequest {
591    extern_methods!(
592        /// Causes the receiver to finish loading a resource that a delegate has previously assumed responsibility for loading by returning YES as the result of -resourceLoader:shouldWaitForLoadingOfRequestedResource:.
593        ///
594        /// Parameter `response`: The NSURLResponse for the NSURLRequest of the receiver. Should be nil if no response is required.
595        ///
596        /// Parameter `data`: An instance of NSData containing the data of the resource. Should be nil if no such data is available.
597        ///
598        /// Parameter `redirect`: An instance of NSURLRequest indicating a redirect of the loading request. Should be nil if no redirect is needed.
599        ///
600        /// This method is deprecated. Use the following methods instead.
601        /// -[AVAssetResourceLoadingRequest setResponse:] to set the response property,
602        /// -[AVAssetResourceLoadingRequest setRedirect:] to set the redirect property,
603        /// -[AVAssetResourceLoadingDataRequest respondWithData:] to provide data, and
604        /// -[AVAssetResourceLoadingRequest finishLoading] to indicate that loading is finished.
605        #[deprecated = "Use -[AVAssetResourceLoadingRequest setResponse:], -[AVAssetResourceLoadingRequest setRedirect:], -[AVAssetResourceLoadingDataRequest respondWithData:], -[AVAssetResourceLoadingRequest finishLoading]"]
606        #[unsafe(method(finishLoadingWithResponse:data:redirect:))]
607        #[unsafe(method_family = none)]
608        pub unsafe fn finishLoadingWithResponse_data_redirect(
609            &self,
610            response: Option<&NSURLResponse>,
611            data: Option<&NSData>,
612            redirect: Option<&NSURLRequest>,
613        );
614    );
615}