objc2_av_foundation/generated/AVCaptureAudioDataOutput.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::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13 /// AVCaptureAudioDataOutput is a concrete subclass of AVCaptureOutput that can be used to process uncompressed or compressed samples from the audio being captured.
14 ///
15 ///
16 /// Instances of AVCaptureAudioDataOutput produce audio sample buffers suitable for processing using other media APIs. Applications can access the sample buffers with the captureOutput:didOutputSampleBuffer:fromConnection: delegate method.
17 ///
18 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureaudiodataoutput?language=objc)
19 #[unsafe(super(AVCaptureOutput, NSObject))]
20 #[derive(Debug, PartialEq, Eq, Hash)]
21 #[cfg(feature = "AVCaptureOutputBase")]
22 pub struct AVCaptureAudioDataOutput;
23);
24
25#[cfg(feature = "AVCaptureOutputBase")]
26unsafe impl NSObjectProtocol for AVCaptureAudioDataOutput {}
27
28#[cfg(feature = "AVCaptureOutputBase")]
29impl AVCaptureAudioDataOutput {
30 extern_methods!(
31 #[unsafe(method(init))]
32 #[unsafe(method_family = init)]
33 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
34
35 #[unsafe(method(new))]
36 #[unsafe(method_family = new)]
37 pub unsafe fn new() -> Retained<Self>;
38
39 /// The receiver's delegate.
40 ///
41 ///
42 /// The value of this property is an object conforming to the AVCaptureAudioDataOutputSampleBufferDelegate protocol that will receive sample buffers after they are captured. The delegate is set using the setSampleBufferDelegate:queue: method.
43 #[unsafe(method(sampleBufferDelegate))]
44 #[unsafe(method_family = none)]
45 pub unsafe fn sampleBufferDelegate(
46 &self,
47 ) -> Option<Retained<ProtocolObject<dyn AVCaptureAudioDataOutputSampleBufferDelegate>>>;
48
49 /// Specifies the settings used to decode or re-encode audio before it is output by the receiver.
50 ///
51 ///
52 /// The value of this property is an NSDictionary containing values for audio settings keys defined in AVAudioSettings.h. When audioSettings is set to nil, the AVCaptureAudioDataOutput vends samples in their device native format.
53 #[unsafe(method(audioSettings))]
54 #[unsafe(method_family = none)]
55 pub unsafe fn audioSettings(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
56
57 /// Setter for [`audioSettings`][Self::audioSettings].
58 #[unsafe(method(setAudioSettings:))]
59 #[unsafe(method_family = none)]
60 pub unsafe fn setAudioSettings(
61 &self,
62 audio_settings: Option<&NSDictionary<NSString, AnyObject>>,
63 );
64
65 #[cfg(feature = "AVMediaFormat")]
66 /// Specifies the recommended settings for use with an AVAssetWriterInput.
67 ///
68 ///
69 /// Parameter `outputFileType`: Specifies the UTI of the file type to be written (see AVMediaFormat.h for a list of file format UTIs).
70 ///
71 /// Returns: A fully populated dictionary of keys and values that are compatible with AVAssetWriter.
72 ///
73 ///
74 /// The value of this property is an NSDictionary containing values for compression settings keys defined in AVAudioSettings.h. This dictionary is suitable for use as the "outputSettings" parameter when creating an AVAssetWriterInput, such as,
75 ///
76 /// [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeAudio outputSettings:outputSettings sourceFormatHint:hint];
77 ///
78 /// The dictionary returned contains all necessary keys and values needed by AVAssetWriter (see AVAssetWriterInput.h, -initWithMediaType:outputSettings: for a more in depth discussion). For QuickTime movie and ISO files, the recommended audio settings will always produce output comparable to that of AVCaptureMovieFileOutput.
79 ///
80 /// Note that the dictionary of settings is dependent on the current configuration of the receiver's AVCaptureSession and its inputs. The settings dictionary may change if the session's configuration changes. As such, you should configure your session first, then query the recommended audio settings.
81 #[unsafe(method(recommendedAudioSettingsForAssetWriterWithOutputFileType:))]
82 #[unsafe(method_family = none)]
83 pub unsafe fn recommendedAudioSettingsForAssetWriterWithOutputFileType(
84 &self,
85 output_file_type: &AVFileType,
86 ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
87 );
88}
89
90extern_protocol!(
91 /// Defines an interface for delegates of AVCaptureAudioDataOutput to receive captured audio sample buffers.
92 ///
93 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureaudiodataoutputsamplebufferdelegate?language=objc)
94 pub unsafe trait AVCaptureAudioDataOutputSampleBufferDelegate: NSObjectProtocol {
95 #[cfg(all(
96 feature = "AVCaptureOutputBase",
97 feature = "AVCaptureSession",
98 feature = "objc2-core-media"
99 ))]
100 /// Called whenever an AVCaptureAudioDataOutput instance outputs a new audio sample buffer.
101 ///
102 ///
103 /// Parameter `output`: The AVCaptureAudioDataOutput instance that output the samples.
104 ///
105 /// Parameter `sampleBuffer`: A CMSampleBuffer object containing the audio samples and additional information about them, such as their format and presentation time.
106 ///
107 /// Parameter `connection`: The AVCaptureConnection from which the audio was received.
108 ///
109 ///
110 /// Delegates receive this message whenever the output captures and outputs new audio samples, decoding or re-encoding as specified by the audioSettings property. Delegates can use the provided sample buffer in conjunction with other APIs for further processing. This method will be called on the dispatch queue specified by the output's sampleBufferCallbackQueue property. This method is called periodically, so it must be efficient to prevent capture performance problems, including dropped audio samples.
111 ///
112 /// Clients that need to reference the CMSampleBuffer object outside of the scope of this method must CFRetain it and then CFRelease it when they are finished with it.
113 #[optional]
114 #[unsafe(method(captureOutput:didOutputSampleBuffer:fromConnection:))]
115 #[unsafe(method_family = none)]
116 unsafe fn captureOutput_didOutputSampleBuffer_fromConnection(
117 &self,
118 output: &AVCaptureOutput,
119 sample_buffer: &CMSampleBuffer,
120 connection: &AVCaptureConnection,
121 );
122 }
123);