objc2_av_foundation/generated/AVMovieTrack.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-media")]
9use objc2_core_media::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14extern_class!(
15 /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmovietrack?language=objc)
16 #[unsafe(super(AVAssetTrack, NSObject))]
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 #[cfg(feature = "AVAssetTrack")]
19 pub struct AVMovieTrack;
20);
21
22#[cfg(all(feature = "AVAssetTrack", feature = "AVAsynchronousKeyValueLoading"))]
23extern_conformance!(
24 unsafe impl AVAsynchronousKeyValueLoading for AVMovieTrack {}
25);
26
27#[cfg(feature = "AVAssetTrack")]
28extern_conformance!(
29 unsafe impl NSCopying for AVMovieTrack {}
30);
31
32#[cfg(feature = "AVAssetTrack")]
33unsafe impl CopyingHelper for AVMovieTrack {
34 type Result = Self;
35}
36
37#[cfg(feature = "AVAssetTrack")]
38extern_conformance!(
39 unsafe impl NSObjectProtocol for AVMovieTrack {}
40);
41
42#[cfg(feature = "AVAssetTrack")]
43impl AVMovieTrack {
44 extern_methods!(
45 #[cfg(feature = "objc2-core-media")]
46 /// A CMTimeRange indicating the range of presentation times for the track's media.
47 #[unsafe(method(mediaPresentationTimeRange))]
48 #[unsafe(method_family = none)]
49 pub unsafe fn mediaPresentationTimeRange(&self) -> CMTimeRange;
50
51 #[cfg(feature = "objc2-core-media")]
52 /// A CMTimeRange indicating the range of decode times for the track's media.
53 #[unsafe(method(mediaDecodeTimeRange))]
54 #[unsafe(method_family = none)]
55 pub unsafe fn mediaDecodeTimeRange(&self) -> CMTimeRange;
56
57 #[unsafe(method(alternateGroupID))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn alternateGroupID(&self) -> NSInteger;
60 );
61}
62
63/// Methods declared on superclass `AVAssetTrack`.
64#[cfg(feature = "AVAssetTrack")]
65impl AVMovieTrack {
66 extern_methods!(
67 #[unsafe(method(init))]
68 #[unsafe(method_family = init)]
69 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
70
71 #[unsafe(method(new))]
72 #[unsafe(method_family = new)]
73 pub unsafe fn new() -> Retained<Self>;
74 );
75}
76
77/// AVMovieTrackMediaDataStorage.
78#[cfg(feature = "AVAssetTrack")]
79impl AVMovieTrack {
80 extern_methods!(
81 #[cfg(feature = "AVMovie")]
82 /// The storage container for media data added to a track.
83 ///
84 /// The value of this property is an AVMediaDataStorage object that indicates the location at which media data inserted or appended to the track will be written.
85 #[unsafe(method(mediaDataStorage))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn mediaDataStorage(&self) -> Option<Retained<AVMediaDataStorage>>;
88 );
89}
90
91extern_class!(
92 /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmutablemovietrack?language=objc)
93 #[unsafe(super(AVMovieTrack, AVAssetTrack, NSObject))]
94 #[derive(Debug, PartialEq, Eq, Hash)]
95 #[cfg(feature = "AVAssetTrack")]
96 pub struct AVMutableMovieTrack;
97);
98
99#[cfg(all(feature = "AVAssetTrack", feature = "AVAsynchronousKeyValueLoading"))]
100extern_conformance!(
101 unsafe impl AVAsynchronousKeyValueLoading for AVMutableMovieTrack {}
102);
103
104#[cfg(feature = "AVAssetTrack")]
105extern_conformance!(
106 unsafe impl NSCopying for AVMutableMovieTrack {}
107);
108
109#[cfg(feature = "AVAssetTrack")]
110unsafe impl CopyingHelper for AVMutableMovieTrack {
111 type Result = Self;
112}
113
114#[cfg(feature = "AVAssetTrack")]
115extern_conformance!(
116 unsafe impl NSObjectProtocol for AVMutableMovieTrack {}
117);
118
119#[cfg(feature = "AVAssetTrack")]
120impl AVMutableMovieTrack {
121 extern_methods!(
122 #[cfg(feature = "AVMovie")]
123 /// The storage container for media data added to a track.
124 ///
125 /// The value of this property is an AVMediaDataStorage object that indicates the location at which media data inserted or appended to the track will be written.
126 #[unsafe(method(mediaDataStorage))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn mediaDataStorage(&self) -> Option<Retained<AVMediaDataStorage>>;
129
130 #[cfg(feature = "AVMovie")]
131 /// Setter for [`mediaDataStorage`][Self::mediaDataStorage].
132 ///
133 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
134 #[unsafe(method(setMediaDataStorage:))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn setMediaDataStorage(&self, media_data_storage: Option<&AVMediaDataStorage>);
137
138 /// For file types that support writing sample references, such as QuickTime Movie files, specifies the base URL that sample references are relative to; may be nil.
139 ///
140 /// If the value of this property can be resolved as an absolute URL, the sample locations written to the file when appending sample references to this track will be relative to this URL. The URL must point to a location contained by any common parent directory of the locations that will be referenced. For example, setting the sampleReferenceBaseURL property to "file:///Users/johnappleseed/Movies/" and appending sample buffers that refer to "file:///Users/johnappleseed/Movies/data/movie1.mov" will cause the sample reference "data/movie1.mov" to be written to the movie file.
141 ///
142 /// If the value of the property cannot be resolved as an absolute URL or if it points to a location that is not contained by any common parent directory of the locations that will be referenced, the location will be written unmodified.
143 ///
144 /// The default value is nil, which means that the location will be written unmodified.
145 #[unsafe(method(sampleReferenceBaseURL))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn sampleReferenceBaseURL(&self) -> Option<Retained<NSURL>>;
148
149 /// Setter for [`sampleReferenceBaseURL`][Self::sampleReferenceBaseURL].
150 ///
151 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
152 #[unsafe(method(setSampleReferenceBaseURL:))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn setSampleReferenceBaseURL(&self, sample_reference_base_url: Option<&NSURL>);
155
156 /// A BOOL value indicating whether the track is enabled by default for presentation.
157 #[unsafe(method(isEnabled))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn isEnabled(&self) -> bool;
160
161 /// Setter for [`isEnabled`][Self::isEnabled].
162 #[unsafe(method(setEnabled:))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn setEnabled(&self, enabled: bool);
165
166 /// An integer indicating the track as a member of a particular alternate group.
167 #[unsafe(method(alternateGroupID))]
168 #[unsafe(method_family = none)]
169 pub unsafe fn alternateGroupID(&self) -> NSInteger;
170
171 /// Setter for [`alternateGroupID`][Self::alternateGroupID].
172 #[unsafe(method(setAlternateGroupID:))]
173 #[unsafe(method_family = none)]
174 pub unsafe fn setAlternateGroupID(&self, alternate_group_id: NSInteger);
175
176 /// Whether a track has been modified.
177 ///
178 /// The value of this property is a BOOL that indicates whether the AVMutableMovieTrack object has been modified since it was created, was last written, or had its modified state cleared via a call to setModified:NO.
179 #[unsafe(method(isModified))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn isModified(&self) -> bool;
182
183 /// Setter for [`isModified`][Self::isModified].
184 #[unsafe(method(setModified:))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn setModified(&self, modified: bool);
187
188 /// Whether a track contains protected content.
189 ///
190 /// The value of this property is a BOOL that indicates whether the track contains protected content.
191 #[unsafe(method(hasProtectedContent))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn hasProtectedContent(&self) -> bool;
194
195 #[cfg(feature = "objc2-core-media")]
196 /// For file types that contain a 'moov' atom, such as QuickTime Movie files, specifies the time scale of the track's media.
197 ///
198 /// The default media time scale is 0.
199 ///
200 /// This property should be set on a new empty track before any edits are performed on the track.
201 #[unsafe(method(timescale))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn timescale(&self) -> CMTimeScale;
204
205 #[cfg(feature = "objc2-core-media")]
206 /// Setter for [`timescale`][Self::timescale].
207 #[unsafe(method(setTimescale:))]
208 #[unsafe(method_family = none)]
209 pub unsafe fn setTimescale(&self, timescale: CMTimeScale);
210 );
211}
212
213/// Methods declared on superclass `AVAssetTrack`.
214#[cfg(feature = "AVAssetTrack")]
215impl AVMutableMovieTrack {
216 extern_methods!(
217 #[unsafe(method(init))]
218 #[unsafe(method_family = init)]
219 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
220
221 #[unsafe(method(new))]
222 #[unsafe(method_family = new)]
223 pub unsafe fn new() -> Retained<Self>;
224 );
225}
226
227/// AVMutableMovieTrackLanguageProperties.
228#[cfg(feature = "AVAssetTrack")]
229impl AVMutableMovieTrack {
230 extern_methods!(
231 /// The language associated with the track.
232 ///
233 /// The value of this property is an ISO 639-2/T language code indicating the language associated with the track; may be nil if no language is indicated.
234 #[unsafe(method(languageCode))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn languageCode(&self) -> Option<Retained<NSString>>;
237
238 /// Setter for [`languageCode`][Self::languageCode].
239 ///
240 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
241 #[unsafe(method(setLanguageCode:))]
242 #[unsafe(method_family = none)]
243 pub unsafe fn setLanguageCode(&self, language_code: Option<&NSString>);
244
245 /// The language tag associated with the track.
246 ///
247 /// The value of this property is an IETF BCP 47 (RFC 4646) language identifier indicating the language tag associated with the track; may be nil if no language tag is indicated.
248 #[unsafe(method(extendedLanguageTag))]
249 #[unsafe(method_family = none)]
250 pub unsafe fn extendedLanguageTag(&self) -> Option<Retained<NSString>>;
251
252 /// Setter for [`extendedLanguageTag`][Self::extendedLanguageTag].
253 ///
254 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
255 #[unsafe(method(setExtendedLanguageTag:))]
256 #[unsafe(method_family = none)]
257 pub unsafe fn setExtendedLanguageTag(&self, extended_language_tag: Option<&NSString>);
258 );
259}
260
261/// AVMutableMovieTrackVisualProperties.
262#[cfg(feature = "AVAssetTrack")]
263impl AVMutableMovieTrack {
264 extern_methods!(
265 #[cfg(feature = "objc2-core-foundation")]
266 /// A CGSize indicating the dimensions at which the visual media data of the track should be displayed.
267 #[unsafe(method(naturalSize))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn naturalSize(&self) -> CGSize;
270
271 #[cfg(feature = "objc2-core-foundation")]
272 /// Setter for [`naturalSize`][Self::naturalSize].
273 #[unsafe(method(setNaturalSize:))]
274 #[unsafe(method_family = none)]
275 pub unsafe fn setNaturalSize(&self, natural_size: CGSize);
276
277 #[cfg(feature = "objc2-core-foundation")]
278 /// A CGAffineTransform indicating the transform specified in the track's storage container as the preferred transformation of the visual media data for display purposes; the value is often but not always CGAffineTransformIdentity.
279 #[unsafe(method(preferredTransform))]
280 #[unsafe(method_family = none)]
281 pub unsafe fn preferredTransform(&self) -> CGAffineTransform;
282
283 #[cfg(feature = "objc2-core-foundation")]
284 /// Setter for [`preferredTransform`][Self::preferredTransform].
285 #[unsafe(method(setPreferredTransform:))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn setPreferredTransform(&self, preferred_transform: CGAffineTransform);
288
289 /// The layer level of the visual media data of the track.
290 #[unsafe(method(layer))]
291 #[unsafe(method_family = none)]
292 pub unsafe fn layer(&self) -> NSInteger;
293
294 /// Setter for [`layer`][Self::layer].
295 #[unsafe(method(setLayer:))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn setLayer(&self, layer: NSInteger);
298
299 #[cfg(feature = "objc2-core-foundation")]
300 /// A CGSize indicating the clean aperture dimensions of the track.
301 #[unsafe(method(cleanApertureDimensions))]
302 #[unsafe(method_family = none)]
303 pub unsafe fn cleanApertureDimensions(&self) -> CGSize;
304
305 #[cfg(feature = "objc2-core-foundation")]
306 /// Setter for [`cleanApertureDimensions`][Self::cleanApertureDimensions].
307 #[unsafe(method(setCleanApertureDimensions:))]
308 #[unsafe(method_family = none)]
309 pub unsafe fn setCleanApertureDimensions(&self, clean_aperture_dimensions: CGSize);
310
311 #[cfg(feature = "objc2-core-foundation")]
312 /// A CGSize indicating the production aperture dimensions of the track.
313 #[unsafe(method(productionApertureDimensions))]
314 #[unsafe(method_family = none)]
315 pub unsafe fn productionApertureDimensions(&self) -> CGSize;
316
317 #[cfg(feature = "objc2-core-foundation")]
318 /// Setter for [`productionApertureDimensions`][Self::productionApertureDimensions].
319 #[unsafe(method(setProductionApertureDimensions:))]
320 #[unsafe(method_family = none)]
321 pub unsafe fn setProductionApertureDimensions(
322 &self,
323 production_aperture_dimensions: CGSize,
324 );
325
326 #[cfg(feature = "objc2-core-foundation")]
327 /// A CGSize indicating the dimensions encoded pixels dimensions of the track.
328 #[unsafe(method(encodedPixelsDimensions))]
329 #[unsafe(method_family = none)]
330 pub unsafe fn encodedPixelsDimensions(&self) -> CGSize;
331
332 #[cfg(feature = "objc2-core-foundation")]
333 /// Setter for [`encodedPixelsDimensions`][Self::encodedPixelsDimensions].
334 #[unsafe(method(setEncodedPixelsDimensions:))]
335 #[unsafe(method_family = none)]
336 pub unsafe fn setEncodedPixelsDimensions(&self, encoded_pixels_dimensions: CGSize);
337 );
338}
339
340/// AVMutableMovieTrackAudibleProperties.
341#[cfg(feature = "AVAssetTrack")]
342impl AVMutableMovieTrack {
343 extern_methods!(
344 /// The preferred volume of the audible media data of the track; often but not always 1.0.
345 #[unsafe(method(preferredVolume))]
346 #[unsafe(method_family = none)]
347 pub unsafe fn preferredVolume(&self) -> c_float;
348
349 /// Setter for [`preferredVolume`][Self::preferredVolume].
350 #[unsafe(method(setPreferredVolume:))]
351 #[unsafe(method_family = none)]
352 pub unsafe fn setPreferredVolume(&self, preferred_volume: c_float);
353 );
354}
355
356/// AVMutableMovieTrackChunkProperties.
357#[cfg(feature = "AVAssetTrack")]
358impl AVMutableMovieTrack {
359 extern_methods!(
360 /// For file types that support media chunk sizes, the maximum size (in bytes) to be used for each chunk of sample data written to the file.
361 ///
362 /// The total size of the samples in a chunk will be no larger than this preferred chunk size, or the size of a single sample if the sample is larger than this preferred chunk size.
363 ///
364 /// The default media chunk size is 1024 * 1024 bytes. It is an error to set a negative chunk size.
365 #[unsafe(method(preferredMediaChunkSize))]
366 #[unsafe(method_family = none)]
367 pub unsafe fn preferredMediaChunkSize(&self) -> NSInteger;
368
369 /// Setter for [`preferredMediaChunkSize`][Self::preferredMediaChunkSize].
370 #[unsafe(method(setPreferredMediaChunkSize:))]
371 #[unsafe(method_family = none)]
372 pub unsafe fn setPreferredMediaChunkSize(&self, preferred_media_chunk_size: NSInteger);
373
374 #[cfg(feature = "objc2-core-media")]
375 /// For file types that support media chunk durations, the maximum duration to be used for each chunk of sample data written to the file.
376 ///
377 ///
378 /// The total duration of the samples in a chunk will be no greater than this preferred chunk duration, or the duration of a single sample if the sample's duration is greater than this preferred chunk duration.
379 ///
380 /// The default media chunk duration is 1.0 second. It is an error to set a chunk duration that is negative or non-numeric.
381 #[unsafe(method(preferredMediaChunkDuration))]
382 #[unsafe(method_family = none)]
383 pub unsafe fn preferredMediaChunkDuration(&self) -> CMTime;
384
385 #[cfg(feature = "objc2-core-media")]
386 /// Setter for [`preferredMediaChunkDuration`][Self::preferredMediaChunkDuration].
387 #[unsafe(method(setPreferredMediaChunkDuration:))]
388 #[unsafe(method_family = none)]
389 pub unsafe fn setPreferredMediaChunkDuration(&self, preferred_media_chunk_duration: CMTime);
390
391 /// For file types that support media chunk alignment, the boundary for media chunk alignment (in bytes).
392 ///
393 ///
394 /// The default value is 0, which means that no padding should be used to achieve chunk alignment. It is an error to set a negative value for chunk alignment.
395 #[unsafe(method(preferredMediaChunkAlignment))]
396 #[unsafe(method_family = none)]
397 pub unsafe fn preferredMediaChunkAlignment(&self) -> NSInteger;
398
399 /// Setter for [`preferredMediaChunkAlignment`][Self::preferredMediaChunkAlignment].
400 #[unsafe(method(setPreferredMediaChunkAlignment:))]
401 #[unsafe(method_family = none)]
402 pub unsafe fn setPreferredMediaChunkAlignment(
403 &self,
404 preferred_media_chunk_alignment: NSInteger,
405 );
406 );
407}
408
409/// AVMutableMovieTrackTrackLevelEditing.
410#[cfg(feature = "AVAssetTrack")]
411impl AVMutableMovieTrack {
412 extern_methods!(
413 #[cfg(feature = "objc2-core-media")]
414 /// Inserts a portion of an AVAssetTrack object into the target movie.
415 ///
416 /// Parameter `timeRange`: The time range from the track from which media is to be inserted.
417 ///
418 /// Parameter `track`: An AVAssetTrack object indicating the source of the inserted media. Only AVAssetTracks of AVURLAssets and AVCompositions are supported.
419 /// Must not be nil.
420 ///
421 /// Parameter `startTime`: The time in the target track at which the media is to be inserted.
422 ///
423 /// Parameter `copySampleData`: A BOOL value that indicates whether sample data is to be copied from the source to the destination during edits.
424 /// If YES, the sample data is written to the file specified by the track property mediaDataStorage if non-nil,
425 /// or else by the movie property defaultMediaDataStorage if non-nil; if both are nil, the method will fail and return NO.
426 /// If NO, sample data will not be written and sample references to the samples in their original container will be added
427 /// as necessary. Note that in this case, this method will fail if the original samples are fragmented.
428 ///
429 /// Parameter `outError`: If the insertion fails, describes the nature of the failure.
430 ///
431 /// Returns: A BOOL value that indicates the success of the insertion.
432 #[unsafe(method(insertTimeRange:ofTrack:atTime:copySampleData:error:_))]
433 #[unsafe(method_family = none)]
434 pub unsafe fn insertTimeRange_ofTrack_atTime_copySampleData_error(
435 &self,
436 time_range: CMTimeRange,
437 track: &AVAssetTrack,
438 start_time: CMTime,
439 copy_sample_data: bool,
440 ) -> Result<(), Retained<NSError>>;
441
442 #[cfg(feature = "objc2-core-media")]
443 /// Adds an empty time range to the target track.
444 ///
445 /// Parameter `timeRange`: The time range to be made empty. Note that you cannot add empty time ranges to the end of a track.
446 #[unsafe(method(insertEmptyTimeRange:))]
447 #[unsafe(method_family = none)]
448 pub unsafe fn insertEmptyTimeRange(&self, time_range: CMTimeRange);
449
450 #[cfg(feature = "objc2-core-media")]
451 /// Removes a specified time range from a track.
452 ///
453 /// Parameter `timeRange`: The time range to be removed.
454 #[unsafe(method(removeTimeRange:))]
455 #[unsafe(method_family = none)]
456 pub unsafe fn removeTimeRange(&self, time_range: CMTimeRange);
457
458 #[cfg(feature = "objc2-core-media")]
459 /// Changes the duration of a time range of a track.
460 ///
461 /// Parameter `timeRange`: The time range to be scaled.
462 ///
463 /// Parameter `duration`: The new duration of the time range.
464 #[unsafe(method(scaleTimeRange:toDuration:))]
465 #[unsafe(method_family = none)]
466 pub unsafe fn scaleTimeRange_toDuration(&self, time_range: CMTimeRange, duration: CMTime);
467 );
468}
469
470/// AVMutableMovieTrackMetadataEditing.
471#[cfg(feature = "AVAssetTrack")]
472impl AVMutableMovieTrack {
473 extern_methods!(
474 #[cfg(feature = "AVMetadataItem")]
475 /// A collection of metadata stored by the track.
476 ///
477 /// The value of this property is an array of AVMetadataItem objects representing the collection of metadata stored by the track.
478 #[unsafe(method(metadata))]
479 #[unsafe(method_family = none)]
480 pub unsafe fn metadata(&self) -> Retained<NSArray<AVMetadataItem>>;
481
482 #[cfg(feature = "AVMetadataItem")]
483 /// Setter for [`metadata`][Self::metadata].
484 ///
485 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
486 #[unsafe(method(setMetadata:))]
487 #[unsafe(method_family = none)]
488 pub unsafe fn setMetadata(&self, metadata: &NSArray<AVMetadataItem>);
489 );
490}
491
492/// AVMutableMovieTrackTrackAssociations.
493#[cfg(feature = "AVAssetTrack")]
494impl AVMutableMovieTrack {
495 extern_methods!(
496 /// Establishes a track association of a specific type between two tracks.
497 ///
498 /// Parameter `movieTrack`: An AVMovieTrack object that is to be associated with the receiver.
499 ///
500 /// Parameter `trackAssociationType`: The type of track association to add between the receiver and the specified movieTrack (for instance, AVTrackAssociationTypeChapterList).
501 ///
502 /// This method throws an exception if the movie track belongs to a different movie.
503 #[unsafe(method(addTrackAssociationToTrack:type:))]
504 #[unsafe(method_family = none)]
505 pub unsafe fn addTrackAssociationToTrack_type(
506 &self,
507 movie_track: &AVMovieTrack,
508 track_association_type: &AVTrackAssociationType,
509 );
510
511 /// Removes a track association of a specific type between two tracks.
512 ///
513 /// Parameter `movieTrack`: An AVMovieTrack object that is associated with the receiver.
514 ///
515 /// Parameter `trackAssociationType`: The type of track association to remove between the receiver and the specified movieTrack (for instance, AVTrackAssociationTypeChapterList).
516 ///
517 /// This method throws an exception if the movie track belongs to a different movie.
518 #[unsafe(method(removeTrackAssociationToTrack:type:))]
519 #[unsafe(method_family = none)]
520 pub unsafe fn removeTrackAssociationToTrack_type(
521 &self,
522 movie_track: &AVMovieTrack,
523 track_association_type: &AVTrackAssociationType,
524 );
525 );
526}
527
528/// AVMutableMovieTrackFormatDescriptions.
529#[cfg(feature = "AVAssetTrack")]
530impl AVMutableMovieTrack {
531 extern_methods!(
532 #[cfg(feature = "objc2-core-media")]
533 /// Replaces one of the receiver's format descriptions with another format description
534 ///
535 /// Parameter `formatDescription`: A CMFormatDescription occurring in the array returned by the -formatDescriptions method.
536 ///
537 /// Parameter `newFormatDescription`: A CMFormatDescription to replace the specified format description.
538 ///
539 /// You can use this method to make surgical changes to a track's format descriptions, such as adding format description extensions to a format description or changing the audio channel layout of an audio track. You should note that a format description can have extensions of type kCMFormatDescriptionExtension_VerbatimSampleDescription and kCMFormatDescriptionExtension_VerbatimISOSampleEntry; if you modify a copy of a format description, you should delete those extensions from the copy or your changes might be ignored.
540 ///
541 /// This method throws an exception if the media type of the new format description does not match the media type of the receiver.
542 #[unsafe(method(replaceFormatDescription:withFormatDescription:))]
543 #[unsafe(method_family = none)]
544 pub unsafe fn replaceFormatDescription_withFormatDescription(
545 &self,
546 format_description: &CMFormatDescription,
547 new_format_description: &CMFormatDescription,
548 );
549 );
550}
551
552/// AVMutableMovieTrackSampleLevelEditing.
553#[cfg(feature = "AVAssetTrack")]
554impl AVMutableMovieTrack {
555 extern_methods!(
556 #[cfg(feature = "objc2-core-media")]
557 /// Appends sample data to a media file and adds sample references for the added data to a track's media sample tables.
558 ///
559 /// Parameter `sampleBuffer`: The CMSampleBuffer to be appended; this may be obtained from an instance of AVAssetReader.
560 ///
561 /// Parameter `outDecodeTime`: A pointer to a CMTime structure to receive the decode time in the media of the first sample appended from the sample buffer. Pass NULL if you do not need this information.
562 ///
563 /// Parameter `outPresentationTime`: A pointer to a CMTime structure to receive the presentation time in the media of the first sample appended from the sample buffer. Pass NULL if you do not need this information.
564 ///
565 /// Parameter `outError`: If the appending fails, describes the nature of the failure. For example, if the device containing the track's media data storage is full, AVErrorDiskFull is returned.
566 ///
567 /// Returns: A BOOL value indicating the success of the operation.
568 ///
569 /// If the sample buffer carries sample data, the sample data is written to the container specified by the track property mediaDataStorage if non-nil,
570 /// or else by the movie property defaultMediaDataStorage if non-nil, and sample references will be appended to the track's media.
571 /// If both media data storage properties are nil, the method will fail and return NO.
572 /// If the sample buffer carries sample references only, sample data will not be written and sample references to the samples in their
573 /// original container will be appended to the track's media as necessary.
574 ///
575 /// Note regarding sample timing: in a track's media, the first sample's decode timestamp must always be zero.
576 /// For an audio track, each sample buffer's duration is used as the sample decode duration.
577 /// For other track types, difference between a sample's decode timestamp and the following
578 /// sample's decode timestamp is used as the first sample's decode duration, so as to preserve the relative timing.
579 ///
580 /// Note that this method does not modify the track's sourceTimeMappings but only appends sample references and sample data to the track's media.
581 /// To make the new samples appear in the track's timeline, invoke -insertMediaTimeRange:intoTimeRange:.
582 /// You can retrieve the mediaPresentationTimeRange property before and after appending a sequence of samples,
583 /// using CMTimeRangeGetEnd on each to calculate the media TimeRange for -insertMediaTimeRange:intoTimeRange:.
584 ///
585 /// It's safe for multiple threads to call this method on different tracks at once.
586 ///
587 /// This method throws an exception for any of the following reasons:
588 /// - the sample buffer's media type does not match the track's media type
589 /// - the sample buffer contains image buffers (must contain encoded video)
590 /// - the sample buffer contains caption groups (must contain encoded media data)
591 ///
592 /// # Safety
593 ///
594 /// - `out_decode_time` must be a valid pointer or null.
595 /// - `out_presentation_time` must be a valid pointer or null.
596 #[unsafe(method(appendSampleBuffer:decodeTime:presentationTime:error:_))]
597 #[unsafe(method_family = none)]
598 pub unsafe fn appendSampleBuffer_decodeTime_presentationTime_error(
599 &self,
600 sample_buffer: &CMSampleBuffer,
601 out_decode_time: *mut CMTime,
602 out_presentation_time: *mut CMTime,
603 ) -> Result<(), Retained<NSError>>;
604
605 #[cfg(feature = "objc2-core-media")]
606 /// Inserts a reference to a media time range into a track.
607 ///
608 /// Parameter `mediaTimeRange`: The presentation time range of the media to be inserted.
609 ///
610 /// Parameter `trackTimeRange`: The time range of the track into which the media is to be inserted.
611 ///
612 /// Returns: A BOOL value indicating the success of the operation.
613 ///
614 /// Use this method after you have appended samples or sample references to a track's media.
615 ///
616 /// To specify that the media time range be played at its natural rate, pass mediaTimeRange.duration == trackTimeRange.duration;
617 /// otherwise, the ratio between these is used to determine the playback rate.
618 ///
619 /// Pass kCMTimeInvalid for trackTimeRange.start to indicate that the segment should be appended to the end of the track.
620 #[unsafe(method(insertMediaTimeRange:intoTimeRange:))]
621 #[unsafe(method_family = none)]
622 pub unsafe fn insertMediaTimeRange_intoTimeRange(
623 &self,
624 media_time_range: CMTimeRange,
625 track_time_range: CMTimeRange,
626 ) -> bool;
627 );
628}
629
630extern "C" {
631 /// Posted when the timeRange of an AVFragmentedMovieTrack changes while the associated instance of AVFragmentedMovie is being minded by an AVFragmentedMovieMinder, but only for changes that occur after the status of the value of
632 /// "
633 /// timeRange" has reached AVKeyValueStatusLoaded.
634 ///
635 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avfragmentedmovietracktimerangedidchangenotification?language=objc)
636 pub static AVFragmentedMovieTrackTimeRangeDidChangeNotification: &'static NSString;
637}
638
639extern "C" {
640 /// Posted when the array of segments of an AVFragmentedMovieTrack changes while the associated instance of AVFragmentedMovie is being minded by an AVFragmentedMovieMinder, but only for changes that occur after the status of the value of
641 /// "
642 /// segments" has reached AVKeyValueStatusLoaded.
643 ///
644 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avfragmentedmovietracksegmentsdidchangenotification?language=objc)
645 pub static AVFragmentedMovieTrackSegmentsDidChangeNotification: &'static NSString;
646}
647
648extern "C" {
649 /// This notification name has been deprecated. Use either AVFragmentedMovieTrackTimeRangeDidChangeNotification or AVFragmentedMovieTrackSegmentsDidChangeNotification instead; in either case, you can assume that timing changes to fragmented tracks result in changes to the total length of the sample data used by the track.
650 ///
651 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avfragmentedmovietracktotalsampledatalengthdidchangenotification?language=objc)
652 #[deprecated = "Upon receipt of either AVFragmentedMovieTrackTimeRangeDidChangeNotification or AVFragmentedMovieTrackSegmentsDidChangeNotification, you can assume that the sender's totalSampleDataLength has changed."]
653 pub static AVFragmentedMovieTrackTotalSampleDataLengthDidChangeNotification: &'static NSString;
654}
655
656extern_class!(
657 /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avfragmentedmovietrack?language=objc)
658 #[unsafe(super(AVMovieTrack, AVAssetTrack, NSObject))]
659 #[derive(Debug, PartialEq, Eq, Hash)]
660 #[cfg(feature = "AVAssetTrack")]
661 pub struct AVFragmentedMovieTrack;
662);
663
664#[cfg(feature = "AVAssetTrack")]
665unsafe impl Send for AVFragmentedMovieTrack {}
666
667#[cfg(feature = "AVAssetTrack")]
668unsafe impl Sync for AVFragmentedMovieTrack {}
669
670#[cfg(all(feature = "AVAssetTrack", feature = "AVAsynchronousKeyValueLoading"))]
671extern_conformance!(
672 unsafe impl AVAsynchronousKeyValueLoading for AVFragmentedMovieTrack {}
673);
674
675#[cfg(feature = "AVAssetTrack")]
676extern_conformance!(
677 unsafe impl NSCopying for AVFragmentedMovieTrack {}
678);
679
680#[cfg(feature = "AVAssetTrack")]
681unsafe impl CopyingHelper for AVFragmentedMovieTrack {
682 type Result = Self;
683}
684
685#[cfg(feature = "AVAssetTrack")]
686extern_conformance!(
687 unsafe impl NSObjectProtocol for AVFragmentedMovieTrack {}
688);
689
690#[cfg(feature = "AVAssetTrack")]
691impl AVFragmentedMovieTrack {
692 extern_methods!();
693}
694
695/// Methods declared on superclass `AVAssetTrack`.
696#[cfg(feature = "AVAssetTrack")]
697impl AVFragmentedMovieTrack {
698 extern_methods!(
699 #[unsafe(method(init))]
700 #[unsafe(method_family = init)]
701 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
702
703 #[unsafe(method(new))]
704 #[unsafe(method_family = new)]
705 pub unsafe fn new() -> Retained<Self>;
706 );
707}
708
709/// SynchronousTrackInterface.
710///
711/// Redeclarations of async-only AVAssetTrack interfaces to allow synchronous usage in the synchronous subclass.
712///
713/// See AVAssetTrack's interface for more information about these interfaces.
714#[cfg(feature = "AVAssetTrack")]
715impl AVMutableMovieTrack {
716 extern_methods!(
717 #[cfg(feature = "AVMediaFormat")]
718 #[unsafe(method(hasMediaCharacteristic:))]
719 #[unsafe(method_family = none)]
720 pub unsafe fn hasMediaCharacteristic(
721 &self,
722 media_characteristic: &AVMediaCharacteristic,
723 ) -> bool;
724
725 #[cfg(all(feature = "AVAssetTrackSegment", feature = "objc2-core-media"))]
726 #[unsafe(method(segmentForTrackTime:))]
727 #[unsafe(method_family = none)]
728 pub unsafe fn segmentForTrackTime(
729 &self,
730 track_time: CMTime,
731 ) -> Option<Retained<AVAssetTrackSegment>>;
732
733 #[cfg(feature = "objc2-core-media")]
734 #[unsafe(method(samplePresentationTimeForTrackTime:))]
735 #[unsafe(method_family = none)]
736 pub unsafe fn samplePresentationTimeForTrackTime(&self, track_time: CMTime) -> CMTime;
737
738 #[cfg(all(feature = "AVMetadataFormat", feature = "AVMetadataItem"))]
739 #[unsafe(method(metadataForFormat:))]
740 #[unsafe(method_family = none)]
741 pub unsafe fn metadataForFormat(
742 &self,
743 format: &AVMetadataFormat,
744 ) -> Retained<NSArray<AVMetadataItem>>;
745
746 #[unsafe(method(associatedTracksOfType:))]
747 #[unsafe(method_family = none)]
748 pub unsafe fn associatedTracksOfType(
749 &self,
750 track_association_type: &AVTrackAssociationType,
751 ) -> Retained<NSArray<AVAssetTrack>>;
752 );
753}