1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-media")]
use objc2_core_media::*;
use crate::*;
extern_class!(
/// An interface for generating a spatial audio timed metadata sample.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturespatialaudiometadatasamplegenerator?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct AVCaptureSpatialAudioMetadataSampleGenerator;
);
extern_conformance!(
unsafe impl NSObjectProtocol for AVCaptureSpatialAudioMetadataSampleGenerator {}
);
impl AVCaptureSpatialAudioMetadataSampleGenerator {
extern_methods!(
#[cfg(feature = "objc2-core-media")]
/// Returns the format description of the sample buffer returned from the ``newTimedMetadataSampleBufferAndResetAnalyzer`` method.
///
/// Use this format description when creating your ``AVAssetWriter`` track for spatial audio timed metadata.
#[unsafe(method(timedMetadataSampleBufferFormatDescription))]
#[unsafe(method_family = none)]
pub unsafe fn timedMetadataSampleBufferFormatDescription(
&self,
) -> Retained<CMFormatDescription>;
#[cfg(feature = "objc2-core-media")]
/// Analyzes the provided audio sample buffer for its contribution to the spatial audio timed metadata value.
///
/// - Parameter sbuf: a sample buffer containing spatial audio.
/// - Returns: `noErr` if the sample is successfully analyzed, otherwise a non-zero error code.
///
/// 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.
#[unsafe(method(analyzeAudioSample:))]
#[unsafe(method_family = none)]
pub unsafe fn analyzeAudioSample(&self, sbuf: &CMSampleBuffer) -> OSStatus;
#[cfg(feature = "objc2-core-media")]
/// 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.
///
/// - Returns: a ``CMSampleBufferRef`` containing the spatial audio timed metadata sample, or `NULL` if no value can be computed.
///
/// 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.
///
/// - 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.
#[unsafe(method(newTimedMetadataSampleBufferAndResetAnalyzer))]
#[unsafe(method_family = none)]
pub unsafe fn newTimedMetadataSampleBufferAndResetAnalyzer(
&self,
) -> Option<Retained<CMSampleBuffer>>;
/// Calling this method resets the analyzer to its initial state so that a new run of audio sample buffers can be analyzed.
///
/// Call this method if you need to abort generating the audio timed metadata buffer for audio already provided to ``analyzeAudioSample:``.
#[unsafe(method(resetAnalyzer))]
#[unsafe(method_family = none)]
pub unsafe fn resetAnalyzer(&self);
);
}
/// Methods declared on superclass `NSObject`.
impl AVCaptureSpatialAudioMetadataSampleGenerator {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}