this repo has no description
1#ifndef _AUDIO_FILE_COMPONENT_H
2#define _AUDIO_FILE_COMPONENT_H
3
4#include <AudioToolbox/AudioFile.h>
5#include <AudioToolbox/AudioComponent.h>
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11typedef AudioComponentInstance AudioFileComponent;
12
13
14
15
16typedef UInt32 AudioFileComponentPropertyID;
17extern OSStatus
18AudioFileComponentCreateURL (
19 AudioFileComponent inComponent,
20 CFURLRef inFileRef,
21 const AudioStreamBasicDescription *inFormat,
22 UInt32 inFlags);
23extern OSStatus
24AudioFileComponentOpenURL (
25 AudioFileComponent inComponent,
26 CFURLRef inFileRef,
27 SInt8 inPermissions,
28 int inFileDescriptor);
29extern OSStatus
30AudioFileComponentOpenWithCallbacks(
31 AudioFileComponent inComponent,
32 void *inClientData,
33 AudioFile_ReadProc inReadFunc,
34 AudioFile_WriteProc inWriteFunc,
35 AudioFile_GetSizeProc inGetSizeFunc,
36 AudioFile_SetSizeProc inSetSizeFunc);
37extern OSStatus
38AudioFileComponentInitializeWithCallbacks(
39 AudioFileComponent inComponent,
40 void *inClientData,
41 AudioFile_ReadProc inReadFunc,
42 AudioFile_WriteProc inWriteFunc,
43 AudioFile_GetSizeProc inGetSizeFunc,
44 AudioFile_SetSizeProc inSetSizeFunc,
45 UInt32 inFileType,
46 const AudioStreamBasicDescription *inFormat,
47 UInt32 inFlags);
48extern OSStatus
49AudioFileComponentCloseFile(
50 AudioFileComponent inComponent);
51
52
53
54
55
56
57
58extern OSStatus
59AudioFileComponentOptimize(
60 AudioFileComponent inComponent);
61extern OSStatus
62AudioFileComponentReadBytes(
63 AudioFileComponent inComponent,
64 Boolean inUseCache,
65 SInt64 inStartingByte,
66 UInt32 *ioNumBytes,
67 void *outBuffer);
68extern OSStatus
69AudioFileComponentWriteBytes(
70 AudioFileComponent inComponent,
71 Boolean inUseCache,
72 SInt64 inStartingByte,
73 UInt32 *ioNumBytes,
74 const void *inBuffer);
75extern OSStatus
76AudioFileComponentReadPackets(
77 AudioFileComponent inComponent,
78 Boolean inUseCache,
79 UInt32 *outNumBytes,
80 AudioStreamPacketDescription * _Nullable outPacketDescriptions,
81 SInt64 inStartingPacket,
82 UInt32 *ioNumPackets,
83 void *outBuffer);
84extern OSStatus
85AudioFileComponentReadPacketData(
86 AudioFileComponent inComponent,
87 Boolean inUseCache,
88 UInt32 *ioNumBytes,
89 AudioStreamPacketDescription * _Nullable outPacketDescriptions,
90 SInt64 inStartingPacket,
91 UInt32 *ioNumPackets,
92 void *outBuffer);
93extern OSStatus
94AudioFileComponentWritePackets(
95 AudioFileComponent inComponent,
96 Boolean inUseCache,
97 UInt32 inNumBytes,
98 const AudioStreamPacketDescription * _Nullable inPacketDescriptions,
99 SInt64 inStartingPacket,
100 UInt32 *ioNumPackets,
101 const void *inBuffer);
102extern OSStatus
103AudioFileComponentGetPropertyInfo(
104 AudioFileComponent inComponent,
105 AudioFileComponentPropertyID inPropertyID,
106 UInt32 * _Nullable outPropertySize,
107 UInt32 * _Nullable outWritable);
108extern OSStatus
109AudioFileComponentGetProperty(
110 AudioFileComponent inComponent,
111 AudioFileComponentPropertyID inPropertyID,
112 UInt32 *ioPropertyDataSize,
113 void *outPropertyData);
114extern OSStatus
115AudioFileComponentSetProperty(
116 AudioFileComponent inComponent,
117 AudioFileComponentPropertyID inPropertyID,
118 UInt32 inPropertyDataSize,
119 const void *inPropertyData);
120extern OSStatus
121AudioFileComponentCountUserData(
122 AudioFileComponent inComponent,
123 UInt32 inUserDataID,
124 UInt32 *outNumberItems);
125extern OSStatus
126AudioFileComponentGetUserDataSize(
127 AudioFileComponent inComponent,
128 UInt32 inUserDataID,
129 UInt32 inIndex,
130 UInt32 *outUserDataSize);
131extern OSStatus
132AudioFileComponentGetUserData(
133 AudioFileComponent inComponent,
134 UInt32 inUserDataID,
135 UInt32 inIndex,
136 UInt32 *ioUserDataSize,
137 void *outUserData);
138extern OSStatus
139AudioFileComponentSetUserData(
140 AudioFileComponent inComponent,
141 UInt32 inUserDataID,
142 UInt32 inIndex,
143 UInt32 inUserDataSize,
144 const void *inUserData);
145extern OSStatus
146AudioFileComponentRemoveUserData(
147 AudioFileComponent inComponent,
148 UInt32 inUserDataID,
149 UInt32 inIndex);
150extern OSStatus
151AudioFileComponentExtensionIsThisFormat(
152 AudioFileComponent inComponent,
153 CFStringRef inExtension,
154 UInt32 *outResult);
155extern OSStatus
156AudioFileComponentFileDataIsThisFormat(
157 AudioFileComponent inComponent,
158 UInt32 inDataByteSize,
159 const void* inData,
160 UInt32 *outResult);
161extern OSStatus
162AudioFileComponentFileIsThisFormat(
163 AudioFileComponent inComponent,
164 SInt16 inFileRefNum,
165 UInt32 *outResult);
166extern OSStatus
167AudioFileComponentDataIsThisFormat(
168 AudioFileComponent inComponent,
169 void * _Nullable inClientData,
170 AudioFile_ReadProc _Nullable inReadFunc,
171 AudioFile_WriteProc _Nullable inWriteFunc,
172 AudioFile_GetSizeProc _Nullable inGetSizeFunc,
173 AudioFile_SetSizeProc _Nullable inSetSizeFunc,
174 UInt32 *outResult);
175extern OSStatus
176AudioFileComponentGetGlobalInfoSize(
177 AudioFileComponent inComponent,
178 AudioFileComponentPropertyID inPropertyID,
179 UInt32 inSpecifierSize,
180 const void * _Nullable inSpecifier,
181 UInt32 *outPropertySize);
182extern OSStatus
183AudioFileComponentGetGlobalInfo(
184 AudioFileComponent inComponent,
185 AudioFileComponentPropertyID inPropertyID,
186 UInt32 inSpecifierSize,
187 const void * _Nullable inSpecifier,
188 UInt32 *ioPropertyDataSize,
189 void *outPropertyData);
190enum
191{
192 kAudioFileComponent_CanRead = 'cnrd',
193 kAudioFileComponent_CanWrite = 'cnwr',
194 kAudioFileComponent_FileTypeName = 'ftnm',
195 kAudioFileComponent_UTIsForType = 'futi',
196 kAudioFileComponent_MIMETypesForType = 'fmim',
197 kAudioFileComponent_ExtensionsForType = 'fext',
198 kAudioFileComponent_AvailableFormatIDs = 'fmid',
199 kAudioFileComponent_AvailableStreamDescriptionsForFormat = 'sdid',
200 kAudioFileComponent_FastDispatchTable = 'fdft',
201 kAudioFileComponent_HFSTypeCodesForType = 'fhfs'
202};
203
204
205
206
207
208enum
209{
210 kAudioFileCreateSelect = 0x0001,
211 kAudioFileOpenSelect = 0x0002,
212 kAudioFileInitializeSelect = 0x0003,
213 kAudioFileOpenWithCallbacksSelect = 0x0004,
214 kAudioFileInitializeWithCallbacksSelect = 0x0005,
215 kAudioFileCloseSelect = 0x0006,
216 kAudioFileOptimizeSelect = 0x0007,
217 kAudioFileReadBytesSelect = 0x0008,
218 kAudioFileWriteBytesSelect = 0x0009,
219 kAudioFileReadPacketsSelect = 0x000A,
220 kAudioFileWritePacketsSelect = 0x000B,
221 kAudioFileGetPropertyInfoSelect = 0x000C,
222 kAudioFileGetPropertySelect = 0x000D,
223 kAudioFileSetPropertySelect = 0x000E,
224
225 kAudioFileExtensionIsThisFormatSelect = 0x000F,
226 kAudioFileFileIsThisFormatSelect = 0x0010,
227 kAudioFileDataIsThisFormatSelect = 0x0011,
228 kAudioFileGetGlobalInfoSizeSelect = 0x0012,
229 kAudioFileGetGlobalInfoSelect = 0x0013,
230
231 kAudioFileCountUserDataSelect = 0x0014,
232 kAudioFileGetUserDataSizeSelect = 0x0015,
233 kAudioFileGetUserDataSelect = 0x0016,
234 kAudioFileSetUserDataSelect = 0x0017,
235 kAudioFileRemoveUserDataSelect = 0x0018,
236 kAudioFileCreateURLSelect = 0x0019,
237 kAudioFileOpenURLSelect = 0x001A,
238 kAudioFileFileDataIsThisFormatSelect = 0x001B,
239 kAudioFileReadPacketDataSelect = 0x001C,
240};
241typedef OSStatus (*ReadBytesFDF)( void *inComponentStorage,
242 Boolean inUseCache,
243 SInt64 inStartingByte,
244 UInt32 *ioNumBytes,
245 void *outBuffer);
246
247typedef OSStatus (*WriteBytesFDF)( void *inComponentStorage,
248 Boolean inUseCache,
249 SInt64 inStartingByte,
250 UInt32 *ioNumBytes,
251 const void *inBuffer);
252
253typedef OSStatus (*ReadPacketsFDF)( void *inComponentStorage,
254 Boolean inUseCache,
255 UInt32 *outNumBytes,
256 AudioStreamPacketDescription * _Nullable outPacketDescriptions,
257 SInt64 inStartingPacket,
258 UInt32 *ioNumPackets,
259 void *outBuffer);
260
261typedef OSStatus (*ReadPacketDataFDF)( void *inComponentStorage,
262 Boolean inUseCache,
263 UInt32 *ioNumBytes,
264 AudioStreamPacketDescription * _Nullable outPacketDescriptions,
265 SInt64 inStartingPacket,
266 UInt32 *ioNumPackets,
267 void *outBuffer);
268
269typedef OSStatus (*WritePacketsFDF)( void *inComponentStorage,
270 Boolean inUseCache,
271 UInt32 inNumBytes,
272 const AudioStreamPacketDescription * _Nullable inPacketDescriptions,
273 SInt64 inStartingPacket,
274 UInt32 *ioNumPackets,
275 const void *inBuffer);
276
277typedef OSStatus (*GetPropertyInfoFDF)( void *inComponentStorage,
278 AudioFilePropertyID inPropertyID,
279 UInt32 * _Nullable outDataSize,
280 UInt32 * _Nullable isWritable);
281
282typedef OSStatus (*GetPropertyFDF)( void *inComponentStorage,
283 AudioFilePropertyID inPropertyID,
284 UInt32 *ioDataSize,
285 void *ioPropertyData);
286
287typedef OSStatus (*SetPropertyFDF)( void *inComponentStorage,
288 AudioFilePropertyID inPropertyID,
289 UInt32 inDataSize,
290 const void *inPropertyData);
291
292typedef OSStatus (*CountUserDataFDF)( void *inComponentStorage,
293 UInt32 inUserDataID,
294 UInt32 *outNumberItems);
295
296typedef OSStatus (*GetUserDataSizeFDF)( void *inComponentStorage,
297 UInt32 inUserDataID,
298 UInt32 inIndex,
299 UInt32 *outDataSize);
300
301typedef OSStatus (*GetUserDataFDF)( void *inComponentStorage,
302 UInt32 inUserDataID,
303 UInt32 inIndex,
304 UInt32 *ioUserDataSize,
305 void *outUserData);
306
307typedef OSStatus (*SetUserDataFDF)( void *inComponentStorage,
308 UInt32 inUserDataID,
309 UInt32 inIndex,
310 UInt32 inUserDataSize,
311 const void *inUserData);
312typedef struct AudioFileFDFTable
313{
314 void *mComponentStorage;
315 ReadBytesFDF mReadBytesFDF;
316 WriteBytesFDF mWriteBytesFDF;
317 ReadPacketsFDF mReadPacketsFDF;
318 WritePacketsFDF mWritePacketsFDF;
319
320 GetPropertyInfoFDF mGetPropertyInfoFDF;
321 GetPropertyFDF mGetPropertyFDF;
322 SetPropertyFDF mSetPropertyFDF;
323
324 CountUserDataFDF mCountUserDataFDF;
325 GetUserDataSizeFDF mGetUserDataSizeFDF;
326 GetUserDataFDF mGetUserDataFDF;
327 SetUserDataFDF mSetUserDataFDF;
328} AudioFileFDFTable;
329
330typedef struct AudioFileFDFTableExtended
331{
332 void *mComponentStorage;
333 ReadBytesFDF mReadBytesFDF;
334 WriteBytesFDF mWriteBytesFDF;
335 ReadPacketsFDF mReadPacketsFDF;
336 WritePacketsFDF mWritePacketsFDF;
337
338 GetPropertyInfoFDF mGetPropertyInfoFDF;
339 GetPropertyFDF mGetPropertyFDF;
340 SetPropertyFDF mSetPropertyFDF;
341
342 CountUserDataFDF mCountUserDataFDF;
343 GetUserDataSizeFDF mGetUserDataSizeFDF;
344 GetUserDataFDF mGetUserDataFDF;
345 SetUserDataFDF mSetUserDataFDF;
346
347 ReadPacketDataFDF mReadPacketDataFDF;
348} AudioFileFDFTableExtended;
349
350
351
352
353
354
355
356struct FSRef;
357extern OSStatus
358AudioFileComponentCreate(
359 AudioFileComponent inComponent,
360 const struct FSRef *inParentRef,
361 CFStringRef inFileName,
362 const AudioStreamBasicDescription *inFormat,
363 UInt32 inFlags,
364 struct FSRef *outNewFileRef);
365extern OSStatus
366AudioFileComponentInitialize(
367 AudioFileComponent inComponent,
368 const struct FSRef *inFileRef,
369 const AudioStreamBasicDescription *inFormat,
370 UInt32 inFlags);
371extern OSStatus
372AudioFileComponentOpenFile(
373 AudioFileComponent inComponent,
374 const struct FSRef *inFileRef,
375 SInt8 inPermissions,
376 SInt16 inRefNum);
377
378
379
380
381
382
383
384typedef OSStatus (*AudioFileComponentCreateURLProc)(
385 void *self,
386 CFURLRef inFileRef,
387 const AudioStreamBasicDescription* inFormat,
388 UInt32 inFlags);
389typedef OSStatus (*AudioFileComponentOpenURLProc)(
390 void *self,
391 CFURLRef inFileRef,
392 SInt8 inPermissions,
393 int inFileDescriptor);
394
395typedef OSStatus (*AudioFileComponentOpenWithCallbacksProc)(
396 void *self,
397 void *inClientData,
398 AudioFile_ReadProc inReadFunc,
399 AudioFile_WriteProc inWriteFunc,
400 AudioFile_GetSizeProc inGetSizeFunc,
401 AudioFile_SetSizeProc inSetSizeFunc);
402
403typedef OSStatus (*AudioFileComponentInitializeWithCallbacksProc)(
404 void *self,
405 void *inClientData,
406 AudioFile_ReadProc inReadFunc,
407 AudioFile_WriteProc inWriteFunc,
408 AudioFile_GetSizeProc inGetSizeFunc,
409 AudioFile_SetSizeProc inSetSizeFunc,
410 UInt32 inFileType,
411 const AudioStreamBasicDescription *inFormat,
412 UInt32 inFlags);
413
414typedef OSStatus (*AudioFileComponentCloseProc)(
415 void *self);
416
417typedef OSStatus (*AudioFileComponentOptimizeProc)(
418 void *self);
419
420typedef OSStatus (*AudioFileComponentReadBytesProc)(
421 void *self,
422 Boolean inUseCache,
423 SInt64 inStartingByte,
424 UInt32 *ioNumBytes,
425 void *outBuffer);
426
427typedef OSStatus (*AudioFileComponentWriteBytesProc)(
428 void *self,
429 Boolean inUseCache,
430 SInt64 inStartingByte,
431 UInt32 *ioNumBytes,
432 const void *inBuffer);
433
434typedef OSStatus (*AudioFileComponentReadPacketsProc)(
435 void *self,
436 Boolean inUseCache,
437 UInt32 *outNumBytes,
438 AudioStreamPacketDescription * _Nullable outPacketDescriptions,
439 SInt64 inStartingPacket,
440 UInt32 *ioNumPackets,
441 void *outBuffer);
442
443
444typedef OSStatus (*AudioFileComponentReadPacketDataProc)(
445 void *self,
446 Boolean inUseCache,
447 UInt32 *ioNumBytes,
448 AudioStreamPacketDescription * _Nullable outPacketDescriptions,
449 SInt64 inStartingPacket,
450 UInt32 *ioNumPackets,
451 void *outBuffer);
452
453typedef OSStatus (*AudioFileComponentWritePacketsProc)(
454 void *self,
455 Boolean inUseCache,
456 UInt32 inNumBytes,
457 const AudioStreamPacketDescription * _Nullable inPacketDescriptions,
458 SInt64 inStartingPacket,
459 UInt32 *ioNumPackets,
460 const void *inBuffer);
461
462
463typedef OSStatus (*AudioFileComponentGetPropertyInfoProc)(
464 void *self,
465 AudioFileComponentPropertyID inPropertyID,
466 UInt32 * _Nullable outPropertySize,
467 UInt32 * _Nullable outWritable);
468
469
470typedef OSStatus (*AudioFileComponentGetPropertyProc)(
471 void *self,
472 AudioFileComponentPropertyID inPropertyID,
473 UInt32 *ioPropertyDataSize,
474 void *outPropertyData);
475
476typedef OSStatus (*AudioFileComponentSetPropertyProc)(
477 void *self,
478 AudioFileComponentPropertyID inPropertyID,
479 UInt32 inPropertyDataSize,
480 const void *inPropertyData);
481
482
483typedef OSStatus (*AudioFileComponentCountUserDataProc)(
484 void *self,
485 UInt32 inUserDataID,
486 UInt32 *outNumberItems);
487
488typedef OSStatus (*AudioFileComponentGetUserDataSizeProc)(
489 void *self,
490 UInt32 inUserDataID,
491 UInt32 inIndex,
492 UInt32 *outUserDataSize);
493
494typedef OSStatus (*AudioFileComponentGetUserDataProc)(
495 void *self,
496 UInt32 inUserDataID,
497 UInt32 inIndex,
498 UInt32 *ioUserDataSize,
499 void *outUserData);
500
501typedef OSStatus (*AudioFileComponentSetUserDataProc)(
502 void *self,
503 UInt32 inUserDataID,
504 UInt32 inIndex,
505 UInt32 inUserDataSize,
506 const void *inUserData);
507
508
509typedef OSStatus (*AudioFileComponentRemoveUserDataProc)(
510 void *self,
511 UInt32 inUserDataID,
512 UInt32 inIndex);
513
514typedef OSStatus (*AudioFileComponentExtensionIsThisFormatProc)(
515 void *self,
516 CFStringRef inExtension,
517 UInt32 *outResult);
518
519
520typedef OSStatus (*AudioFileComponentFileDataIsThisFormatProc)(
521 void *self,
522 UInt32 inDataByteSize,
523 const void* inData,
524 UInt32 *outResult);
525
526
527typedef OSStatus (*AudioFileComponentGetGlobalInfoSizeProc)(
528 void *self,
529 AudioFileComponentPropertyID inPropertyID,
530 UInt32 inSpecifierSize,
531 const void * _Nullable inSpecifier,
532 UInt32 *outPropertySize);
533
534typedef OSStatus (*AudioFileComponentGetGlobalInfoProc)(
535 void *self,
536 AudioFileComponentPropertyID inPropertyID,
537 UInt32 inSpecifierSize,
538 const void * _Nullable inSpecifier,
539 UInt32 *ioPropertyDataSize,
540 void *outPropertyData);
541
542#ifdef __cplusplus
543}
544#endif
545
546#endif