1use objc2::__framework_prelude::*;
4
5use crate::*;
6
7pub const kCAF_FileType: u32 = 0x63616666;
9pub const kCAF_FileVersion_Initial: u32 = 1;
11
12pub const kCAF_StreamDescriptionChunkID: u32 = 0x64657363;
14pub const kCAF_AudioDataChunkID: u32 = 0x64617461;
16pub const kCAF_ChannelLayoutChunkID: u32 = 0x6368616e;
18pub const kCAF_FillerChunkID: u32 = 0x66726565;
20pub const kCAF_MarkerChunkID: u32 = 0x6d61726b;
22pub const kCAF_RegionChunkID: u32 = 0x7265676e;
24pub const kCAF_InstrumentChunkID: u32 = 0x696e7374;
26pub const kCAF_MagicCookieID: u32 = 0x6b756b69;
28pub const kCAF_InfoStringsChunkID: u32 = 0x696e666f;
30pub const kCAF_EditCommentsChunkID: u32 = 0x65646374;
32pub const kCAF_PacketTableChunkID: u32 = 0x70616b74;
34pub const kCAF_StringsChunkID: u32 = 0x73747267;
36pub const kCAF_UUIDChunkID: u32 = 0x75756964;
38pub const kCAF_PeakChunkID: u32 = 0x7065616b;
40pub const kCAF_OverviewChunkID: u32 = 0x6f767677;
42pub const kCAF_MIDIChunkID: u32 = 0x6d696469;
44pub const kCAF_UMIDChunkID: u32 = 0x756d6964;
46pub const kCAF_FormatListID: u32 = 0x6c647363;
48pub const kCAF_iXMLChunkID: u32 = 0x69584d4c;
50
51#[repr(C, packed)]
53#[derive(Clone, Copy, Debug, PartialEq)]
54pub struct CAFFileHeader {
55 pub mFileType: u32,
56 pub mFileVersion: u16,
57 pub mFileFlags: u16,
58}
59
60unsafe impl Encode for CAFFileHeader {
61 const ENCODING: Encoding = Encoding::Struct(
62 "CAFFileHeader",
63 &[<u32>::ENCODING, <u16>::ENCODING, <u16>::ENCODING],
64 );
65}
66
67unsafe impl RefEncode for CAFFileHeader {
68 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
69}
70
71#[repr(C, packed)]
73#[derive(Clone, Copy, Debug, PartialEq)]
74pub struct CAFChunkHeader {
75 pub mChunkType: u32,
76 pub mChunkSize: i64,
77}
78
79unsafe impl Encode for CAFChunkHeader {
80 const ENCODING: Encoding =
81 Encoding::Struct("CAFChunkHeader", &[<u32>::ENCODING, <i64>::ENCODING]);
82}
83
84unsafe impl RefEncode for CAFChunkHeader {
85 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
86}
87
88#[repr(C)]
90#[derive(Clone, Copy, Debug, PartialEq)]
91pub struct CAF_UUID_ChunkHeader {
92 pub mHeader: CAFChunkHeader,
93 pub mUUID: [u8; 16],
94}
95
96unsafe impl Encode for CAF_UUID_ChunkHeader {
97 const ENCODING: Encoding = Encoding::Struct(
98 "CAF_UUID_ChunkHeader",
99 &[<CAFChunkHeader>::ENCODING, <[u8; 16]>::ENCODING],
100 );
101}
102
103unsafe impl RefEncode for CAF_UUID_ChunkHeader {
104 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
105}
106
107#[repr(transparent)]
110#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
111pub struct CAFFormatFlags(pub u32);
112bitflags::bitflags! {
113 impl CAFFormatFlags: u32 {
114 #[doc(alias = "kCAFLinearPCMFormatFlagIsFloat")]
115 const LinearPCMFormatFlagIsFloat = 1<<0;
116 #[doc(alias = "kCAFLinearPCMFormatFlagIsLittleEndian")]
117 const LinearPCMFormatFlagIsLittleEndian = 1<<1;
118 }
119}
120
121unsafe impl Encode for CAFFormatFlags {
122 const ENCODING: Encoding = u32::ENCODING;
123}
124
125unsafe impl RefEncode for CAFFormatFlags {
126 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
127}
128
129#[repr(C, packed)]
131#[derive(Clone, Copy, Debug, PartialEq)]
132pub struct CAFAudioDescription {
133 pub mSampleRate: f64,
134 pub mFormatID: u32,
135 pub mFormatFlags: CAFFormatFlags,
136 pub mBytesPerPacket: u32,
137 pub mFramesPerPacket: u32,
138 pub mChannelsPerFrame: u32,
139 pub mBitsPerChannel: u32,
140}
141
142unsafe impl Encode for CAFAudioDescription {
143 const ENCODING: Encoding = Encoding::Struct(
144 "CAFAudioDescription",
145 &[
146 <f64>::ENCODING,
147 <u32>::ENCODING,
148 <CAFFormatFlags>::ENCODING,
149 <u32>::ENCODING,
150 <u32>::ENCODING,
151 <u32>::ENCODING,
152 <u32>::ENCODING,
153 ],
154 );
155}
156
157unsafe impl RefEncode for CAFAudioDescription {
158 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
159}
160
161#[repr(C, packed)]
163#[derive(Clone, Copy, Debug, PartialEq)]
164pub struct CAFAudioFormatListItem {
165 pub mFormat: CAFAudioDescription,
166 pub mChannelLayoutTag: u32,
167}
168
169unsafe impl Encode for CAFAudioFormatListItem {
170 const ENCODING: Encoding = Encoding::Struct(
171 "CAFAudioFormatListItem",
172 &[<CAFAudioDescription>::ENCODING, <u32>::ENCODING],
173 );
174}
175
176unsafe impl RefEncode for CAFAudioFormatListItem {
177 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
178}
179
180#[repr(C, packed)]
182#[derive(Clone, Copy, Debug, PartialEq)]
183pub struct CAFPacketTableHeader {
184 pub mNumberPackets: i64,
185 pub mNumberValidFrames: i64,
186 pub mPrimingFrames: i32,
187 pub mRemainderFrames: i32,
188 pub mPacketDescriptions: [u8; 1],
189}
190
191unsafe impl Encode for CAFPacketTableHeader {
192 const ENCODING: Encoding = Encoding::Struct(
193 "CAFPacketTableHeader",
194 &[
195 <i64>::ENCODING,
196 <i64>::ENCODING,
197 <i32>::ENCODING,
198 <i32>::ENCODING,
199 <[u8; 1]>::ENCODING,
200 ],
201 );
202}
203
204unsafe impl RefEncode for CAFPacketTableHeader {
205 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
206}
207
208#[repr(C, packed)]
210#[derive(Clone, Copy, Debug, PartialEq)]
211pub struct CAFDataChunk {
212 pub mEditCount: u32,
213 pub mData: [u8; 1],
214}
215
216unsafe impl Encode for CAFDataChunk {
217 const ENCODING: Encoding =
218 Encoding::Struct("CAFDataChunk", &[<u32>::ENCODING, <[u8; 1]>::ENCODING]);
219}
220
221unsafe impl RefEncode for CAFDataChunk {
222 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
223}
224
225pub const kCAFMarkerType_Generic: u32 = 0;
227pub const kCAFMarkerType_ProgramStart: u32 = 0x70626567;
229pub const kCAFMarkerType_ProgramEnd: u32 = 0x70656e64;
231pub const kCAFMarkerType_TrackStart: u32 = 0x74626567;
233pub const kCAFMarkerType_TrackEnd: u32 = 0x74656e64;
235pub const kCAFMarkerType_Index: u32 = 0x696e6478;
237pub const kCAFMarkerType_RegionStart: u32 = 0x72626567;
239pub const kCAFMarkerType_RegionEnd: u32 = 0x72656e64;
241pub const kCAFMarkerType_RegionSyncPoint: u32 = 0x72737963;
243pub const kCAFMarkerType_SelectionStart: u32 = 0x73626567;
245pub const kCAFMarkerType_SelectionEnd: u32 = 0x73656e64;
247pub const kCAFMarkerType_EditSourceBegin: u32 = 0x63626567;
249pub const kCAFMarkerType_EditSourceEnd: u32 = 0x63656e64;
251pub const kCAFMarkerType_EditDestinationBegin: u32 = 0x64626567;
253pub const kCAFMarkerType_EditDestinationEnd: u32 = 0x64656e64;
255pub const kCAFMarkerType_SustainLoopStart: u32 = 0x736c6267;
257pub const kCAFMarkerType_SustainLoopEnd: u32 = 0x736c656e;
259pub const kCAFMarkerType_ReleaseLoopStart: u32 = 0x726c6267;
261pub const kCAFMarkerType_ReleaseLoopEnd: u32 = 0x726c656e;
263pub const kCAFMarkerType_SavedPlayPosition: u32 = 0x73706c79;
265pub const kCAFMarkerType_Tempo: u32 = 0x746d706f;
267pub const kCAFMarkerType_TimeSignature: u32 = 0x74736967;
269pub const kCAFMarkerType_KeySignature: u32 = 0x6b736967;
271
272pub const kCAF_SMPTE_TimeTypeNone: u32 = 0;
274pub const kCAF_SMPTE_TimeType24: u32 = 1;
276pub const kCAF_SMPTE_TimeType25: u32 = 2;
278pub const kCAF_SMPTE_TimeType30Drop: u32 = 3;
280pub const kCAF_SMPTE_TimeType30: u32 = 4;
282pub const kCAF_SMPTE_TimeType2997: u32 = 5;
284pub const kCAF_SMPTE_TimeType2997Drop: u32 = 6;
286pub const kCAF_SMPTE_TimeType60: u32 = 7;
288pub const kCAF_SMPTE_TimeType5994: u32 = 8;
290pub const kCAF_SMPTE_TimeType60Drop: u32 = 9;
292pub const kCAF_SMPTE_TimeType5994Drop: u32 = 10;
294pub const kCAF_SMPTE_TimeType50: u32 = 11;
296pub const kCAF_SMPTE_TimeType2398: u32 = 12;
298
299#[repr(C, packed)]
301#[derive(Clone, Copy, Debug, PartialEq)]
302pub struct CAF_SMPTE_Time {
303 pub mHours: i8,
304 pub mMinutes: i8,
305 pub mSeconds: i8,
306 pub mFrames: i8,
307 pub mSubFrameSampleOffset: u32,
308}
309
310unsafe impl Encode for CAF_SMPTE_Time {
311 const ENCODING: Encoding = Encoding::Struct(
312 "CAF_SMPTE_Time",
313 &[
314 <i8>::ENCODING,
315 <i8>::ENCODING,
316 <i8>::ENCODING,
317 <i8>::ENCODING,
318 <u32>::ENCODING,
319 ],
320 );
321}
322
323unsafe impl RefEncode for CAF_SMPTE_Time {
324 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
325}
326
327#[repr(C, packed)]
329#[derive(Clone, Copy, Debug, PartialEq)]
330pub struct CAFMarker {
331 pub mType: u32,
332 pub mFramePosition: f64,
333 pub mMarkerID: u32,
334 pub mSMPTETime: CAF_SMPTE_Time,
335 pub mChannel: u32,
336}
337
338unsafe impl Encode for CAFMarker {
339 const ENCODING: Encoding = Encoding::Struct(
340 "CAFMarker",
341 &[
342 <u32>::ENCODING,
343 <f64>::ENCODING,
344 <u32>::ENCODING,
345 <CAF_SMPTE_Time>::ENCODING,
346 <u32>::ENCODING,
347 ],
348 );
349}
350
351unsafe impl RefEncode for CAFMarker {
352 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
353}
354
355#[repr(C, packed)]
357#[derive(Clone, Copy, Debug, PartialEq)]
358pub struct CAFMarkerChunk {
359 pub mSMPTE_TimeType: u32,
360 pub mNumberMarkers: u32,
361 pub mMarkers: [CAFMarker; 1],
362}
363
364unsafe impl Encode for CAFMarkerChunk {
365 const ENCODING: Encoding = Encoding::Struct(
366 "CAFMarkerChunk",
367 &[<u32>::ENCODING, <u32>::ENCODING, <[CAFMarker; 1]>::ENCODING],
368 );
369}
370
371unsafe impl RefEncode for CAFMarkerChunk {
372 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
373}
374
375#[repr(transparent)]
378#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
379pub struct CAFRegionFlags(pub u32);
380bitflags::bitflags! {
381 impl CAFRegionFlags: u32 {
382 #[doc(alias = "kCAFRegionFlag_LoopEnable")]
383 const LoopEnable = 1;
384 #[doc(alias = "kCAFRegionFlag_PlayForward")]
385 const PlayForward = 2;
386 #[doc(alias = "kCAFRegionFlag_PlayBackward")]
387 const PlayBackward = 4;
388 }
389}
390
391unsafe impl Encode for CAFRegionFlags {
392 const ENCODING: Encoding = u32::ENCODING;
393}
394
395unsafe impl RefEncode for CAFRegionFlags {
396 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
397}
398
399#[repr(C, packed)]
401#[derive(Clone, Copy, Debug, PartialEq)]
402pub struct CAFRegion {
403 pub mRegionID: u32,
404 pub mFlags: CAFRegionFlags,
405 pub mNumberMarkers: u32,
406 pub mMarkers: [CAFMarker; 1],
407}
408
409unsafe impl Encode for CAFRegion {
410 const ENCODING: Encoding = Encoding::Struct(
411 "CAFRegion",
412 &[
413 <u32>::ENCODING,
414 <CAFRegionFlags>::ENCODING,
415 <u32>::ENCODING,
416 <[CAFMarker; 1]>::ENCODING,
417 ],
418 );
419}
420
421unsafe impl RefEncode for CAFRegion {
422 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
423}
424
425#[repr(C, packed)]
427#[derive(Clone, Copy, Debug, PartialEq)]
428pub struct CAFRegionChunk {
429 pub mSMPTE_TimeType: u32,
430 pub mNumberRegions: u32,
431 pub mRegions: [CAFRegion; 1],
432}
433
434unsafe impl Encode for CAFRegionChunk {
435 const ENCODING: Encoding = Encoding::Struct(
436 "CAFRegionChunk",
437 &[<u32>::ENCODING, <u32>::ENCODING, <[CAFRegion; 1]>::ENCODING],
438 );
439}
440
441unsafe impl RefEncode for CAFRegionChunk {
442 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
443}
444
445#[repr(C, packed)]
447#[derive(Clone, Copy, Debug, PartialEq)]
448pub struct CAFInstrumentChunk {
449 pub mBaseNote: f32,
450 pub mMIDILowNote: u8,
451 pub mMIDIHighNote: u8,
452 pub mMIDILowVelocity: u8,
453 pub mMIDIHighVelocity: u8,
454 pub mdBGain: f32,
455 pub mStartRegionID: u32,
456 pub mSustainRegionID: u32,
457 pub mReleaseRegionID: u32,
458 pub mInstrumentID: u32,
459}
460
461unsafe impl Encode for CAFInstrumentChunk {
462 const ENCODING: Encoding = Encoding::Struct(
463 "CAFInstrumentChunk",
464 &[
465 <f32>::ENCODING,
466 <u8>::ENCODING,
467 <u8>::ENCODING,
468 <u8>::ENCODING,
469 <u8>::ENCODING,
470 <f32>::ENCODING,
471 <u32>::ENCODING,
472 <u32>::ENCODING,
473 <u32>::ENCODING,
474 <u32>::ENCODING,
475 ],
476 );
477}
478
479unsafe impl RefEncode for CAFInstrumentChunk {
480 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
481}
482
483#[repr(C, packed)]
485#[derive(Clone, Copy, Debug, PartialEq)]
486pub struct CAFStringID {
487 pub mStringID: u32,
488 pub mStringStartByteOffset: i64,
489}
490
491unsafe impl Encode for CAFStringID {
492 const ENCODING: Encoding = Encoding::Struct("CAFStringID", &[<u32>::ENCODING, <i64>::ENCODING]);
493}
494
495unsafe impl RefEncode for CAFStringID {
496 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
497}
498
499#[repr(C, packed)]
501#[derive(Clone, Copy, Debug, PartialEq)]
502pub struct CAFStrings {
503 pub mNumEntries: u32,
504 pub mStringsIDs: [CAFStringID; 1],
505}
506
507unsafe impl Encode for CAFStrings {
508 const ENCODING: Encoding = Encoding::Struct(
509 "CAFStrings",
510 &[<u32>::ENCODING, <[CAFStringID; 1]>::ENCODING],
511 );
512}
513
514unsafe impl RefEncode for CAFStrings {
515 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
516}
517
518#[repr(C, packed)]
520#[derive(Clone, Copy, Debug, PartialEq)]
521pub struct CAFInfoStrings {
522 pub mNumEntries: u32,
523}
524
525unsafe impl Encode for CAFInfoStrings {
526 const ENCODING: Encoding = Encoding::Struct("CAFInfoStrings", &[<u32>::ENCODING]);
527}
528
529unsafe impl RefEncode for CAFInfoStrings {
530 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
531}
532
533#[repr(C, packed)]
535#[derive(Clone, Copy, Debug, PartialEq)]
536pub struct CAFPositionPeak {
537 pub mValue: f32,
538 pub mFrameNumber: u64,
539}
540
541unsafe impl Encode for CAFPositionPeak {
542 const ENCODING: Encoding =
543 Encoding::Struct("CAFPositionPeak", &[<f32>::ENCODING, <u64>::ENCODING]);
544}
545
546unsafe impl RefEncode for CAFPositionPeak {
547 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
548}
549
550#[repr(C, packed)]
552#[derive(Clone, Copy, Debug, PartialEq)]
553pub struct CAFPeakChunk {
554 pub mEditCount: u32,
555 pub mPeaks: [CAFPositionPeak; 1],
556}
557
558unsafe impl Encode for CAFPeakChunk {
559 const ENCODING: Encoding = Encoding::Struct(
560 "CAFPeakChunk",
561 &[<u32>::ENCODING, <[CAFPositionPeak; 1]>::ENCODING],
562 );
563}
564
565unsafe impl RefEncode for CAFPeakChunk {
566 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
567}
568
569#[repr(C, packed)]
571#[derive(Clone, Copy, Debug, PartialEq)]
572pub struct CAFOverviewSample {
573 pub mMinValue: i16,
574 pub mMaxValue: i16,
575}
576
577unsafe impl Encode for CAFOverviewSample {
578 const ENCODING: Encoding =
579 Encoding::Struct("CAFOverviewSample", &[<i16>::ENCODING, <i16>::ENCODING]);
580}
581
582unsafe impl RefEncode for CAFOverviewSample {
583 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
584}
585
586#[repr(C, packed)]
588#[derive(Clone, Copy, Debug, PartialEq)]
589pub struct CAFOverviewChunk {
590 pub mEditCount: u32,
591 pub mNumFramesPerOVWSample: u32,
592 pub mData: [CAFOverviewSample; 1],
593}
594
595unsafe impl Encode for CAFOverviewChunk {
596 const ENCODING: Encoding = Encoding::Struct(
597 "CAFOverviewChunk",
598 &[
599 <u32>::ENCODING,
600 <u32>::ENCODING,
601 <[CAFOverviewSample; 1]>::ENCODING,
602 ],
603 );
604}
605
606unsafe impl RefEncode for CAFOverviewChunk {
607 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
608}
609
610#[repr(C)]
612#[derive(Clone, Copy, Debug, PartialEq)]
613pub struct CAFUMIDChunk {
614 pub mBytes: [u8; 64],
615}
616
617unsafe impl Encode for CAFUMIDChunk {
618 const ENCODING: Encoding = Encoding::Struct("CAFUMIDChunk", &[<[u8; 64]>::ENCODING]);
619}
620
621unsafe impl RefEncode for CAFUMIDChunk {
622 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
623}