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;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourceloader?language=objc)
12 #[unsafe(super(NSObject))]
13 #[derive(Debug, PartialEq, Eq, Hash)]
14 pub struct AVAssetResourceLoader;
15);
16
17unsafe impl NSObjectProtocol for AVAssetResourceLoader {}
18
19impl AVAssetResourceLoader {
20 extern_methods!(
21 #[unsafe(method(init))]
22 #[unsafe(method_family = init)]
23 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
24
25 #[unsafe(method(new))]
26 #[unsafe(method_family = new)]
27 pub unsafe fn new() -> Retained<Self>;
28
29 /// The receiver's delegate.
30 ///
31 /// 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.
32 #[unsafe(method(delegate))]
33 #[unsafe(method_family = none)]
34 pub unsafe fn delegate(
35 &self,
36 ) -> Option<Retained<ProtocolObject<dyn AVAssetResourceLoaderDelegate>>>;
37 );
38}
39
40extern_protocol!(
41 /// The AVAssetResourceLoaderDelegate protocol defines methods that allow your code to handle resource loading requests coming from an AVURLAsset.
42 ///
43 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourceloaderdelegate?language=objc)
44 pub unsafe trait AVAssetResourceLoaderDelegate: NSObjectProtocol {
45 /// Invoked when assistance is required of the application to load a resource.
46 ///
47 /// Parameter `resourceLoader`: The instance of AVAssetResourceLoader for which the loading request is being made.
48 ///
49 /// Parameter `loadingRequest`: An instance of AVAssetResourceLoadingRequest that provides information about the requested resource.
50 ///
51 /// Returns: YES if the delegate can load the resource indicated by the AVAssetResourceLoadingRequest; otherwise NO.
52 ///
53 /// 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.
54 /// 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.
55 /// If the result is NO, the resource loader treats the loading of the resource as having failed.
56 /// 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.
57 ///
58 /// 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].
59 #[optional]
60 #[unsafe(method(resourceLoader:shouldWaitForLoadingOfRequestedResource:))]
61 #[unsafe(method_family = none)]
62 unsafe fn resourceLoader_shouldWaitForLoadingOfRequestedResource(
63 &self,
64 resource_loader: &AVAssetResourceLoader,
65 loading_request: &AVAssetResourceLoadingRequest,
66 ) -> bool;
67
68 /// Invoked when assistance is required of the application to renew a resource.
69 ///
70 /// Parameter `resourceLoader`: The instance of AVAssetResourceLoader for which the loading request is being made.
71 ///
72 /// Parameter `renewalRequest`: An instance of AVAssetResourceRenewalRequest that provides information about the requested resource.
73 ///
74 /// Returns: YES if the delegate can renew the resource indicated by the AVAssetResourceLoadingRequest; otherwise NO.
75 ///
76 /// 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:.
77 /// 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.
78 /// If the result is NO, the resource loader treats the loading of the resource as having failed.
79 /// 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.
80 ///
81 /// 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].
82 #[optional]
83 #[unsafe(method(resourceLoader:shouldWaitForRenewalOfRequestedResource:))]
84 #[unsafe(method_family = none)]
85 unsafe fn resourceLoader_shouldWaitForRenewalOfRequestedResource(
86 &self,
87 resource_loader: &AVAssetResourceLoader,
88 renewal_request: &AVAssetResourceRenewalRequest,
89 ) -> bool;
90
91 /// Informs the delegate that a prior loading request has been cancelled.
92 ///
93 /// Parameter `loadingRequest`: The loading request that has been cancelled.
94 ///
95 /// 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.
96 #[optional]
97 #[unsafe(method(resourceLoader:didCancelLoadingRequest:))]
98 #[unsafe(method_family = none)]
99 unsafe fn resourceLoader_didCancelLoadingRequest(
100 &self,
101 resource_loader: &AVAssetResourceLoader,
102 loading_request: &AVAssetResourceLoadingRequest,
103 );
104
105 /// Invoked when assistance is required of the application to respond to an authentication challenge.
106 ///
107 /// Parameter `resourceLoader`: The instance of AVAssetResourceLoader asking for help with an authentication challenge.
108 ///
109 /// Parameter `authenticationChallenge`: An instance of NSURLAuthenticationChallenge.
110 ///
111 /// Delegates receive this message when assistance is required of the application to respond to an authentication challenge.
112 /// 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.
113 #[optional]
114 #[unsafe(method(resourceLoader:shouldWaitForResponseToAuthenticationChallenge:))]
115 #[unsafe(method_family = none)]
116 unsafe fn resourceLoader_shouldWaitForResponseToAuthenticationChallenge(
117 &self,
118 resource_loader: &AVAssetResourceLoader,
119 authentication_challenge: &NSURLAuthenticationChallenge,
120 ) -> bool;
121
122 /// Informs the delegate that a prior authentication challenge has been cancelled.
123 ///
124 /// Parameter `authenticationChallenge`: The authentication challenge that has been cancelled.
125 #[optional]
126 #[unsafe(method(resourceLoader:didCancelAuthenticationChallenge:))]
127 #[unsafe(method_family = none)]
128 unsafe fn resourceLoader_didCancelAuthenticationChallenge(
129 &self,
130 resource_loader: &AVAssetResourceLoader,
131 authentication_challenge: &NSURLAuthenticationChallenge,
132 );
133 }
134);
135
136extern_class!(
137 /// AVAssetResourceLoadingRequestor represents the originator of loading request
138 ///
139 ///
140 /// Information about the originator of a loading request, in order to decide whether or how to fulfill the request.
141 ///
142 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourceloadingrequestor?language=objc)
143 #[unsafe(super(NSObject))]
144 #[derive(Debug, PartialEq, Eq, Hash)]
145 pub struct AVAssetResourceLoadingRequestor;
146);
147
148unsafe impl NSObjectProtocol for AVAssetResourceLoadingRequestor {}
149
150impl AVAssetResourceLoadingRequestor {
151 extern_methods!(
152 #[unsafe(method(init))]
153 #[unsafe(method_family = init)]
154 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
155
156 #[unsafe(method(new))]
157 #[unsafe(method_family = new)]
158 pub unsafe fn new() -> Retained<Self>;
159
160 /// Whether the requestor provides expired session reports (see AVContentKeySession)
161 #[unsafe(method(providesExpiredSessionReports))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn providesExpiredSessionReports(&self) -> bool;
164 );
165}
166
167extern_class!(
168 /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourceloadingrequest?language=objc)
169 #[unsafe(super(NSObject))]
170 #[derive(Debug, PartialEq, Eq, Hash)]
171 pub struct AVAssetResourceLoadingRequest;
172);
173
174unsafe impl NSObjectProtocol for AVAssetResourceLoadingRequest {}
175
176impl AVAssetResourceLoadingRequest {
177 extern_methods!(
178 #[unsafe(method(init))]
179 #[unsafe(method_family = init)]
180 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
181
182 #[unsafe(method(new))]
183 #[unsafe(method_family = new)]
184 pub unsafe fn new() -> Retained<Self>;
185
186 /// An NSURLRequest for the requested resource.
187 #[unsafe(method(request))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn request(&self) -> Retained<NSURLRequest>;
190
191 /// Indicates whether loading of the resource has been finished.
192 ///
193 /// The value of this property becomes YES only in response to an invocation of either -finishLoading or -finishLoadingWithError:.
194 #[unsafe(method(isFinished))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn isFinished(&self) -> bool;
197
198 /// Indicates whether the request has been cancelled.
199 ///
200 /// 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.
201 #[unsafe(method(isCancelled))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn isCancelled(&self) -> bool;
204
205 /// 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.
206 #[unsafe(method(contentInformationRequest))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn contentInformationRequest(
209 &self,
210 ) -> Option<Retained<AVAssetResourceLoadingContentInformationRequest>>;
211
212 /// 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.
213 #[unsafe(method(dataRequest))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn dataRequest(&self) -> Option<Retained<AVAssetResourceLoadingDataRequest>>;
216
217 /// 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.
218 #[unsafe(method(response))]
219 #[unsafe(method_family = none)]
220 pub unsafe fn response(&self) -> Option<Retained<NSURLResponse>>;
221
222 /// Setter for [`response`][Self::response].
223 #[unsafe(method(setResponse:))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn setResponse(&self, response: Option<&NSURLResponse>);
226
227 /// 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.
228 ///
229 /// AVAssetResourceLoader supports redirects to HTTP URLs only. Redirects to other URLs will result in a loading failure.
230 #[unsafe(method(redirect))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn redirect(&self) -> Option<Retained<NSURLRequest>>;
233
234 /// Setter for [`redirect`][Self::redirect].
235 #[unsafe(method(setRedirect:))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn setRedirect(&self, redirect: Option<&NSURLRequest>);
238
239 /// The AVAssetResourceLoadingRequestor that made this request
240 #[unsafe(method(requestor))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn requestor(&self) -> Retained<AVAssetResourceLoadingRequestor>;
243
244 /// Causes the receiver to treat the processing of the request as complete.
245 ///
246 /// 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.
247 #[unsafe(method(finishLoading))]
248 #[unsafe(method_family = none)]
249 pub unsafe fn finishLoading(&self);
250
251 /// Causes the receiver to treat the request as having failed.
252 ///
253 /// Parameter `error`: An instance of NSError indicating the reason for failure.
254 #[unsafe(method(finishLoadingWithError:))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn finishLoadingWithError(&self, error: Option<&NSError>);
257 );
258}
259
260extern_class!(
261 /// AVAssetResourceRenewalRequest encapsulates information about a resource request issued by a resource loader for the purpose of renewing a request previously issued.
262 ///
263 ///
264 /// 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.
265 ///
266 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourcerenewalrequest?language=objc)
267 #[unsafe(super(AVAssetResourceLoadingRequest, NSObject))]
268 #[derive(Debug, PartialEq, Eq, Hash)]
269 pub struct AVAssetResourceRenewalRequest;
270);
271
272unsafe impl NSObjectProtocol for AVAssetResourceRenewalRequest {}
273
274impl AVAssetResourceRenewalRequest {
275 extern_methods!();
276}
277
278/// Methods declared on superclass `AVAssetResourceLoadingRequest`.
279impl AVAssetResourceRenewalRequest {
280 extern_methods!(
281 #[unsafe(method(init))]
282 #[unsafe(method_family = init)]
283 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
284
285 #[unsafe(method(new))]
286 #[unsafe(method_family = new)]
287 pub unsafe fn new() -> Retained<Self>;
288 );
289}
290
291extern_class!(
292 /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourceloadingcontentinformationrequest?language=objc)
293 #[unsafe(super(NSObject))]
294 #[derive(Debug, PartialEq, Eq, Hash)]
295 pub struct AVAssetResourceLoadingContentInformationRequest;
296);
297
298unsafe impl NSObjectProtocol for AVAssetResourceLoadingContentInformationRequest {}
299
300impl AVAssetResourceLoadingContentInformationRequest {
301 extern_methods!(
302 #[unsafe(method(init))]
303 #[unsafe(method_family = init)]
304 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
305
306 #[unsafe(method(new))]
307 #[unsafe(method_family = new)]
308 pub unsafe fn new() -> Retained<Self>;
309
310 /// A UTI that indicates the type of data contained by the requested resource.
311 ///
312 /// 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.
313 #[unsafe(method(contentType))]
314 #[unsafe(method_family = none)]
315 pub unsafe fn contentType(&self) -> Option<Retained<NSString>>;
316
317 /// Setter for [`contentType`][Self::contentType].
318 #[unsafe(method(setContentType:))]
319 #[unsafe(method_family = none)]
320 pub unsafe fn setContentType(&self, content_type: Option<&NSString>);
321
322 /// An array showing the types of data which will be accepted as a valid response for the requested resource.
323 ///
324 /// 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.
325 #[unsafe(method(allowedContentTypes))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn allowedContentTypes(&self) -> Option<Retained<NSArray<NSString>>>;
328
329 /// Indicates the length of the requested resource, in bytes.
330 ///
331 /// 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.
332 #[unsafe(method(contentLength))]
333 #[unsafe(method_family = none)]
334 pub unsafe fn contentLength(&self) -> c_longlong;
335
336 /// Setter for [`contentLength`][Self::contentLength].
337 #[unsafe(method(setContentLength:))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn setContentLength(&self, content_length: c_longlong);
340
341 /// 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.
342 ///
343 /// 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.
344 #[unsafe(method(isByteRangeAccessSupported))]
345 #[unsafe(method_family = none)]
346 pub unsafe fn isByteRangeAccessSupported(&self) -> bool;
347
348 /// Setter for [`isByteRangeAccessSupported`][Self::isByteRangeAccessSupported].
349 #[unsafe(method(setByteRangeAccessSupported:))]
350 #[unsafe(method_family = none)]
351 pub unsafe fn setByteRangeAccessSupported(&self, byte_range_access_supported: bool);
352
353 /// 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.
354 ///
355 /// 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.
356 #[unsafe(method(renewalDate))]
357 #[unsafe(method_family = none)]
358 pub unsafe fn renewalDate(&self) -> Option<Retained<NSDate>>;
359
360 /// Setter for [`renewalDate`][Self::renewalDate].
361 #[unsafe(method(setRenewalDate:))]
362 #[unsafe(method_family = none)]
363 pub unsafe fn setRenewalDate(&self, renewal_date: Option<&NSDate>);
364
365 /// Indicates whether asset data loading can expect data to be produced immediately.
366 ///
367 /// 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.
368 #[unsafe(method(isEntireLengthAvailableOnDemand))]
369 #[unsafe(method_family = none)]
370 pub unsafe fn isEntireLengthAvailableOnDemand(&self) -> bool;
371
372 /// Setter for [`isEntireLengthAvailableOnDemand`][Self::isEntireLengthAvailableOnDemand].
373 #[unsafe(method(setEntireLengthAvailableOnDemand:))]
374 #[unsafe(method_family = none)]
375 pub unsafe fn setEntireLengthAvailableOnDemand(
376 &self,
377 entire_length_available_on_demand: bool,
378 );
379 );
380}
381
382extern_class!(
383 /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourceloadingdatarequest?language=objc)
384 #[unsafe(super(NSObject))]
385 #[derive(Debug, PartialEq, Eq, Hash)]
386 pub struct AVAssetResourceLoadingDataRequest;
387);
388
389unsafe impl NSObjectProtocol for AVAssetResourceLoadingDataRequest {}
390
391impl AVAssetResourceLoadingDataRequest {
392 extern_methods!(
393 #[unsafe(method(init))]
394 #[unsafe(method_family = init)]
395 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
396
397 #[unsafe(method(new))]
398 #[unsafe(method_family = new)]
399 pub unsafe fn new() -> Retained<Self>;
400
401 /// The position within the resource of the first byte requested.
402 #[unsafe(method(requestedOffset))]
403 #[unsafe(method_family = none)]
404 pub unsafe fn requestedOffset(&self) -> c_longlong;
405
406 /// The length of the data requested.
407 ///
408 /// 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.
409 /// 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.
410 /// 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.
411 #[unsafe(method(requestedLength))]
412 #[unsafe(method_family = none)]
413 pub unsafe fn requestedLength(&self) -> NSInteger;
414
415 /// Specifies that the entire remaining length of the resource from requestedOffset to the end of the resource is being requested.
416 ///
417 /// 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.
418 #[unsafe(method(requestsAllDataToEndOfResource))]
419 #[unsafe(method_family = none)]
420 pub unsafe fn requestsAllDataToEndOfResource(&self) -> bool;
421
422 /// 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.
423 #[unsafe(method(currentOffset))]
424 #[unsafe(method_family = none)]
425 pub unsafe fn currentOffset(&self) -> c_longlong;
426
427 /// Provides data to the receiver.
428 ///
429 /// Parameter `data`: An instance of NSData containing some or all of the requested bytes.
430 ///
431 /// 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.
432 /// 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.
433 #[unsafe(method(respondWithData:))]
434 #[unsafe(method_family = none)]
435 pub unsafe fn respondWithData(&self, data: &NSData);
436 );
437}
438
439/// AVAssetResourceLoaderContentKeySupport.
440impl AVAssetResourceLoader {
441 extern_methods!(
442 /// 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.
443 ///
444 /// Any work done as a result of setting this property will be performed asynchronously.
445 #[unsafe(method(preloadsEligibleContentKeys))]
446 #[unsafe(method_family = none)]
447 pub unsafe fn preloadsEligibleContentKeys(&self) -> bool;
448
449 /// Setter for [`preloadsEligibleContentKeys`][Self::preloadsEligibleContentKeys].
450 #[unsafe(method(setPreloadsEligibleContentKeys:))]
451 #[unsafe(method_family = none)]
452 pub unsafe fn setPreloadsEligibleContentKeys(&self, preloads_eligible_content_keys: bool);
453 );
454}
455
456/// AVAssetResourceLoaderCommonMediaClientDataSupport.
457impl AVAssetResourceLoader {
458 extern_methods!(
459 #[unsafe(method(sendsCommonMediaClientDataAsHTTPHeaders))]
460 #[unsafe(method_family = none)]
461 pub unsafe fn sendsCommonMediaClientDataAsHTTPHeaders(&self) -> bool;
462
463 /// Setter for [`sendsCommonMediaClientDataAsHTTPHeaders`][Self::sendsCommonMediaClientDataAsHTTPHeaders].
464 #[unsafe(method(setSendsCommonMediaClientDataAsHTTPHeaders:))]
465 #[unsafe(method_family = none)]
466 pub unsafe fn setSendsCommonMediaClientDataAsHTTPHeaders(
467 &self,
468 sends_common_media_client_data_as_http_headers: bool,
469 );
470 );
471}
472
473/// AVAssetResourceLoadingRequestContentKeyRequestSupport.
474impl AVAssetResourceLoadingRequest {
475 extern_methods!(
476 /// Obtains a streaming content key request for a specific combination of application and content.
477 ///
478 /// Parameter `appIdentifier`: An opaque identifier for the application. The value of this identifier depends on the particular system used to provide the decryption key.
479 ///
480 /// Parameter `contentIdentifier`: An opaque identifier for the content. The value of this identifier depends on the particular system used to provide the decryption key.
481 ///
482 /// Parameter `options`: Additional information necessary to obtain the key, or nil if none.
483 ///
484 /// Parameter `outError`: If obtaining the streaming content key request fails, will be set to an instance of NSError describing the failure.
485 ///
486 /// Returns: The key request data that must be transmitted to the key vendor to obtain the content key.
487 #[deprecated = "Use -[AVContentKeyRequest makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler:] instead"]
488 #[unsafe(method(streamingContentKeyRequestDataForApp:contentIdentifier:options:error:_))]
489 #[unsafe(method_family = none)]
490 pub unsafe fn streamingContentKeyRequestDataForApp_contentIdentifier_options_error(
491 &self,
492 app_identifier: &NSData,
493 content_identifier: &NSData,
494 options: Option<&NSDictionary<NSString, AnyObject>>,
495 ) -> Result<Retained<NSData>, Retained<NSError>>;
496
497 /// Obtains a persistable content key from a context.
498 ///
499 /// Parameter `keyVendorResponse`: The response returned from the key vendor as a result of a request generated from streamingContentKeyRequestDataForApp:contentIdentifier:options:error:.
500 ///
501 /// Parameter `options`: Additional information necessary to obtain the persistable content key, or nil if none.
502 ///
503 /// Parameter `outError`: If obtaining the persistable content key fails, will be set to an instance of NSError describing the failure.
504 ///
505 /// Returns: The persistable content key data that may be stored offline to answer future loading requests of the same content key.
506 ///
507 /// 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.
508 #[deprecated = "Use -[AVPersistableContentKeyRequest persistableContentKeyFromKeyVendorResponse:options:error:] instead"]
509 #[unsafe(method(persistentContentKeyFromKeyVendorResponse:options:error:_))]
510 #[unsafe(method_family = none)]
511 pub unsafe fn persistentContentKeyFromKeyVendorResponse_options_error(
512 &self,
513 key_vendor_response: &NSData,
514 options: Option<&NSDictionary<NSString, AnyObject>>,
515 ) -> Result<Retained<NSData>, Retained<NSError>>;
516 );
517}
518
519extern "C" {
520 /// 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:].
521 ///
522 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetresourceloadingrequeststreamingcontentkeyrequestrequirespersistentkey?language=objc)
523 pub static AVAssetResourceLoadingRequestStreamingContentKeyRequestRequiresPersistentKey:
524 &'static NSString;
525}
526
527/// AVAssetResourceLoadingRequestDeprecated.
528impl AVAssetResourceLoadingRequest {
529 extern_methods!(
530 /// 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:.
531 ///
532 /// Parameter `response`: The NSURLResponse for the NSURLRequest of the receiver. Should be nil if no response is required.
533 ///
534 /// Parameter `data`: An instance of NSData containing the data of the resource. Should be nil if no such data is available.
535 ///
536 /// Parameter `redirect`: An instance of NSURLRequest indicating a redirect of the loading request. Should be nil if no redirect is needed.
537 ///
538 /// This method is deprecated. Use the following methods instead.
539 /// -[AVAssetResourceLoadingRequest setResponse:] to set the response property,
540 /// -[AVAssetResourceLoadingRequest setRedirect:] to set the redirect property,
541 /// -[AVAssetResourceLoadingDataRequest respondWithData:] to provide data, and
542 /// -[AVAssetResourceLoadingRequest finishLoading] to indicate that loading is finished.
543 #[deprecated = "Use -[AVAssetResourceLoadingRequest setResponse:], -[AVAssetResourceLoadingRequest setRedirect:], -[AVAssetResourceLoadingDataRequest respondWithData:], -[AVAssetResourceLoadingRequest finishLoading]"]
544 #[unsafe(method(finishLoadingWithResponse:data:redirect:))]
545 #[unsafe(method_family = none)]
546 pub unsafe fn finishLoadingWithResponse_data_redirect(
547 &self,
548 response: Option<&NSURLResponse>,
549 data: Option<&NSData>,
550 redirect: Option<&NSURLRequest>,
551 );
552 );
553}