objc2_audio_toolbox/generated/
AudioFile.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7use objc2::__framework_prelude::*;
8#[cfg(feature = "objc2-core-audio-types")]
9use objc2_core_audio_types::*;
10#[cfg(feature = "objc2-core-foundation")]
11use objc2_core_foundation::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_album?language=objc)
16pub const kAFInfoDictionary_Album: &CStr =
17    unsafe { CStr::from_bytes_with_nul_unchecked(b"album\0") };
18/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_approximatedurationinseconds?language=objc)
19pub const kAFInfoDictionary_ApproximateDurationInSeconds: &CStr =
20    unsafe { CStr::from_bytes_with_nul_unchecked(b"approximate duration in seconds\0") };
21/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_artist?language=objc)
22pub const kAFInfoDictionary_Artist: &CStr =
23    unsafe { CStr::from_bytes_with_nul_unchecked(b"artist\0") };
24/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_channellayout?language=objc)
25pub const kAFInfoDictionary_ChannelLayout: &CStr =
26    unsafe { CStr::from_bytes_with_nul_unchecked(b"channel layout\0") };
27/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_comments?language=objc)
28pub const kAFInfoDictionary_Comments: &CStr =
29    unsafe { CStr::from_bytes_with_nul_unchecked(b"comments\0") };
30/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_composer?language=objc)
31pub const kAFInfoDictionary_Composer: &CStr =
32    unsafe { CStr::from_bytes_with_nul_unchecked(b"composer\0") };
33/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_copyright?language=objc)
34pub const kAFInfoDictionary_Copyright: &CStr =
35    unsafe { CStr::from_bytes_with_nul_unchecked(b"copyright\0") };
36/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_encodingapplication?language=objc)
37pub const kAFInfoDictionary_EncodingApplication: &CStr =
38    unsafe { CStr::from_bytes_with_nul_unchecked(b"encoding application\0") };
39/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_genre?language=objc)
40pub const kAFInfoDictionary_Genre: &CStr =
41    unsafe { CStr::from_bytes_with_nul_unchecked(b"genre\0") };
42/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_isrc?language=objc)
43pub const kAFInfoDictionary_ISRC: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"ISRC\0") };
44/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_keysignature?language=objc)
45pub const kAFInfoDictionary_KeySignature: &CStr =
46    unsafe { CStr::from_bytes_with_nul_unchecked(b"key signature\0") };
47/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_lyricist?language=objc)
48pub const kAFInfoDictionary_Lyricist: &CStr =
49    unsafe { CStr::from_bytes_with_nul_unchecked(b"lyricist\0") };
50/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_nominalbitrate?language=objc)
51pub const kAFInfoDictionary_NominalBitRate: &CStr =
52    unsafe { CStr::from_bytes_with_nul_unchecked(b"nominal bit rate\0") };
53/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_recordeddate?language=objc)
54pub const kAFInfoDictionary_RecordedDate: &CStr =
55    unsafe { CStr::from_bytes_with_nul_unchecked(b"recorded date\0") };
56/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_sourcebitdepth?language=objc)
57pub const kAFInfoDictionary_SourceBitDepth: &CStr =
58    unsafe { CStr::from_bytes_with_nul_unchecked(b"source bit depth\0") };
59/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_sourceencoder?language=objc)
60pub const kAFInfoDictionary_SourceEncoder: &CStr =
61    unsafe { CStr::from_bytes_with_nul_unchecked(b"source encoder\0") };
62/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_subtitle?language=objc)
63pub const kAFInfoDictionary_SubTitle: &CStr =
64    unsafe { CStr::from_bytes_with_nul_unchecked(b"subtitle\0") };
65/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_tempo?language=objc)
66pub const kAFInfoDictionary_Tempo: &CStr =
67    unsafe { CStr::from_bytes_with_nul_unchecked(b"tempo\0") };
68/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_timesignature?language=objc)
69pub const kAFInfoDictionary_TimeSignature: &CStr =
70    unsafe { CStr::from_bytes_with_nul_unchecked(b"time signature\0") };
71/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_title?language=objc)
72pub const kAFInfoDictionary_Title: &CStr =
73    unsafe { CStr::from_bytes_with_nul_unchecked(b"title\0") };
74/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_tracknumber?language=objc)
75pub const kAFInfoDictionary_TrackNumber: &CStr =
76    unsafe { CStr::from_bytes_with_nul_unchecked(b"track number\0") };
77/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kafinfodictionary_year?language=objc)
78pub const kAFInfoDictionary_Year: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"year\0") };
79/// Identifier for an audio file type.
80///
81/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofiletypeid?language=objc)
82pub type AudioFileTypeID = u32;
83
84/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileaifftype?language=objc)
85pub const kAudioFileAIFFType: AudioFileTypeID = 0x41494646;
86/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileaifctype?language=objc)
87pub const kAudioFileAIFCType: AudioFileTypeID = 0x41494643;
88/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilewavetype?language=objc)
89pub const kAudioFileWAVEType: AudioFileTypeID = 0x57415645;
90/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilerf64type?language=objc)
91pub const kAudioFileRF64Type: AudioFileTypeID = 0x52463634;
92/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilebw64type?language=objc)
93pub const kAudioFileBW64Type: AudioFileTypeID = 0x42573634;
94/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilewave64type?language=objc)
95pub const kAudioFileWave64Type: AudioFileTypeID = 0x57363466;
96/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilesounddesigner2type?language=objc)
97pub const kAudioFileSoundDesigner2Type: AudioFileTypeID = 0x53643266;
98/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilenexttype?language=objc)
99pub const kAudioFileNextType: AudioFileTypeID = 0x4e655854;
100/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilemp3type?language=objc)
101pub const kAudioFileMP3Type: AudioFileTypeID = 0x4d504733;
102/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilemp2type?language=objc)
103pub const kAudioFileMP2Type: AudioFileTypeID = 0x4d504732;
104/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilemp1type?language=objc)
105pub const kAudioFileMP1Type: AudioFileTypeID = 0x4d504731;
106/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileac3type?language=objc)
107pub const kAudioFileAC3Type: AudioFileTypeID = 0x61632d33;
108/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileaac_adtstype?language=objc)
109pub const kAudioFileAAC_ADTSType: AudioFileTypeID = 0x61647473;
110/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilempeg4type?language=objc)
111pub const kAudioFileMPEG4Type: AudioFileTypeID = 0x6d703466;
112/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilem4atype?language=objc)
113pub const kAudioFileM4AType: AudioFileTypeID = 0x6d346166;
114/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilem4btype?language=objc)
115pub const kAudioFileM4BType: AudioFileTypeID = 0x6d346266;
116/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilecaftype?language=objc)
117pub const kAudioFileCAFType: AudioFileTypeID = 0x63616666;
118/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofile3gptype?language=objc)
119pub const kAudioFile3GPType: AudioFileTypeID = 0x33677070;
120/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofile3gp2type?language=objc)
121pub const kAudioFile3GP2Type: AudioFileTypeID = 0x33677032;
122/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileamrtype?language=objc)
123pub const kAudioFileAMRType: AudioFileTypeID = 0x616d7266;
124/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileflactype?language=objc)
125pub const kAudioFileFLACType: AudioFileTypeID = 0x666c6163;
126/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilelatminloastype?language=objc)
127pub const kAudioFileLATMInLOASType: AudioFileTypeID = 0x6c6f6173;
128
129/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileunspecifiederror?language=objc)
130pub const kAudioFileUnspecifiedError: OSStatus = 0x7768743f;
131/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileunsupportedfiletypeerror?language=objc)
132pub const kAudioFileUnsupportedFileTypeError: OSStatus = 0x7479703f;
133/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileunsupporteddataformaterror?language=objc)
134pub const kAudioFileUnsupportedDataFormatError: OSStatus = 0x666d743f;
135/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileunsupportedpropertyerror?language=objc)
136pub const kAudioFileUnsupportedPropertyError: OSStatus = 0x7074793f;
137/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilebadpropertysizeerror?language=objc)
138pub const kAudioFileBadPropertySizeError: OSStatus = 0x2173697a;
139/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepermissionserror?language=objc)
140pub const kAudioFilePermissionsError: OSStatus = 0x70726d3f;
141/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilenotoptimizederror?language=objc)
142pub const kAudioFileNotOptimizedError: OSStatus = 0x6f70746d;
143/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileinvalidchunkerror?language=objc)
144pub const kAudioFileInvalidChunkError: OSStatus = 0x63686b3f;
145/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofiledoesnotallow64bitdatasizeerror?language=objc)
146pub const kAudioFileDoesNotAllow64BitDataSizeError: OSStatus = 0x6f66663f;
147/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileinvalidpacketoffseterror?language=objc)
148pub const kAudioFileInvalidPacketOffsetError: OSStatus = 0x70636b3f;
149/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileinvalidpacketdependencyerror?language=objc)
150pub const kAudioFileInvalidPacketDependencyError: OSStatus = 0x6465703f;
151/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileinvalidfileerror?language=objc)
152pub const kAudioFileInvalidFileError: OSStatus = 0x6474613f;
153/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileoperationnotsupportederror?language=objc)
154pub const kAudioFileOperationNotSupportedError: OSStatus = 0x6F703F3F;
155/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilenotopenerror?language=objc)
156pub const kAudioFileNotOpenError: OSStatus = -38;
157/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileendoffileerror?language=objc)
158pub const kAudioFileEndOfFileError: OSStatus = -39;
159/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepositionerror?language=objc)
160pub const kAudioFilePositionError: OSStatus = -40;
161/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilefilenotfounderror?language=objc)
162pub const kAudioFileFileNotFoundError: OSStatus = -43;
163
164/// These are flags that can be used with the CreateURL API call
165///
166/// If set, then the CreateURL call will erase the contents of an existing file
167/// If not set, then the CreateURL call will fail if the file already exists
168///
169/// Normally, newly created and optimized files will have padding added in order to page align
170/// the data to 4KB boundaries. This makes reading the data more efficient.
171/// When disk space is a concern, this flag can be set so that the padding will not be added.
172///
173/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofileflags?language=objc)
174// NS_OPTIONS
175#[repr(transparent)]
176#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
177pub struct AudioFileFlags(pub u32);
178bitflags::bitflags! {
179    impl AudioFileFlags: u32 {
180        #[doc(alias = "kAudioFileFlags_EraseFile")]
181        const EraseFile = 1;
182        #[doc(alias = "kAudioFileFlags_DontPageAlignAudioData")]
183        const DontPageAlignAudioData = 2;
184    }
185}
186
187unsafe impl Encode for AudioFileFlags {
188    const ENCODING: Encoding = u32::ENCODING;
189}
190
191unsafe impl RefEncode for AudioFileFlags {
192    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
193}
194
195/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofilepermissions?language=objc)
196// NS_ENUM
197#[repr(transparent)]
198#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
199pub struct AudioFilePermissions(pub i8);
200impl AudioFilePermissions {
201    #[doc(alias = "kAudioFileReadPermission")]
202    pub const ReadPermission: Self = Self(0x01);
203    #[doc(alias = "kAudioFileWritePermission")]
204    pub const WritePermission: Self = Self(0x02);
205    #[doc(alias = "kAudioFileReadWritePermission")]
206    pub const ReadWritePermission: Self = Self(0x03);
207}
208
209unsafe impl Encode for AudioFilePermissions {
210    const ENCODING: Encoding = i8::ENCODING;
211}
212
213unsafe impl RefEncode for AudioFilePermissions {
214    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
215}
216
217/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/opaqueaudiofileid?language=objc)
218#[repr(C)]
219#[derive(Debug)]
220pub struct OpaqueAudioFileID {
221    inner: [u8; 0],
222    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
223}
224
225unsafe impl RefEncode for OpaqueAudioFileID {
226    const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("OpaqueAudioFileID", &[]));
227}
228
229/// An opaque reference to an AudioFile object.
230///
231/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofileid?language=objc)
232pub type AudioFileID = *mut OpaqueAudioFileID;
233
234/// A constant for an AudioFile property.
235///
236/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofilepropertyid?language=objc)
237pub type AudioFilePropertyID = u32;
238
239/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileloopdirection_nolooping?language=objc)
240pub const kAudioFileLoopDirection_NoLooping: u32 = 0;
241/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileloopdirection_forward?language=objc)
242pub const kAudioFileLoopDirection_Forward: u32 = 1;
243/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileloopdirection_forwardandbackward?language=objc)
244pub const kAudioFileLoopDirection_ForwardAndBackward: u32 = 2;
245/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileloopdirection_backward?language=objc)
246pub const kAudioFileLoopDirection_Backward: u32 = 3;
247
248/// A struct for describing a SMPTE time.
249///
250/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofile_smpte_time?language=objc)
251#[repr(C)]
252#[derive(Clone, Copy, Debug, PartialEq)]
253pub struct AudioFile_SMPTE_Time {
254    pub mHours: i8,
255    pub mMinutes: u8,
256    pub mSeconds: u8,
257    pub mFrames: u8,
258    pub mSubFrameSampleOffset: u32,
259}
260
261unsafe impl Encode for AudioFile_SMPTE_Time {
262    const ENCODING: Encoding = Encoding::Struct(
263        "AudioFile_SMPTE_Time",
264        &[
265            <i8>::ENCODING,
266            <u8>::ENCODING,
267            <u8>::ENCODING,
268            <u8>::ENCODING,
269            <u32>::ENCODING,
270        ],
271    );
272}
273
274unsafe impl RefEncode for AudioFile_SMPTE_Time {
275    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
276}
277
278/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilemarkertype_generic?language=objc)
279pub const kAudioFileMarkerType_Generic: u32 = 0;
280
281/// A marker annotates a position in an audio file with additional information.
282///
283/// (description)
284///
285/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofilemarker?language=objc)
286#[cfg(feature = "objc2-core-foundation")]
287#[repr(C)]
288#[derive(Clone, Copy, Debug, PartialEq)]
289pub struct AudioFileMarker {
290    pub mFramePosition: f64,
291    pub mName: *const CFString,
292    pub mMarkerID: i32,
293    pub mSMPTETime: AudioFile_SMPTE_Time,
294    pub mType: u32,
295    pub mReserved: u16,
296    pub mChannel: u16,
297}
298
299#[cfg(feature = "objc2-core-foundation")]
300unsafe impl Encode for AudioFileMarker {
301    const ENCODING: Encoding = Encoding::Struct(
302        "AudioFileMarker",
303        &[
304            <f64>::ENCODING,
305            <*const CFString>::ENCODING,
306            <i32>::ENCODING,
307            <AudioFile_SMPTE_Time>::ENCODING,
308            <u32>::ENCODING,
309            <u16>::ENCODING,
310            <u16>::ENCODING,
311        ],
312    );
313}
314
315#[cfg(feature = "objc2-core-foundation")]
316unsafe impl RefEncode for AudioFileMarker {
317    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
318}
319
320/// A list of AudioFileMarker.
321///
322/// This defines the SMPTE timing scheme used in the marker list. See CAFFile.h for the values used here.
323///
324/// The number of markers in the mMarkers list.
325///
326/// A list of AudioFileMarker.
327///
328/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofilemarkerlist?language=objc)
329#[cfg(feature = "objc2-core-foundation")]
330#[repr(C)]
331#[derive(Clone, Copy, Debug, PartialEq)]
332pub struct AudioFileMarkerList {
333    pub mSMPTE_TimeType: u32,
334    pub mNumberMarkers: u32,
335    pub mMarkers: [AudioFileMarker; 1],
336}
337
338#[cfg(feature = "objc2-core-foundation")]
339unsafe impl Encode for AudioFileMarkerList {
340    const ENCODING: Encoding = Encoding::Struct(
341        "AudioFileMarkerList",
342        &[
343            <u32>::ENCODING,
344            <u32>::ENCODING,
345            <[AudioFileMarker; 1]>::ENCODING,
346        ],
347    );
348}
349
350#[cfg(feature = "objc2-core-foundation")]
351unsafe impl RefEncode for AudioFileMarkerList {
352    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
353}
354
355// TODO: pub fn NumBytesToNumAudioFileMarkers(in_num_bytes: usize,) -> usize;
356
357// TODO: pub fn NumAudioFileMarkersToNumBytes(in_num_markers: usize,) -> usize;
358
359/// These are flags for an AudioFileRegion that specify a playback direction.
360///
361/// One or multiple of these flags can be set. For example, if both kAudioFileRegionFlag_LoopEnable and
362/// kAudioFileRegionFlag_PlayForward are set, then the region will play as a forward loop. If only
363/// kAudioFileRegionFlag_PlayForward is set, then the region will be played forward once.
364///
365/// If this flag is set, the region will be looped. One or both of the following must also be set.
366///
367/// If this flag is set, the region will be played forward.
368///
369/// If this flag is set, the region will be played backward.
370///
371/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofileregionflags?language=objc)
372// NS_OPTIONS
373#[repr(transparent)]
374#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
375pub struct AudioFileRegionFlags(pub u32);
376bitflags::bitflags! {
377    impl AudioFileRegionFlags: u32 {
378        #[doc(alias = "kAudioFileRegionFlag_LoopEnable")]
379        const LoopEnable = 1;
380        #[doc(alias = "kAudioFileRegionFlag_PlayForward")]
381        const PlayForward = 2;
382        #[doc(alias = "kAudioFileRegionFlag_PlayBackward")]
383        const PlayBackward = 4;
384    }
385}
386
387unsafe impl Encode for AudioFileRegionFlags {
388    const ENCODING: Encoding = u32::ENCODING;
389}
390
391unsafe impl RefEncode for AudioFileRegionFlags {
392    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
393}
394
395/// An AudioFileRegion specifies a segment of audio data.
396///
397/// Generally a region consists of at least two markers marking the beginning and end of the segment.
398/// There may also be other markers defining other meta information such as sync point.
399///
400/// each region must have a unique ID.
401///
402/// The name of the region.
403///
404/// AudioFileRegionFlags.
405///
406/// The number of markers in the mMarkers array.
407///
408/// A variable length array of AudioFileMarkers.
409///
410/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofileregion?language=objc)
411#[cfg(feature = "objc2-core-foundation")]
412#[repr(C)]
413#[derive(Clone, Copy, Debug, PartialEq)]
414pub struct AudioFileRegion {
415    pub mRegionID: u32,
416    pub mName: NonNull<CFString>,
417    pub mFlags: AudioFileRegionFlags,
418    pub mNumberMarkers: u32,
419    pub mMarkers: [AudioFileMarker; 1],
420}
421
422#[cfg(feature = "objc2-core-foundation")]
423unsafe impl Encode for AudioFileRegion {
424    const ENCODING: Encoding = Encoding::Struct(
425        "AudioFileRegion",
426        &[
427            <u32>::ENCODING,
428            <NonNull<CFString>>::ENCODING,
429            <AudioFileRegionFlags>::ENCODING,
430            <u32>::ENCODING,
431            <[AudioFileMarker; 1]>::ENCODING,
432        ],
433    );
434}
435
436#[cfg(feature = "objc2-core-foundation")]
437unsafe impl RefEncode for AudioFileRegion {
438    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
439}
440
441/// A list of the AudioFileRegions in a file.
442///
443/// This is the struct used by the kAudioFilePropertyRegionList property.
444///
445/// This defines the SMPTE timing scheme used in the file. See CAFFile.h for the values used here.
446///
447/// The number of regions in the mRegions list.
448///
449/// A list of AudioFileRegions. Note that AudioFileMarkers are variable length, so this list cannot
450/// be accessed as an array. Use the NextAudioFileRegion macro for traversing the list instead.
451///
452/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofileregionlist?language=objc)
453#[cfg(feature = "objc2-core-foundation")]
454#[repr(C)]
455#[derive(Clone, Copy, Debug, PartialEq)]
456pub struct AudioFileRegionList {
457    pub mSMPTE_TimeType: u32,
458    pub mNumberRegions: u32,
459    pub mRegions: [AudioFileRegion; 1],
460}
461
462#[cfg(feature = "objc2-core-foundation")]
463unsafe impl Encode for AudioFileRegionList {
464    const ENCODING: Encoding = Encoding::Struct(
465        "AudioFileRegionList",
466        &[
467            <u32>::ENCODING,
468            <u32>::ENCODING,
469            <[AudioFileRegion; 1]>::ENCODING,
470        ],
471    );
472}
473
474#[cfg(feature = "objc2-core-foundation")]
475unsafe impl RefEncode for AudioFileRegionList {
476    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
477}
478
479// TODO: pub fn NextAudioFileRegion(in_af_region_ptr: NonNull<AudioFileRegion>,)-> Option<NonNull<AudioFileRegion>>;
480
481/// used for properties kAudioFilePropertyPacketToFrame and kAudioFilePropertyFrameToPacket
482///
483/// See description of kAudioFilePropertyPacketToFrame and kAudioFilePropertyFrameToPacket
484///
485/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audioframepackettranslation?language=objc)
486#[repr(C)]
487#[derive(Clone, Copy, Debug, PartialEq)]
488pub struct AudioFramePacketTranslation {
489    pub mFrame: i64,
490    pub mPacket: i64,
491    pub mFrameOffsetInPacket: u32,
492}
493
494unsafe impl Encode for AudioFramePacketTranslation {
495    const ENCODING: Encoding = Encoding::Struct(
496        "AudioFramePacketTranslation",
497        &[<i64>::ENCODING, <i64>::ENCODING, <u32>::ENCODING],
498    );
499}
500
501unsafe impl RefEncode for AudioFramePacketTranslation {
502    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
503}
504
505/// flags for the AudioBytePacketTranslation mFlags field
506///
507/// There is currently only one flag.
508///
509///
510/// If the set then the result value is an estimate.
511///
512/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiobytepackettranslationflags?language=objc)
513// NS_OPTIONS
514#[repr(transparent)]
515#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
516pub struct AudioBytePacketTranslationFlags(pub u32);
517bitflags::bitflags! {
518    impl AudioBytePacketTranslationFlags: u32 {
519        #[doc(alias = "kBytePacketTranslationFlag_IsEstimate")]
520        const BytePacketTranslationFlag_IsEstimate = 1;
521    }
522}
523
524unsafe impl Encode for AudioBytePacketTranslationFlags {
525    const ENCODING: Encoding = u32::ENCODING;
526}
527
528unsafe impl RefEncode for AudioBytePacketTranslationFlags {
529    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
530}
531
532/// used for properties kAudioFileByteToPacket and kAudioFilePacketToByte
533///
534/// See description of kAudioFileByteToPacket and kAudioFilePacketToByte
535///
536/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiobytepackettranslation?language=objc)
537#[repr(C)]
538#[derive(Clone, Copy, Debug, PartialEq)]
539pub struct AudioBytePacketTranslation {
540    pub mByte: i64,
541    pub mPacket: i64,
542    pub mByteOffsetInPacket: u32,
543    pub mFlags: AudioBytePacketTranslationFlags,
544}
545
546unsafe impl Encode for AudioBytePacketTranslation {
547    const ENCODING: Encoding = Encoding::Struct(
548        "AudioBytePacketTranslation",
549        &[
550            <i64>::ENCODING,
551            <i64>::ENCODING,
552            <u32>::ENCODING,
553            <AudioBytePacketTranslationFlags>::ENCODING,
554        ],
555    );
556}
557
558unsafe impl RefEncode for AudioBytePacketTranslation {
559    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
560}
561
562/// This contains information about the number of valid frames in a file and where they begin and end.
563///
564/// Some data formats may have packets whose contents are not completely valid, but represent priming or remainder
565/// frames that are not meant to be played. For example a file with 100 packets of AAC is nominally 1024 * 100 = 102400 frames
566/// of data. However the first 2112 frames of that may be priming frames and there may be some
567/// number of remainder frames added to pad out to a full packet of 1024 frames. The priming and remainder frames should be
568/// discarded. The total number of packets in the file times the frames per packet (or counting each packet's frames
569/// individually for a variable frames per packet format) minus mPrimingFrames, minus mRemainderFrames, should
570/// equal mNumberValidFrames.
571///
572/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofilepackettableinfo?language=objc)
573#[repr(C)]
574#[derive(Clone, Copy, Debug, PartialEq)]
575pub struct AudioFilePacketTableInfo {
576    pub mNumberValidFrames: i64,
577    pub mPrimingFrames: i32,
578    pub mRemainderFrames: i32,
579}
580
581unsafe impl Encode for AudioFilePacketTableInfo {
582    const ENCODING: Encoding = Encoding::Struct(
583        "AudioFilePacketTableInfo",
584        &[<i64>::ENCODING, <i32>::ENCODING, <i32>::ENCODING],
585    );
586}
587
588unsafe impl RefEncode for AudioFilePacketTableInfo {
589    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
590}
591
592/// used for property kAudioFilePropertyPacketRangeByteCountUpperBound
593///
594/// See description of kAudioFilePropertyPacketRangeByteCountUpperBound
595///
596/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiopacketrangebytecounttranslation?language=objc)
597#[repr(C)]
598#[derive(Clone, Copy, Debug, PartialEq)]
599pub struct AudioPacketRangeByteCountTranslation {
600    pub mPacket: i64,
601    pub mPacketCount: i64,
602    pub mByteCountUpperBound: i64,
603}
604
605unsafe impl Encode for AudioPacketRangeByteCountTranslation {
606    const ENCODING: Encoding = Encoding::Struct(
607        "AudioPacketRangeByteCountTranslation",
608        &[<i64>::ENCODING, <i64>::ENCODING, <i64>::ENCODING],
609    );
610}
611
612unsafe impl RefEncode for AudioPacketRangeByteCountTranslation {
613    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
614}
615
616/// used for property kAudioFilePropertyPacketToRollDistance
617///
618/// See descriptions of kAudioFilePropertyPacketToRollDistance and kAudioFilePropertyRestrictsRandomAccess
619///
620/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiopacketrolldistancetranslation?language=objc)
621#[repr(C)]
622#[derive(Clone, Copy, Debug, PartialEq)]
623pub struct AudioPacketRollDistanceTranslation {
624    pub mPacket: i64,
625    pub mRollDistance: i64,
626}
627
628unsafe impl Encode for AudioPacketRollDistanceTranslation {
629    const ENCODING: Encoding = Encoding::Struct(
630        "AudioPacketRollDistanceTranslation",
631        &[<i64>::ENCODING, <i64>::ENCODING],
632    );
633}
634
635unsafe impl RefEncode for AudioPacketRollDistanceTranslation {
636    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
637}
638
639/// used for property kAudioFilePropertyPreviousIndependentPacket and kAudioFilePropertyNextIndependentPacket
640///
641/// See descriptions of kAudioFilePropertyPreviousIndependentPacket and kAudioFilePropertyNextIndependentPacket
642///
643/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audioindependentpackettranslation?language=objc)
644#[repr(C)]
645#[derive(Clone, Copy, Debug, PartialEq)]
646pub struct AudioIndependentPacketTranslation {
647    pub mPacket: i64,
648    pub mIndependentlyDecodablePacket: i64,
649}
650
651unsafe impl Encode for AudioIndependentPacketTranslation {
652    const ENCODING: Encoding = Encoding::Struct(
653        "AudioIndependentPacketTranslation",
654        &[<i64>::ENCODING, <i64>::ENCODING],
655    );
656}
657
658unsafe impl RefEncode for AudioIndependentPacketTranslation {
659    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
660}
661
662/// used for property kAudioFilePropertyPacketToDependencyInfo
663///
664/// See descriptions of kAudioFilePropertyPacketToDependencyInfo and kAudioFilePropertyRestrictsRandomAccess
665///
666/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiopacketdependencyinfotranslation?language=objc)
667#[repr(C)]
668#[derive(Clone, Copy, Debug, PartialEq)]
669pub struct AudioPacketDependencyInfoTranslation {
670    pub mPacket: i64,
671    pub mIsIndependentlyDecodable: u32,
672    pub mNumberPrerollPackets: u32,
673}
674
675unsafe impl Encode for AudioPacketDependencyInfoTranslation {
676    const ENCODING: Encoding = Encoding::Struct(
677        "AudioPacketDependencyInfoTranslation",
678        &[<i64>::ENCODING, <u32>::ENCODING, <u32>::ENCODING],
679    );
680}
681
682unsafe impl RefEncode for AudioPacketDependencyInfoTranslation {
683    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
684}
685
686extern "C-unwind" {
687    /// creates a new audio file (or initialises an existing file)
688    ///
689    /// creates a new (or initialises an existing) audio file specified by the URL.
690    /// Upon success, an AudioFileID is returned which can be used for subsequent calls
691    /// to the AudioFile APIs.
692    ///
693    /// Parameter `inFileRef`: an CFURLRef fully specifying the path of the file to create/initialise
694    ///
695    /// Parameter `inFileType`: an AudioFileTypeID indicating the type of audio file to create.
696    ///
697    /// Parameter `inFormat`: an AudioStreamBasicDescription describing the data format that will be
698    /// added to the audio file.
699    ///
700    /// Parameter `inFlags`: relevant flags for creating/opening the file.
701    /// if kAudioFileFlags_EraseFile is set, it will erase an existing file
702    /// if not set, then the Create call will fail if the URL is an existing file
703    ///
704    /// Parameter `outAudioFile`: if successful, an AudioFileID that can be used for subsequent AudioFile calls.
705    ///
706    /// Returns: returns noErr if successful.
707    ///
708    /// # Safety
709    ///
710    /// - `in_format` must be a valid pointer.
711    /// - `out_audio_file` must be a valid pointer.
712    #[cfg(all(feature = "objc2-core-audio-types", feature = "objc2-core-foundation"))]
713    pub fn AudioFileCreateWithURL(
714        in_file_ref: &CFURL,
715        in_file_type: AudioFileTypeID,
716        in_format: NonNull<AudioStreamBasicDescription>,
717        in_flags: AudioFileFlags,
718        out_audio_file: NonNull<AudioFileID>,
719    ) -> OSStatus;
720}
721
722extern "C-unwind" {
723    /// Open an existing audio file.
724    ///
725    /// Open an existing audio file for reading or reading and writing.
726    ///
727    /// Parameter `inFileRef`: the CFURLRef of an existing audio file.
728    ///
729    /// Parameter `inPermissions`: use the permission constants
730    ///
731    /// Parameter `inFileTypeHint`: For files which have no filename extension and whose type cannot be easily or
732    /// uniquely determined from the data (ADTS,AC3), this hint can be used to indicate the file type.
733    /// Otherwise you can pass zero for this. The hint is only used on OS versions 10.3.1 or greater.
734    /// For OS versions prior to that, opening files of the above description will fail.
735    ///
736    /// Parameter `outAudioFile`: upon success, an AudioFileID that can be used for subsequent
737    /// AudioFile calls.
738    ///
739    /// Returns: returns noErr if successful.
740    ///
741    /// # Safety
742    ///
743    /// `out_audio_file` must be a valid pointer.
744    #[cfg(feature = "objc2-core-foundation")]
745    pub fn AudioFileOpenURL(
746        in_file_ref: &CFURL,
747        in_permissions: AudioFilePermissions,
748        in_file_type_hint: AudioFileTypeID,
749        out_audio_file: NonNull<AudioFileID>,
750    ) -> OSStatus;
751}
752
753/// A callback for reading data. used with AudioFileOpenWithCallbacks or AudioFileInitializeWithCallbacks.
754///
755/// a function that will be called when AudioFile needs to read data.
756///
757/// Parameter `inClientData`: A pointer to the client data as set in the inClientData parameter to AudioFileXXXWithCallbacks.
758///
759/// Parameter `inPosition`: An offset into the data from which to read.
760///
761/// Parameter `requestCount`: The number of bytes to read.
762///
763/// Parameter `buffer`: The buffer in which to put the data read.
764///
765/// Parameter `actualCount`: The callback should set this to the number of bytes successfully read.
766///
767/// Returns: The callback should return noErr on success, or an appropriate error code on failure.
768///
769/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofile_readproc?language=objc)
770pub type AudioFile_ReadProc = Option<
771    unsafe extern "C-unwind" fn(
772        NonNull<c_void>,
773        i64,
774        u32,
775        NonNull<c_void>,
776        NonNull<u32>,
777    ) -> OSStatus,
778>;
779
780/// A callback for writing data. used with AudioFileOpenWithCallbacks or AudioFileInitializeWithCallbacks.
781///
782/// a function that will be called when AudioFile needs to write data.
783///
784/// Parameter `inClientData`: A pointer to the client data as set in the inClientData parameter to AudioFileXXXWithCallbacks.
785///
786/// Parameter `inPosition`: An offset into the data from which to read.
787///
788/// Parameter `requestCount`: The number of bytes to write.
789///
790/// Parameter `buffer`: The buffer containing the data to write.
791///
792/// Parameter `actualCount`: The callback should set this to the number of bytes successfully written.
793///
794/// Returns: The callback should return noErr on success, or an appropriate error code on failure.
795///
796/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofile_writeproc?language=objc)
797pub type AudioFile_WriteProc = Option<
798    unsafe extern "C-unwind" fn(
799        NonNull<c_void>,
800        i64,
801        u32,
802        NonNull<c_void>,
803        NonNull<u32>,
804    ) -> OSStatus,
805>;
806
807/// A callback for getting the size of the file data. used with AudioFileOpenWithCallbacks or AudioFileInitializeWithCallbacks.
808///
809/// a function that will be called when AudioFile needs to determine the size of the file data. This size is for all of the
810/// data in the file, not just the audio data.
811///
812/// Parameter `inClientData`: A pointer to the client data as set in the inClientData parameter to AudioFileXXXWithCallbacks.
813///
814/// Returns: The callback should return the size of the data.
815///
816/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofile_getsizeproc?language=objc)
817pub type AudioFile_GetSizeProc = Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> i64>;
818
819/// A callback for setting the size of the file data. used with AudioFileOpenWithCallbacks or AudioFileInitializeWithCallbacks.
820///
821/// a function that will be called when AudioFile needs to set the size of the file data. This size is for all of the
822/// data in the file, not just the audio data. This will only be called if the file is written to.
823///
824/// Parameter `inClientData`: A pointer to the client data as set in the inClientData parameter to AudioFileXXXWithCallbacks.
825///
826/// Returns: The callback should return the size of the data.
827///
828/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofile_setsizeproc?language=objc)
829pub type AudioFile_SetSizeProc =
830    Option<unsafe extern "C-unwind" fn(NonNull<c_void>, i64) -> OSStatus>;
831
832extern "C-unwind" {
833    /// Wipe clean an existing file. You provide callbacks that the AudioFile API
834    /// will use to get the data.
835    ///
836    /// Parameter `inClientData`: a constant that will be passed to your callbacks.
837    ///
838    /// Parameter `inReadFunc`: a function that will be called when AudioFile needs to read data.
839    ///
840    /// Parameter `inWriteFunc`: a function that will be called when AudioFile needs to write data.
841    ///
842    /// Parameter `inGetSizeFunc`: a function that will be called when AudioFile needs to know the file size.
843    ///
844    /// Parameter `inSetSizeFunc`: a function that will be called when AudioFile needs to set the file size.
845    ///
846    ///
847    /// Parameter `inFileType`: an AudioFileTypeID indicating the type of audio file to which to initialize the file.
848    ///
849    /// Parameter `inFormat`: an AudioStreamBasicDescription describing the data format that will be
850    /// added to the audio file.
851    ///
852    /// Parameter `inFlags`: flags for creating/opening the file. Currently zero.
853    ///
854    /// Parameter `outAudioFile`: upon success, an AudioFileID that can be used for subsequent
855    /// AudioFile calls.
856    ///
857    /// Returns: returns noErr if successful.
858    ///
859    /// # Safety
860    ///
861    /// - `in_client_data` must be a valid pointer.
862    /// - `in_read_func` must be implemented correctly.
863    /// - `in_write_func` must be implemented correctly.
864    /// - `in_get_size_func` must be implemented correctly.
865    /// - `in_set_size_func` must be implemented correctly.
866    /// - `in_format` must be a valid pointer.
867    /// - `out_audio_file` must be a valid pointer.
868    #[cfg(feature = "objc2-core-audio-types")]
869    pub fn AudioFileInitializeWithCallbacks(
870        in_client_data: NonNull<c_void>,
871        in_read_func: AudioFile_ReadProc,
872        in_write_func: AudioFile_WriteProc,
873        in_get_size_func: AudioFile_GetSizeProc,
874        in_set_size_func: AudioFile_SetSizeProc,
875        in_file_type: AudioFileTypeID,
876        in_format: NonNull<AudioStreamBasicDescription>,
877        in_flags: AudioFileFlags,
878        out_audio_file: NonNull<AudioFileID>,
879    ) -> OSStatus;
880}
881
882extern "C-unwind" {
883    /// Open an existing file. You provide callbacks that the AudioFile API
884    /// will use to get the data.
885    ///
886    /// Parameter `inClientData`: a constant that will be passed to your callbacks.
887    ///
888    /// Parameter `inReadFunc`: a function that will be called when AudioFile needs to read data.
889    ///
890    /// Parameter `inWriteFunc`: a function that will be called when AudioFile needs to write data.
891    ///
892    /// Parameter `inGetSizeFunc`: a function that will be called when AudioFile needs to know the total file size.
893    ///
894    /// Parameter `inSetSizeFunc`: a function that will be called when AudioFile needs to set the file size.
895    ///
896    ///
897    /// Parameter `inFileTypeHint`: For files which have no filename extension and whose type cannot be easily or
898    /// uniquely determined from the data (ADTS,AC3), this hint can be used to indicate the file type.
899    /// Otherwise you can pass zero for this. The hint is only used on OS versions 10.3.1 or greater.
900    /// For OS versions prior to that, opening files of the above description will fail.
901    ///
902    /// Parameter `outAudioFile`: upon success, an AudioFileID that can be used for subsequent
903    /// AudioFile calls.
904    ///
905    /// Returns: returns noErr if successful.
906    ///
907    /// # Safety
908    ///
909    /// - `in_client_data` must be a valid pointer.
910    /// - `in_read_func` must be implemented correctly.
911    /// - `in_write_func` must be implemented correctly.
912    /// - `in_get_size_func` must be implemented correctly.
913    /// - `in_set_size_func` must be implemented correctly.
914    /// - `out_audio_file` must be a valid pointer.
915    pub fn AudioFileOpenWithCallbacks(
916        in_client_data: NonNull<c_void>,
917        in_read_func: AudioFile_ReadProc,
918        in_write_func: AudioFile_WriteProc,
919        in_get_size_func: AudioFile_GetSizeProc,
920        in_set_size_func: AudioFile_SetSizeProc,
921        in_file_type_hint: AudioFileTypeID,
922        out_audio_file: NonNull<AudioFileID>,
923    ) -> OSStatus;
924}
925
926extern "C-unwind" {
927    /// Close an existing audio file.
928    ///
929    /// Parameter `inAudioFile`: an AudioFileID.
930    ///
931    /// Returns: returns noErr if successful.
932    ///
933    /// # Safety
934    ///
935    /// `in_audio_file` must be a valid pointer.
936    pub fn AudioFileClose(in_audio_file: AudioFileID) -> OSStatus;
937}
938
939extern "C-unwind" {
940    /// Move the audio data to the end of the file and other internal optimizations of the file structure.
941    ///
942    /// Optimize the file so additional audio data can be appended to
943    /// the existing data. Generally, this will place the audio data at
944    /// the end of the file so additional writes can be placed to the
945    /// file end. This can be a potentially expensive and time-consuming operation
946    /// and should not be used during time critical operations. There is
947    /// a kAudioFilePropertyIsOptimized property for checking on the optimized state
948    /// of the file.
949    ///
950    /// Parameter `inAudioFile`: an AudioFileID.
951    ///
952    /// Returns: returns noErr if successful.
953    ///
954    /// # Safety
955    ///
956    /// `in_audio_file` must be a valid pointer.
957    pub fn AudioFileOptimize(in_audio_file: AudioFileID) -> OSStatus;
958}
959
960/// Read bytes of audio data from the audio file.
961///
962///
963/// Returns kAudioFileEndOfFileError when read encounters end of file.
964///
965/// Parameter `inAudioFile`: an AudioFileID.
966///
967/// Parameter `inUseCache`: true if it is desired to cache the data upon read, else false
968///
969/// Parameter `inStartingByte`: the byte offset of the audio data desired to be returned
970///
971/// Parameter `ioNumBytes`: on input, the number of bytes to read, on output, the number of
972/// bytes actually read.
973///
974/// Parameter `outBuffer`: outBuffer should be a void * to user allocated memory large enough for the requested bytes.
975///
976/// Returns: returns noErr if successful.
977///
978/// # Safety
979///
980/// - `in_audio_file` must be a valid pointer.
981/// - `io_num_bytes` must be a valid pointer.
982/// - `out_buffer` must be a valid pointer.
983#[inline]
984pub unsafe extern "C-unwind" fn AudioFileReadBytes(
985    in_audio_file: AudioFileID,
986    in_use_cache: bool,
987    in_starting_byte: i64,
988    io_num_bytes: NonNull<u32>,
989    out_buffer: NonNull<c_void>,
990) -> OSStatus {
991    extern "C-unwind" {
992        fn AudioFileReadBytes(
993            in_audio_file: AudioFileID,
994            in_use_cache: Boolean,
995            in_starting_byte: i64,
996            io_num_bytes: NonNull<u32>,
997            out_buffer: NonNull<c_void>,
998        ) -> OSStatus;
999    }
1000    unsafe {
1001        AudioFileReadBytes(
1002            in_audio_file,
1003            in_use_cache as _,
1004            in_starting_byte,
1005            io_num_bytes,
1006            out_buffer,
1007        )
1008    }
1009}
1010
1011/// Write bytes of audio data to the audio file.
1012///
1013/// Parameter `inAudioFile`: an AudioFileID.
1014///
1015/// Parameter `inUseCache`: true if it is desired to cache the data upon write, else false
1016///
1017/// Parameter `inStartingByte`: the byte offset where the audio data should be written
1018///
1019/// Parameter `ioNumBytes`: on input, the number of bytes to write, on output, the number of
1020/// bytes actually written.
1021///
1022/// Parameter `inBuffer`: inBuffer should be a void * containing the bytes to be written
1023///
1024/// Returns: returns noErr if successful.
1025///
1026/// # Safety
1027///
1028/// - `in_audio_file` must be a valid pointer.
1029/// - `io_num_bytes` must be a valid pointer.
1030/// - `in_buffer` must be a valid pointer.
1031#[inline]
1032pub unsafe extern "C-unwind" fn AudioFileWriteBytes(
1033    in_audio_file: AudioFileID,
1034    in_use_cache: bool,
1035    in_starting_byte: i64,
1036    io_num_bytes: NonNull<u32>,
1037    in_buffer: NonNull<c_void>,
1038) -> OSStatus {
1039    extern "C-unwind" {
1040        fn AudioFileWriteBytes(
1041            in_audio_file: AudioFileID,
1042            in_use_cache: Boolean,
1043            in_starting_byte: i64,
1044            io_num_bytes: NonNull<u32>,
1045            in_buffer: NonNull<c_void>,
1046        ) -> OSStatus;
1047    }
1048    unsafe {
1049        AudioFileWriteBytes(
1050            in_audio_file,
1051            in_use_cache as _,
1052            in_starting_byte,
1053            io_num_bytes,
1054            in_buffer,
1055        )
1056    }
1057}
1058
1059/// Read packets of audio data from the audio file.
1060///
1061/// AudioFileReadPacketData reads as many of the requested number of packets
1062/// as will fit in the buffer size given by ioNumPackets.
1063/// Unlike the deprecated AudioFileReadPackets, ioNumPackets must be initialized.
1064/// If the byte size of the number packets requested is
1065/// less than the buffer size, ioNumBytes will be reduced.
1066/// If the buffer is too small for the number of packets
1067/// requested, ioNumPackets and ioNumBytes will be reduced
1068/// to the number of packets that can be accommodated and their byte size.
1069/// Returns kAudioFileEndOfFileError when read encounters end of file.
1070/// For all uncompressed formats, packets == frames.
1071///
1072///
1073/// Parameter `inAudioFile`: an AudioFileID.
1074///
1075/// Parameter `inUseCache`: true if it is desired to cache the data upon read, else false
1076///
1077/// Parameter `ioNumBytes`: on input the size of outBuffer in bytes.
1078/// on output, the number of bytes actually returned.
1079///
1080/// Parameter `outPacketDescriptions`: An array of packet descriptions describing the packets being returned.
1081/// The size of the array must be greater or equal to the number of packets requested.
1082/// On return the packet description will be filled out with the packet offsets and sizes.
1083/// Packet descriptions are ignored for CBR data.
1084///
1085/// Parameter `inStartingPacket`: The packet index of the first packet desired to be returned
1086///
1087/// Parameter `ioNumPackets`: on input, the number of packets to read, on output, the number of
1088/// packets actually read.
1089///
1090/// Parameter `outBuffer`: outBuffer should be a pointer to user allocated memory.
1091///
1092/// Returns: returns noErr if successful.
1093///
1094/// # Safety
1095///
1096/// - `in_audio_file` must be a valid pointer.
1097/// - `io_num_bytes` must be a valid pointer.
1098/// - `out_packet_descriptions` must be a valid pointer or null.
1099/// - `io_num_packets` must be a valid pointer.
1100/// - `out_buffer` must be a valid pointer or null.
1101#[cfg(feature = "objc2-core-audio-types")]
1102#[inline]
1103pub unsafe extern "C-unwind" fn AudioFileReadPacketData(
1104    in_audio_file: AudioFileID,
1105    in_use_cache: bool,
1106    io_num_bytes: NonNull<u32>,
1107    out_packet_descriptions: *mut AudioStreamPacketDescription,
1108    in_starting_packet: i64,
1109    io_num_packets: NonNull<u32>,
1110    out_buffer: *mut c_void,
1111) -> OSStatus {
1112    extern "C-unwind" {
1113        fn AudioFileReadPacketData(
1114            in_audio_file: AudioFileID,
1115            in_use_cache: Boolean,
1116            io_num_bytes: NonNull<u32>,
1117            out_packet_descriptions: *mut AudioStreamPacketDescription,
1118            in_starting_packet: i64,
1119            io_num_packets: NonNull<u32>,
1120            out_buffer: *mut c_void,
1121        ) -> OSStatus;
1122    }
1123    unsafe {
1124        AudioFileReadPacketData(
1125            in_audio_file,
1126            in_use_cache as _,
1127            io_num_bytes,
1128            out_packet_descriptions,
1129            in_starting_packet,
1130            io_num_packets,
1131            out_buffer,
1132        )
1133    }
1134}
1135
1136/// Read packets of audio data from the audio file.
1137///
1138/// AudioFileReadPackets is DEPRECATED. Use AudioFileReadPacketData instead.
1139/// READ THE HEADER DOC FOR AudioFileReadPacketData. It is not a drop-in replacement.
1140/// In particular, for AudioFileReadPacketData ioNumBytes must be initialized to the buffer size.
1141/// AudioFileReadPackets assumes you have allocated your buffer to ioNumPackets times the maximum packet size.
1142/// For many compressed formats this will only use a portion of the buffer since the ratio of the maximum
1143/// packet size to the typical packet size can be large. Use AudioFileReadPacketData instead.
1144///
1145///
1146/// Parameter `inAudioFile`: an AudioFileID.
1147///
1148/// Parameter `inUseCache`: true if it is desired to cache the data upon read, else false
1149///
1150/// Parameter `outNumBytes`: on output, the number of bytes actually returned
1151///
1152/// Parameter `outPacketDescriptions`: on output, an array of packet descriptions describing
1153/// the packets being returned. NULL may be passed for this
1154/// parameter. Nothing will be returned for linear pcm data.
1155///
1156/// Parameter `inStartingPacket`: the packet index of the first packet desired to be returned
1157///
1158/// Parameter `ioNumPackets`: on input, the number of packets to read, on output, the number of
1159/// packets actually read.
1160///
1161/// Parameter `outBuffer`: outBuffer should be a pointer to user allocated memory of size:
1162/// number of packets requested times file's maximum (or upper bound on)
1163/// packet size.
1164///
1165/// Returns: returns noErr if successful.
1166///
1167/// # Safety
1168///
1169/// - `in_audio_file` must be a valid pointer.
1170/// - `out_num_bytes` must be a valid pointer.
1171/// - `out_packet_descriptions` must be a valid pointer or null.
1172/// - `io_num_packets` must be a valid pointer.
1173/// - `out_buffer` must be a valid pointer or null.
1174#[cfg(feature = "objc2-core-audio-types")]
1175#[deprecated = "no longer supported"]
1176#[inline]
1177pub unsafe extern "C-unwind" fn AudioFileReadPackets(
1178    in_audio_file: AudioFileID,
1179    in_use_cache: bool,
1180    out_num_bytes: NonNull<u32>,
1181    out_packet_descriptions: *mut AudioStreamPacketDescription,
1182    in_starting_packet: i64,
1183    io_num_packets: NonNull<u32>,
1184    out_buffer: *mut c_void,
1185) -> OSStatus {
1186    extern "C-unwind" {
1187        fn AudioFileReadPackets(
1188            in_audio_file: AudioFileID,
1189            in_use_cache: Boolean,
1190            out_num_bytes: NonNull<u32>,
1191            out_packet_descriptions: *mut AudioStreamPacketDescription,
1192            in_starting_packet: i64,
1193            io_num_packets: NonNull<u32>,
1194            out_buffer: *mut c_void,
1195        ) -> OSStatus;
1196    }
1197    unsafe {
1198        AudioFileReadPackets(
1199            in_audio_file,
1200            in_use_cache as _,
1201            out_num_bytes,
1202            out_packet_descriptions,
1203            in_starting_packet,
1204            io_num_packets,
1205            out_buffer,
1206        )
1207    }
1208}
1209
1210/// Write packets of audio data to the audio file.
1211///
1212/// For all uncompressed formats, packets == frames.
1213///
1214/// Parameter `inAudioFile`: an AudioFileID.
1215///
1216/// Parameter `inUseCache`: true if it is desired to cache the data upon write, else false
1217///
1218/// Parameter `inNumBytes`: the number of bytes being provided for write
1219///
1220/// Parameter `inPacketDescriptions`: an array of packet descriptions describing the packets being
1221/// provided. Not all formats require packet descriptions to be
1222/// provided. NULL may be passed if no descriptions are required.
1223///
1224/// Parameter `inStartingPacket`: the packet index of where the first packet provided should be placed.
1225///
1226/// Parameter `ioNumPackets`: on input, the number of packets to write, on output, the number of
1227/// packets actually written.
1228///
1229/// Parameter `inBuffer`: a void * to user allocated memory containing the packets to write.
1230///
1231/// Returns: returns noErr if successful.
1232///
1233/// # Safety
1234///
1235/// - `in_audio_file` must be a valid pointer.
1236/// - `in_packet_descriptions` must be a valid pointer or null.
1237/// - `io_num_packets` must be a valid pointer.
1238/// - `in_buffer` must be a valid pointer.
1239#[cfg(feature = "objc2-core-audio-types")]
1240#[inline]
1241pub unsafe extern "C-unwind" fn AudioFileWritePackets(
1242    in_audio_file: AudioFileID,
1243    in_use_cache: bool,
1244    in_num_bytes: u32,
1245    in_packet_descriptions: *const AudioStreamPacketDescription,
1246    in_starting_packet: i64,
1247    io_num_packets: NonNull<u32>,
1248    in_buffer: NonNull<c_void>,
1249) -> OSStatus {
1250    extern "C-unwind" {
1251        fn AudioFileWritePackets(
1252            in_audio_file: AudioFileID,
1253            in_use_cache: Boolean,
1254            in_num_bytes: u32,
1255            in_packet_descriptions: *const AudioStreamPacketDescription,
1256            in_starting_packet: i64,
1257            io_num_packets: NonNull<u32>,
1258            in_buffer: NonNull<c_void>,
1259        ) -> OSStatus;
1260    }
1261    unsafe {
1262        AudioFileWritePackets(
1263            in_audio_file,
1264            in_use_cache as _,
1265            in_num_bytes,
1266            in_packet_descriptions,
1267            in_starting_packet,
1268            io_num_packets,
1269            in_buffer,
1270        )
1271    }
1272}
1273
1274/// Write packets of audio data with corresponding packet dependencies to an audio data file.
1275///
1276/// For all uncompressed formats, `packets == frames`.
1277///
1278/// Parameter `inAudioFile`: The audio file to write to.
1279///
1280/// Parameter `inUseCache`: Set to `true` if you want to cache the data. Otherwise, set to `false`.
1281///
1282/// Parameter `inNumBytes`: The number of bytes of audio data being written.
1283///
1284/// Parameter `inPacketDescriptions`: A pointer to an array of packet descriptions for the audio data.
1285/// Not all formats require packet descriptions. If no packet descriptions
1286/// are required, for instance, if you are writing CBR data,  pass `NULL`.
1287///
1288/// Parameter `inPacketDependencies`: A pointer to an array of packet dependencies for the audio data.
1289/// This must not be `NULL`.  To write packets without dependencies,
1290/// use ``AudioFileWritePackets`` instead.
1291///
1292/// Parameter `inStartingPacket`: The packet index for the placement of the first provided packet.
1293///
1294/// Parameter `ioNumPackets`: On input, a pointer to the number of packets to write.
1295/// On output, a pointer to the number of packets actually written.
1296///
1297/// Parameter `inBuffer`: A pointer to user-allocated memory containing the new audio data
1298/// to write to the audio data file.
1299///
1300/// Returns: A result code. See Result Codes.
1301///
1302/// # Safety
1303///
1304/// - `in_audio_file` must be a valid pointer.
1305/// - `in_packet_descriptions` must be a valid pointer or null.
1306/// - `in_packet_dependencies` must be a valid pointer.
1307/// - `io_num_packets` must be a valid pointer.
1308/// - `in_buffer` must be a valid pointer.
1309#[cfg(feature = "objc2-core-audio-types")]
1310#[inline]
1311pub unsafe extern "C-unwind" fn AudioFileWritePacketsWithDependencies(
1312    in_audio_file: AudioFileID,
1313    in_use_cache: bool,
1314    in_num_bytes: u32,
1315    in_packet_descriptions: *const AudioStreamPacketDescription,
1316    in_packet_dependencies: NonNull<AudioStreamPacketDependencyDescription>,
1317    in_starting_packet: i64,
1318    io_num_packets: NonNull<u32>,
1319    in_buffer: NonNull<c_void>,
1320) -> OSStatus {
1321    extern "C-unwind" {
1322        fn AudioFileWritePacketsWithDependencies(
1323            in_audio_file: AudioFileID,
1324            in_use_cache: Boolean,
1325            in_num_bytes: u32,
1326            in_packet_descriptions: *const AudioStreamPacketDescription,
1327            in_packet_dependencies: NonNull<AudioStreamPacketDependencyDescription>,
1328            in_starting_packet: i64,
1329            io_num_packets: NonNull<u32>,
1330            in_buffer: NonNull<c_void>,
1331        ) -> OSStatus;
1332    }
1333    unsafe {
1334        AudioFileWritePacketsWithDependencies(
1335            in_audio_file,
1336            in_use_cache as _,
1337            in_num_bytes,
1338            in_packet_descriptions,
1339            in_packet_dependencies,
1340            in_starting_packet,
1341            io_num_packets,
1342            in_buffer,
1343        )
1344    }
1345}
1346
1347extern "C-unwind" {
1348    /// Get the number of user data items with a certain ID in the file
1349    ///
1350    /// "User Data" refers to chunks in AIFF, CAF and WAVE files, or resources
1351    /// in Sound Designer II files, and possibly other things in other files.
1352    /// For simplicity, referred to below as "chunks".
1353    ///
1354    /// Parameter `inAudioFile`: an AudioFileID.
1355    ///
1356    /// Parameter `inUserDataID`: the four char code of the chunk.
1357    ///
1358    /// Parameter `outNumberItems`: on output, if successful, number of chunks of this type in the file.
1359    ///
1360    /// Returns: returns noErr if successful.
1361    ///
1362    /// # Safety
1363    ///
1364    /// - `in_audio_file` must be a valid pointer.
1365    /// - `out_number_items` must be a valid pointer.
1366    pub fn AudioFileCountUserData(
1367        in_audio_file: AudioFileID,
1368        in_user_data_id: u32,
1369        out_number_items: NonNull<u32>,
1370    ) -> OSStatus;
1371}
1372
1373extern "C-unwind" {
1374    /// Get the size of user data in a file
1375    ///
1376    /// Parameter `inAudioFile`: an AudioFileID.
1377    ///
1378    /// Parameter `inUserDataID`: the four char code of the chunk.
1379    ///
1380    /// Parameter `inIndex`: an index specifying which chunk if there are more than one.
1381    ///
1382    /// Parameter `outUserDataSize`: on output, if successful, the size of the user data chunk.
1383    ///
1384    /// Returns: returns noErr if successful.
1385    ///
1386    /// # Safety
1387    ///
1388    /// - `in_audio_file` must be a valid pointer.
1389    /// - `out_user_data_size` must be a valid pointer.
1390    pub fn AudioFileGetUserDataSize(
1391        in_audio_file: AudioFileID,
1392        in_user_data_id: u32,
1393        in_index: u32,
1394        out_user_data_size: NonNull<u32>,
1395    ) -> OSStatus;
1396}
1397
1398extern "C-unwind" {
1399    /// Get the 64-bit size of user data in a file
1400    ///
1401    /// Parameter `inAudioFile`: an AudioFileID.
1402    ///
1403    /// Parameter `inUserDataID`: the four char code of the chunk.
1404    ///
1405    /// Parameter `inIndex`: an index specifying which chunk if there are more than one.
1406    ///
1407    /// Parameter `outUserDataSize`: on output, if successful, the size of the user data chunk.
1408    ///
1409    /// Returns: returns noErr if successful.
1410    ///
1411    /// # Safety
1412    ///
1413    /// - `in_audio_file` must be a valid pointer.
1414    /// - `out_user_data_size` must be a valid pointer.
1415    pub fn AudioFileGetUserDataSize64(
1416        in_audio_file: AudioFileID,
1417        in_user_data_id: u32,
1418        in_index: u32,
1419        out_user_data_size: NonNull<u64>,
1420    ) -> OSStatus;
1421}
1422
1423extern "C-unwind" {
1424    /// Get the data of a chunk in a file.
1425    ///
1426    /// Parameter `inAudioFile`: an AudioFileID.
1427    ///
1428    /// Parameter `inUserDataID`: the four char code of the chunk.
1429    ///
1430    /// Parameter `inIndex`: an index specifying which chunk if there are more than one.
1431    ///
1432    /// Parameter `ioUserDataSize`: the size of the buffer on input, size of bytes copied to buffer on output
1433    ///
1434    /// Parameter `outUserData`: a pointer to a buffer in which to copy the chunk data.
1435    ///
1436    /// Returns: returns noErr if successful.
1437    ///
1438    /// # Safety
1439    ///
1440    /// - `in_audio_file` must be a valid pointer.
1441    /// - `io_user_data_size` must be a valid pointer.
1442    /// - `out_user_data` must be a valid pointer.
1443    pub fn AudioFileGetUserData(
1444        in_audio_file: AudioFileID,
1445        in_user_data_id: u32,
1446        in_index: u32,
1447        io_user_data_size: NonNull<u32>,
1448        out_user_data: NonNull<c_void>,
1449    ) -> OSStatus;
1450}
1451
1452extern "C-unwind" {
1453    /// Get a part of the data of a chunk in a file.
1454    ///
1455    /// Parameter `inAudioFile`: an AudioFileID.
1456    ///
1457    /// Parameter `inUserDataID`: the four char code of the chunk.
1458    ///
1459    /// Parameter `inIndex`: an index specifying which chunk if there are more than one.
1460    ///
1461    /// Parameter `inOffset`: offset from the first byte of the chunk to the first byte to get.
1462    ///
1463    /// Parameter `ioUserDataSize`: the size of the buffer on input, size of bytes copied to buffer on output
1464    ///
1465    /// Parameter `outUserData`: a pointer to a buffer in which to copy the chunk data.
1466    ///
1467    /// Returns: returns noErr if successful.
1468    ///
1469    /// # Safety
1470    ///
1471    /// - `in_audio_file` must be a valid pointer.
1472    /// - `io_user_data_size` must be a valid pointer.
1473    /// - `out_user_data` must be a valid pointer.
1474    pub fn AudioFileGetUserDataAtOffset(
1475        in_audio_file: AudioFileID,
1476        in_user_data_id: u32,
1477        in_index: u32,
1478        in_offset: i64,
1479        io_user_data_size: NonNull<u32>,
1480        out_user_data: NonNull<c_void>,
1481    ) -> OSStatus;
1482}
1483
1484extern "C-unwind" {
1485    /// Set the data of a chunk in a file.
1486    ///
1487    /// Parameter `inAudioFile`: an AudioFileID.
1488    ///
1489    /// Parameter `inUserDataID`: the four char code of the chunk.
1490    ///
1491    /// Parameter `inIndex`: an index specifying which chunk if there are more than one.
1492    ///
1493    /// Parameter `inUserDataSize`: on input the size of the data to copy, on output, size of bytes copied from the buffer
1494    ///
1495    /// Parameter `inUserData`: a pointer to a buffer from which to copy the chunk data
1496    /// (only the contents of the chunk, not including the chunk header).
1497    ///
1498    /// Returns: returns noErr if successful.
1499    ///
1500    /// # Safety
1501    ///
1502    /// - `in_audio_file` must be a valid pointer.
1503    /// - `in_user_data` must be a valid pointer.
1504    pub fn AudioFileSetUserData(
1505        in_audio_file: AudioFileID,
1506        in_user_data_id: u32,
1507        in_index: u32,
1508        in_user_data_size: u32,
1509        in_user_data: NonNull<c_void>,
1510    ) -> OSStatus;
1511}
1512
1513extern "C-unwind" {
1514    /// Remove a user chunk in a file.
1515    ///
1516    /// Parameter `inAudioFile`: an AudioFileID.
1517    ///
1518    /// Parameter `inUserDataID`: the four char code of the chunk.
1519    ///
1520    /// Parameter `inIndex`: an index specifying which chunk if there are more than one.
1521    ///
1522    /// Returns: returns noErr if successful.
1523    ///
1524    /// # Safety
1525    ///
1526    /// `in_audio_file` must be a valid pointer.
1527    pub fn AudioFileRemoveUserData(
1528        in_audio_file: AudioFileID,
1529        in_user_data_id: u32,
1530        in_index: u32,
1531    ) -> OSStatus;
1532}
1533
1534/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyfileformat?language=objc)
1535pub const kAudioFilePropertyFileFormat: AudioFilePropertyID = 0x66666d74;
1536/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertydataformat?language=objc)
1537pub const kAudioFilePropertyDataFormat: AudioFilePropertyID = 0x64666d74;
1538/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyisoptimized?language=objc)
1539pub const kAudioFilePropertyIsOptimized: AudioFilePropertyID = 0x6f70746d;
1540/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertymagiccookiedata?language=objc)
1541pub const kAudioFilePropertyMagicCookieData: AudioFilePropertyID = 0x6d676963;
1542/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyaudiodatabytecount?language=objc)
1543pub const kAudioFilePropertyAudioDataByteCount: AudioFilePropertyID = 0x62636e74;
1544/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyaudiodatapacketcount?language=objc)
1545pub const kAudioFilePropertyAudioDataPacketCount: AudioFilePropertyID = 0x70636e74;
1546/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertymaximumpacketsize?language=objc)
1547pub const kAudioFilePropertyMaximumPacketSize: AudioFilePropertyID = 0x70737a65;
1548/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertydataoffset?language=objc)
1549pub const kAudioFilePropertyDataOffset: AudioFilePropertyID = 0x646f6666;
1550/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertychannellayout?language=objc)
1551pub const kAudioFilePropertyChannelLayout: AudioFilePropertyID = 0x636d6170;
1552/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertydefersizeupdates?language=objc)
1553pub const kAudioFilePropertyDeferSizeUpdates: AudioFilePropertyID = 0x64737a75;
1554/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertydataformatname?language=objc)
1555pub const kAudioFilePropertyDataFormatName: AudioFilePropertyID = 0x666e6d65;
1556/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertymarkerlist?language=objc)
1557pub const kAudioFilePropertyMarkerList: AudioFilePropertyID = 0x6d6b6c73;
1558/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyregionlist?language=objc)
1559pub const kAudioFilePropertyRegionList: AudioFilePropertyID = 0x72676c73;
1560/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypackettoframe?language=objc)
1561pub const kAudioFilePropertyPacketToFrame: AudioFilePropertyID = 0x706b6672;
1562/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyframetopacket?language=objc)
1563pub const kAudioFilePropertyFrameToPacket: AudioFilePropertyID = 0x6672706b;
1564/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyrestrictsrandomaccess?language=objc)
1565pub const kAudioFilePropertyRestrictsRandomAccess: AudioFilePropertyID = 0x72726170;
1566/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypackettorolldistance?language=objc)
1567pub const kAudioFilePropertyPacketToRollDistance: AudioFilePropertyID = 0x706b726c;
1568/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypreviousindependentpacket?language=objc)
1569pub const kAudioFilePropertyPreviousIndependentPacket: AudioFilePropertyID = 0x70696e64;
1570/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertynextindependentpacket?language=objc)
1571pub const kAudioFilePropertyNextIndependentPacket: AudioFilePropertyID = 0x6e696e64;
1572/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypackettodependencyinfo?language=objc)
1573pub const kAudioFilePropertyPacketToDependencyInfo: AudioFilePropertyID = 0x706b6470;
1574/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypackettobyte?language=objc)
1575pub const kAudioFilePropertyPacketToByte: AudioFilePropertyID = 0x706b6279;
1576/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertybytetopacket?language=objc)
1577pub const kAudioFilePropertyByteToPacket: AudioFilePropertyID = 0x6279706b;
1578/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertychunkids?language=objc)
1579pub const kAudioFilePropertyChunkIDs: AudioFilePropertyID = 0x63686964;
1580/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyinfodictionary?language=objc)
1581pub const kAudioFilePropertyInfoDictionary: AudioFilePropertyID = 0x696e666f;
1582/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypackettableinfo?language=objc)
1583pub const kAudioFilePropertyPacketTableInfo: AudioFilePropertyID = 0x706e666f;
1584/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyformatlist?language=objc)
1585pub const kAudioFilePropertyFormatList: AudioFilePropertyID = 0x666c7374;
1586/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypacketsizeupperbound?language=objc)
1587pub const kAudioFilePropertyPacketSizeUpperBound: AudioFilePropertyID = 0x706b7562;
1588/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertypacketrangebytecountupperbound?language=objc)
1589pub const kAudioFilePropertyPacketRangeByteCountUpperBound: AudioFilePropertyID = 0x70727562;
1590/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyreserveduration?language=objc)
1591pub const kAudioFilePropertyReserveDuration: AudioFilePropertyID = 0x72737276;
1592/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyestimatedduration?language=objc)
1593pub const kAudioFilePropertyEstimatedDuration: AudioFilePropertyID = 0x65647572;
1594/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertybitrate?language=objc)
1595pub const kAudioFilePropertyBitRate: AudioFilePropertyID = 0x62726174;
1596/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyid3tag?language=objc)
1597pub const kAudioFilePropertyID3Tag: AudioFilePropertyID = 0x69643374;
1598/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyid3tagoffset?language=objc)
1599pub const kAudioFilePropertyID3TagOffset: AudioFilePropertyID = 0x6964336f;
1600/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertysourcebitdepth?language=objc)
1601pub const kAudioFilePropertySourceBitDepth: AudioFilePropertyID = 0x73627464;
1602/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyalbumartwork?language=objc)
1603pub const kAudioFilePropertyAlbumArtwork: AudioFilePropertyID = 0x61617274;
1604/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyaudiotrackcount?language=objc)
1605pub const kAudioFilePropertyAudioTrackCount: AudioFilePropertyID = 0x61746374;
1606/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofilepropertyuseaudiotrack?language=objc)
1607pub const kAudioFilePropertyUseAudioTrack: AudioFilePropertyID = 0x7561746b;
1608
1609extern "C-unwind" {
1610    /// Get information about the size of a property of an AudioFile  and whether it can be set.
1611    ///
1612    /// Parameter `inAudioFile`: an AudioFileID.
1613    ///
1614    /// Parameter `inPropertyID`: an AudioFileProperty constant.
1615    ///
1616    /// Parameter `outDataSize`: the size in bytes of the current value of the property. In order to get the property value,
1617    /// you will need a buffer of this size.
1618    ///
1619    /// Parameter `isWritable`: will be set to 1 if writable, or 0 if read only.
1620    ///
1621    /// Returns: returns noErr if successful.
1622    ///
1623    /// # Safety
1624    ///
1625    /// - `in_audio_file` must be a valid pointer.
1626    /// - `out_data_size` must be a valid pointer or null.
1627    /// - `is_writable` must be a valid pointer or null.
1628    pub fn AudioFileGetPropertyInfo(
1629        in_audio_file: AudioFileID,
1630        in_property_id: AudioFilePropertyID,
1631        out_data_size: *mut u32,
1632        is_writable: *mut u32,
1633    ) -> OSStatus;
1634}
1635
1636extern "C-unwind" {
1637    /// Copies the value for a property of an AudioFile into a buffer.
1638    ///
1639    /// Parameter `inAudioFile`: an AudioFileID.
1640    ///
1641    /// Parameter `inPropertyID`: an AudioFileProperty constant.
1642    ///
1643    /// Parameter `ioDataSize`: on input the size of the outPropertyData buffer. On output the number of bytes written to the buffer.
1644    ///
1645    /// Parameter `outPropertyData`: the buffer in which to write the property data.
1646    ///
1647    /// Returns: returns noErr if successful.
1648    ///
1649    /// # Safety
1650    ///
1651    /// - `in_audio_file` must be a valid pointer.
1652    /// - `io_data_size` must be a valid pointer.
1653    /// - `out_property_data` must be a valid pointer.
1654    pub fn AudioFileGetProperty(
1655        in_audio_file: AudioFileID,
1656        in_property_id: AudioFilePropertyID,
1657        io_data_size: NonNull<u32>,
1658        out_property_data: NonNull<c_void>,
1659    ) -> OSStatus;
1660}
1661
1662extern "C-unwind" {
1663    /// Sets the value for a property of an AudioFile .
1664    ///
1665    /// Parameter `inAudioFile`: an AudioFileID.
1666    ///
1667    /// Parameter `inPropertyID`: an AudioFileProperty constant.
1668    ///
1669    /// Parameter `inDataSize`: the size of the property data.
1670    ///
1671    /// Parameter `inPropertyData`: the buffer containing the property data.
1672    ///
1673    /// Returns: returns noErr if successful.
1674    ///
1675    /// # Safety
1676    ///
1677    /// - `in_audio_file` must be a valid pointer.
1678    /// - `in_property_data` must be a valid pointer.
1679    pub fn AudioFileSetProperty(
1680        in_audio_file: AudioFileID,
1681        in_property_id: AudioFilePropertyID,
1682        in_data_size: u32,
1683        in_property_data: NonNull<c_void>,
1684    ) -> OSStatus;
1685}
1686
1687/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_readabletypes?language=objc)
1688pub const kAudioFileGlobalInfo_ReadableTypes: AudioFilePropertyID = 0x61667266;
1689/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_writabletypes?language=objc)
1690pub const kAudioFileGlobalInfo_WritableTypes: AudioFilePropertyID = 0x61667766;
1691/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_filetypename?language=objc)
1692pub const kAudioFileGlobalInfo_FileTypeName: AudioFilePropertyID = 0x66746e6d;
1693/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_availablestreamdescriptionsforformat?language=objc)
1694pub const kAudioFileGlobalInfo_AvailableStreamDescriptionsForFormat: AudioFilePropertyID =
1695    0x73646964;
1696/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_availableformatids?language=objc)
1697pub const kAudioFileGlobalInfo_AvailableFormatIDs: AudioFilePropertyID = 0x666d6964;
1698/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_allextensions?language=objc)
1699pub const kAudioFileGlobalInfo_AllExtensions: AudioFilePropertyID = 0x616c7874;
1700/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_allhfstypecodes?language=objc)
1701pub const kAudioFileGlobalInfo_AllHFSTypeCodes: AudioFilePropertyID = 0x61686673;
1702/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_allutis?language=objc)
1703pub const kAudioFileGlobalInfo_AllUTIs: AudioFilePropertyID = 0x61757469;
1704/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_allmimetypes?language=objc)
1705pub const kAudioFileGlobalInfo_AllMIMETypes: AudioFilePropertyID = 0x616d696d;
1706/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_extensionsfortype?language=objc)
1707pub const kAudioFileGlobalInfo_ExtensionsForType: AudioFilePropertyID = 0x66657874;
1708/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_hfstypecodesfortype?language=objc)
1709pub const kAudioFileGlobalInfo_HFSTypeCodesForType: AudioFilePropertyID = 0x66686673;
1710/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_utisfortype?language=objc)
1711pub const kAudioFileGlobalInfo_UTIsForType: AudioFilePropertyID = 0x66757469;
1712/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_mimetypesfortype?language=objc)
1713pub const kAudioFileGlobalInfo_MIMETypesForType: AudioFilePropertyID = 0x666d696d;
1714/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_typesformimetype?language=objc)
1715pub const kAudioFileGlobalInfo_TypesForMIMEType: AudioFilePropertyID = 0x746d696d;
1716/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_typesforuti?language=objc)
1717pub const kAudioFileGlobalInfo_TypesForUTI: AudioFilePropertyID = 0x74757469;
1718/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_typesforhfstypecode?language=objc)
1719pub const kAudioFileGlobalInfo_TypesForHFSTypeCode: AudioFilePropertyID = 0x74686673;
1720/// [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/kaudiofileglobalinfo_typesforextension?language=objc)
1721pub const kAudioFileGlobalInfo_TypesForExtension: AudioFilePropertyID = 0x74657874;
1722
1723/// This is used as a specifier for kAudioFileGlobalInfo_AvailableStreamDescriptions
1724///
1725/// This struct is used to specify a desired audio file type and data format ID  so
1726/// that a list of stream descriptions of available formats can be obtained.
1727///
1728/// a four char code for the file type such as kAudioFileAIFFType, kAudioFileCAFType, etc.
1729///
1730/// a four char code for the format ID such as kAudioFormatLinearPCM, kAudioFormatMPEG4AAC, etc.
1731///
1732/// See also [Apple's documentation](https://developer.apple.com/documentation/audiotoolbox/audiofiletypeandformatid?language=objc)
1733#[repr(C)]
1734#[derive(Clone, Copy, Debug, PartialEq)]
1735pub struct AudioFileTypeAndFormatID {
1736    pub mFileType: AudioFileTypeID,
1737    pub mFormatID: u32,
1738}
1739
1740unsafe impl Encode for AudioFileTypeAndFormatID {
1741    const ENCODING: Encoding = Encoding::Struct(
1742        "AudioFileTypeAndFormatID",
1743        &[<AudioFileTypeID>::ENCODING, <u32>::ENCODING],
1744    );
1745}
1746
1747unsafe impl RefEncode for AudioFileTypeAndFormatID {
1748    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1749}
1750
1751extern "C-unwind" {
1752    /// Get the size of a global property.
1753    ///
1754    /// Parameter `inPropertyID`: an AudioFileGlobalInfo property constant.
1755    ///
1756    /// Parameter `inSpecifierSize`: The size of the specifier data.
1757    ///
1758    /// Parameter `inSpecifier`: A specifier is a buffer of data used as an input argument to some of the global info properties.
1759    ///
1760    /// Parameter `outDataSize`: the size in bytes of the current value of the property. In order to get the property value,
1761    /// you will need a buffer of this size.
1762    ///
1763    /// Returns: returns noErr if successful.
1764    ///
1765    /// # Safety
1766    ///
1767    /// - `in_specifier` must be a valid pointer or null.
1768    /// - `out_data_size` must be a valid pointer.
1769    pub fn AudioFileGetGlobalInfoSize(
1770        in_property_id: AudioFilePropertyID,
1771        in_specifier_size: u32,
1772        in_specifier: *mut c_void,
1773        out_data_size: NonNull<u32>,
1774    ) -> OSStatus;
1775}
1776
1777extern "C-unwind" {
1778    /// Copies the value for a global property into a buffer.
1779    ///
1780    /// Parameter `inPropertyID`: an AudioFileGlobalInfo property constant.
1781    ///
1782    /// Parameter `inSpecifierSize`: The size of the specifier data.
1783    ///
1784    /// Parameter `inSpecifier`: A specifier is a buffer of data used as an input argument to some of the global info properties.
1785    ///
1786    /// Parameter `ioDataSize`: on input the size of the outPropertyData buffer. On output the number of bytes written to the buffer.
1787    ///
1788    /// Parameter `outPropertyData`: the buffer in which to write the property data.
1789    ///
1790    /// Returns: returns noErr if successful.
1791    ///
1792    /// # Safety
1793    ///
1794    /// - `in_specifier` must be a valid pointer or null.
1795    /// - `io_data_size` must be a valid pointer.
1796    /// - `out_property_data` must be a valid pointer.
1797    pub fn AudioFileGetGlobalInfo(
1798        in_property_id: AudioFilePropertyID,
1799        in_specifier_size: u32,
1800        in_specifier: *mut c_void,
1801        io_data_size: NonNull<u32>,
1802        out_property_data: NonNull<c_void>,
1803    ) -> OSStatus;
1804}