objc2_av_foundation/generated/
AVCaptureSpatialAudioMetadataSampleGenerator.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-media")]
7use objc2_core_media::*;
8
9use crate::*;
10
11extern_class!(
12    /// An interface for generating a spatial audio timed metadata sample.
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturespatialaudiometadatasamplegenerator?language=objc)
15    #[unsafe(super(NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    pub struct AVCaptureSpatialAudioMetadataSampleGenerator;
18);
19
20extern_conformance!(
21    unsafe impl NSObjectProtocol for AVCaptureSpatialAudioMetadataSampleGenerator {}
22);
23
24impl AVCaptureSpatialAudioMetadataSampleGenerator {
25    extern_methods!(
26        #[cfg(feature = "objc2-core-media")]
27        /// Returns the format description of the sample buffer returned from the ``newTimedMetadataSampleBufferAndResetAnalyzer`` method.
28        ///
29        /// Use this format description when creating your ``AVAssetWriter`` track for spatial audio timed metadata.
30        #[unsafe(method(timedMetadataSampleBufferFormatDescription))]
31        #[unsafe(method_family = none)]
32        pub unsafe fn timedMetadataSampleBufferFormatDescription(
33            &self,
34        ) -> Retained<CMFormatDescription>;
35
36        #[cfg(feature = "objc2-core-media")]
37        /// Analyzes the provided audio sample buffer for its contribution to the spatial audio timed metadata value.
38        ///
39        /// - Parameter sbuf: a sample buffer containing spatial audio.
40        /// - Returns: `noErr` if the sample is successfully analyzed, otherwise a non-zero error code.
41        ///
42        /// You must call this method with each and every spatial audio buffer you provide to ``AVAssetWriter``, so it can be analyzed for the generation of a proper spatial audio timed metadata value.
43        #[unsafe(method(analyzeAudioSample:))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn analyzeAudioSample(&self, sbuf: &CMSampleBuffer) -> OSStatus;
46
47        #[cfg(feature = "objc2-core-media")]
48        /// Creates a sample buffer containing a spatial audio timed metadata sample computed from all analyzed audio buffers, and resets the analyzer to its initial state.
49        ///
50        /// - Returns: a ``CMSampleBufferRef`` containing the spatial audio timed metadata sample, or `NULL` if no value can be computed.
51        ///
52        /// Call this method after you pass the last audio sample buffer of your recording to ``analyzeAudioSample:``. Then pass the returned ``CMSampleBufferRef`` directly to your ``AVAssetWriterInput`` to add the sample to your recording's audio timed metadata track. Note that ``AVAssetWriter`` expects one and only one spatial audio metadata sample buffer to be present in the timed metadata track.
53        ///
54        /// - Note: Calling this method also resets the analyzer, making it ready for another run of audio sample buffers. Thus one generator can be re-used for multiple recordings.
55        #[unsafe(method(newTimedMetadataSampleBufferAndResetAnalyzer))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn newTimedMetadataSampleBufferAndResetAnalyzer(
58            &self,
59        ) -> Option<Retained<CMSampleBuffer>>;
60
61        /// Calling this method resets the analyzer to its initial state so that a new run of audio sample buffers can be analyzed.
62        ///
63        /// Call this method if you need to abort generating the audio timed metadata buffer for audio already provided to ``analyzeAudioSample:``.
64        #[unsafe(method(resetAnalyzer))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn resetAnalyzer(&self);
67    );
68}
69
70/// Methods declared on superclass `NSObject`.
71impl AVCaptureSpatialAudioMetadataSampleGenerator {
72    extern_methods!(
73        #[unsafe(method(init))]
74        #[unsafe(method_family = init)]
75        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
76
77        #[unsafe(method(new))]
78        #[unsafe(method_family = new)]
79        pub unsafe fn new() -> Retained<Self>;
80    );
81}