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