Cider Isn't Darwin Emulation, Really
Something went wrong. Try again.
16 kB · 546 lines
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547#ifndef _AUDIO_FILE_COMPONENT_H#define _AUDIO_FILE_COMPONENT_H
#include <AudioToolbox/AudioFile.h>#include <AudioToolbox/AudioComponent.h>
#ifdef __cplusplusextern "C" {#endif
typedef AudioComponentInstance AudioFileComponent;
typedef UInt32 AudioFileComponentPropertyID;extern OSStatusAudioFileComponentCreateURL ( AudioFileComponent inComponent, CFURLRef inFileRef, const AudioStreamBasicDescription *inFormat, UInt32 inFlags);extern OSStatusAudioFileComponentOpenURL ( AudioFileComponent inComponent, CFURLRef inFileRef, SInt8 inPermissions, int inFileDescriptor);extern OSStatusAudioFileComponentOpenWithCallbacks( AudioFileComponent inComponent, void *inClientData, AudioFile_ReadProc inReadFunc, AudioFile_WriteProc inWriteFunc, AudioFile_GetSizeProc inGetSizeFunc, AudioFile_SetSizeProc inSetSizeFunc);extern OSStatusAudioFileComponentInitializeWithCallbacks( AudioFileComponent inComponent, void *inClientData, AudioFile_ReadProc inReadFunc, AudioFile_WriteProc inWriteFunc, AudioFile_GetSizeProc inGetSizeFunc, AudioFile_SetSizeProc inSetSizeFunc, UInt32 inFileType, const AudioStreamBasicDescription *inFormat, UInt32 inFlags);extern OSStatusAudioFileComponentCloseFile( AudioFileComponent inComponent);
extern OSStatusAudioFileComponentOptimize( AudioFileComponent inComponent);extern OSStatusAudioFileComponentReadBytes( AudioFileComponent inComponent, Boolean inUseCache, SInt64 inStartingByte, UInt32 *ioNumBytes, void *outBuffer);extern OSStatusAudioFileComponentWriteBytes( AudioFileComponent inComponent, Boolean inUseCache, SInt64 inStartingByte, UInt32 *ioNumBytes, const void *inBuffer);extern OSStatusAudioFileComponentReadPackets( AudioFileComponent inComponent, Boolean inUseCache, UInt32 *outNumBytes, AudioStreamPacketDescription * _Nullable outPacketDescriptions, SInt64 inStartingPacket, UInt32 *ioNumPackets, void *outBuffer);extern OSStatusAudioFileComponentReadPacketData( AudioFileComponent inComponent, Boolean inUseCache, UInt32 *ioNumBytes, AudioStreamPacketDescription * _Nullable outPacketDescriptions, SInt64 inStartingPacket, UInt32 *ioNumPackets, void *outBuffer);extern OSStatusAudioFileComponentWritePackets( AudioFileComponent inComponent, Boolean inUseCache, UInt32 inNumBytes, const AudioStreamPacketDescription * _Nullable inPacketDescriptions, SInt64 inStartingPacket, UInt32 *ioNumPackets, const void *inBuffer);extern OSStatusAudioFileComponentGetPropertyInfo( AudioFileComponent inComponent, AudioFileComponentPropertyID inPropertyID, UInt32 * _Nullable outPropertySize, UInt32 * _Nullable outWritable);extern OSStatusAudioFileComponentGetProperty( AudioFileComponent inComponent, AudioFileComponentPropertyID inPropertyID, UInt32 *ioPropertyDataSize, void *outPropertyData);extern OSStatusAudioFileComponentSetProperty( AudioFileComponent inComponent, AudioFileComponentPropertyID inPropertyID, UInt32 inPropertyDataSize, const void *inPropertyData);extern OSStatusAudioFileComponentCountUserData( AudioFileComponent inComponent, UInt32 inUserDataID, UInt32 *outNumberItems);extern OSStatusAudioFileComponentGetUserDataSize( AudioFileComponent inComponent, UInt32 inUserDataID, UInt32 inIndex, UInt32 *outUserDataSize);extern OSStatusAudioFileComponentGetUserData( AudioFileComponent inComponent, UInt32 inUserDataID, UInt32 inIndex, UInt32 *ioUserDataSize, void *outUserData);extern OSStatusAudioFileComponentSetUserData( AudioFileComponent inComponent, UInt32 inUserDataID, UInt32 inIndex, UInt32 inUserDataSize, const void *inUserData);extern OSStatusAudioFileComponentRemoveUserData( AudioFileComponent inComponent, UInt32 inUserDataID, UInt32 inIndex);extern OSStatusAudioFileComponentExtensionIsThisFormat( AudioFileComponent inComponent, CFStringRef inExtension, UInt32 *outResult);extern OSStatusAudioFileComponentFileDataIsThisFormat( AudioFileComponent inComponent, UInt32 inDataByteSize, const void* inData, UInt32 *outResult);extern OSStatusAudioFileComponentFileIsThisFormat( AudioFileComponent inComponent, SInt16 inFileRefNum, UInt32 *outResult);extern OSStatusAudioFileComponentDataIsThisFormat( AudioFileComponent inComponent, void * _Nullable inClientData, AudioFile_ReadProc _Nullable inReadFunc, AudioFile_WriteProc _Nullable inWriteFunc, AudioFile_GetSizeProc _Nullable inGetSizeFunc, AudioFile_SetSizeProc _Nullable inSetSizeFunc, UInt32 *outResult);extern OSStatusAudioFileComponentGetGlobalInfoSize( AudioFileComponent inComponent, AudioFileComponentPropertyID inPropertyID, UInt32 inSpecifierSize, const void * _Nullable inSpecifier, UInt32 *outPropertySize);extern OSStatusAudioFileComponentGetGlobalInfo( AudioFileComponent inComponent, AudioFileComponentPropertyID inPropertyID, UInt32 inSpecifierSize, const void * _Nullable inSpecifier, UInt32 *ioPropertyDataSize, void *outPropertyData);enum{ kAudioFileComponent_CanRead = 'cnrd', kAudioFileComponent_CanWrite = 'cnwr', kAudioFileComponent_FileTypeName = 'ftnm', kAudioFileComponent_UTIsForType = 'futi', kAudioFileComponent_MIMETypesForType = 'fmim', kAudioFileComponent_ExtensionsForType = 'fext', kAudioFileComponent_AvailableFormatIDs = 'fmid', kAudioFileComponent_AvailableStreamDescriptionsForFormat = 'sdid', kAudioFileComponent_FastDispatchTable = 'fdft', kAudioFileComponent_HFSTypeCodesForType = 'fhfs'};
enum{ kAudioFileCreateSelect = 0x0001, kAudioFileOpenSelect = 0x0002, kAudioFileInitializeSelect = 0x0003, kAudioFileOpenWithCallbacksSelect = 0x0004, kAudioFileInitializeWithCallbacksSelect = 0x0005, kAudioFileCloseSelect = 0x0006, kAudioFileOptimizeSelect = 0x0007, kAudioFileReadBytesSelect = 0x0008, kAudioFileWriteBytesSelect = 0x0009, kAudioFileReadPacketsSelect = 0x000A, kAudioFileWritePacketsSelect = 0x000B, kAudioFileGetPropertyInfoSelect = 0x000C, kAudioFileGetPropertySelect = 0x000D, kAudioFileSetPropertySelect = 0x000E,
kAudioFileExtensionIsThisFormatSelect = 0x000F, kAudioFileFileIsThisFormatSelect = 0x0010, kAudioFileDataIsThisFormatSelect = 0x0011, kAudioFileGetGlobalInfoSizeSelect = 0x0012, kAudioFileGetGlobalInfoSelect = 0x0013,
kAudioFileCountUserDataSelect = 0x0014, kAudioFileGetUserDataSizeSelect = 0x0015, kAudioFileGetUserDataSelect = 0x0016, kAudioFileSetUserDataSelect = 0x0017, kAudioFileRemoveUserDataSelect = 0x0018, kAudioFileCreateURLSelect = 0x0019, kAudioFileOpenURLSelect = 0x001A, kAudioFileFileDataIsThisFormatSelect = 0x001B, kAudioFileReadPacketDataSelect = 0x001C,};typedef OSStatus (*ReadBytesFDF)( void *inComponentStorage, Boolean inUseCache, SInt64 inStartingByte, UInt32 *ioNumBytes, void *outBuffer);
typedef OSStatus (*WriteBytesFDF)( void *inComponentStorage, Boolean inUseCache, SInt64 inStartingByte, UInt32 *ioNumBytes, const void *inBuffer);
typedef OSStatus (*ReadPacketsFDF)( void *inComponentStorage, Boolean inUseCache, UInt32 *outNumBytes, AudioStreamPacketDescription * _Nullable outPacketDescriptions, SInt64 inStartingPacket, UInt32 *ioNumPackets, void *outBuffer);
typedef OSStatus (*ReadPacketDataFDF)( void *inComponentStorage, Boolean inUseCache, UInt32 *ioNumBytes, AudioStreamPacketDescription * _Nullable outPacketDescriptions, SInt64 inStartingPacket, UInt32 *ioNumPackets, void *outBuffer);
typedef OSStatus (*WritePacketsFDF)( void *inComponentStorage, Boolean inUseCache, UInt32 inNumBytes, const AudioStreamPacketDescription * _Nullable inPacketDescriptions, SInt64 inStartingPacket, UInt32 *ioNumPackets, const void *inBuffer);
typedef OSStatus (*GetPropertyInfoFDF)( void *inComponentStorage, AudioFilePropertyID inPropertyID, UInt32 * _Nullable outDataSize, UInt32 * _Nullable isWritable);
typedef OSStatus (*GetPropertyFDF)( void *inComponentStorage, AudioFilePropertyID inPropertyID, UInt32 *ioDataSize, void *ioPropertyData);
typedef OSStatus (*SetPropertyFDF)( void *inComponentStorage, AudioFilePropertyID inPropertyID, UInt32 inDataSize, const void *inPropertyData);
typedef OSStatus (*CountUserDataFDF)( void *inComponentStorage, UInt32 inUserDataID, UInt32 *outNumberItems);
typedef OSStatus (*GetUserDataSizeFDF)( void *inComponentStorage, UInt32 inUserDataID, UInt32 inIndex, UInt32 *outDataSize);
typedef OSStatus (*GetUserDataFDF)( void *inComponentStorage, UInt32 inUserDataID, UInt32 inIndex, UInt32 *ioUserDataSize, void *outUserData);
typedef OSStatus (*SetUserDataFDF)( void *inComponentStorage, UInt32 inUserDataID, UInt32 inIndex, UInt32 inUserDataSize, const void *inUserData);typedef struct AudioFileFDFTable{ void *mComponentStorage; ReadBytesFDF mReadBytesFDF; WriteBytesFDF mWriteBytesFDF; ReadPacketsFDF mReadPacketsFDF; WritePacketsFDF mWritePacketsFDF;
GetPropertyInfoFDF mGetPropertyInfoFDF; GetPropertyFDF mGetPropertyFDF; SetPropertyFDF mSetPropertyFDF;
CountUserDataFDF mCountUserDataFDF; GetUserDataSizeFDF mGetUserDataSizeFDF; GetUserDataFDF mGetUserDataFDF; SetUserDataFDF mSetUserDataFDF;} AudioFileFDFTable;
typedef struct AudioFileFDFTableExtended{ void *mComponentStorage; ReadBytesFDF mReadBytesFDF; WriteBytesFDF mWriteBytesFDF; ReadPacketsFDF mReadPacketsFDF; WritePacketsFDF mWritePacketsFDF;
GetPropertyInfoFDF mGetPropertyInfoFDF; GetPropertyFDF mGetPropertyFDF; SetPropertyFDF mSetPropertyFDF;
CountUserDataFDF mCountUserDataFDF; GetUserDataSizeFDF mGetUserDataSizeFDF; GetUserDataFDF mGetUserDataFDF; SetUserDataFDF mSetUserDataFDF;
ReadPacketDataFDF mReadPacketDataFDF;} AudioFileFDFTableExtended;
struct FSRef;extern OSStatusAudioFileComponentCreate( AudioFileComponent inComponent, const struct FSRef *inParentRef, CFStringRef inFileName, const AudioStreamBasicDescription *inFormat, UInt32 inFlags, struct FSRef *outNewFileRef);extern OSStatusAudioFileComponentInitialize( AudioFileComponent inComponent, const struct FSRef *inFileRef, const AudioStreamBasicDescription *inFormat, UInt32 inFlags);extern OSStatusAudioFileComponentOpenFile( AudioFileComponent inComponent, const struct FSRef *inFileRef, SInt8 inPermissions, SInt16 inRefNum);
typedef OSStatus (*AudioFileComponentCreateURLProc)( void *self, CFURLRef inFileRef, const AudioStreamBasicDescription* inFormat, UInt32 inFlags);typedef OSStatus (*AudioFileComponentOpenURLProc)( void *self, CFURLRef inFileRef, SInt8 inPermissions, int inFileDescriptor);
typedef OSStatus (*AudioFileComponentOpenWithCallbacksProc)( void *self, void *inClientData, AudioFile_ReadProc inReadFunc, AudioFile_WriteProc inWriteFunc, AudioFile_GetSizeProc inGetSizeFunc, AudioFile_SetSizeProc inSetSizeFunc);
typedef OSStatus (*AudioFileComponentInitializeWithCallbacksProc)( void *self, void *inClientData, AudioFile_ReadProc inReadFunc, AudioFile_WriteProc inWriteFunc, AudioFile_GetSizeProc inGetSizeFunc, AudioFile_SetSizeProc inSetSizeFunc, UInt32 inFileType, const AudioStreamBasicDescription *inFormat, UInt32 inFlags);
typedef OSStatus (*AudioFileComponentCloseProc)( void *self);
typedef OSStatus (*AudioFileComponentOptimizeProc)( void *self);
typedef OSStatus (*AudioFileComponentReadBytesProc)( void *self, Boolean inUseCache, SInt64 inStartingByte, UInt32 *ioNumBytes, void *outBuffer);
typedef OSStatus (*AudioFileComponentWriteBytesProc)( void *self, Boolean inUseCache, SInt64 inStartingByte, UInt32 *ioNumBytes, const void *inBuffer);
typedef OSStatus (*AudioFileComponentReadPacketsProc)( void *self, Boolean inUseCache, UInt32 *outNumBytes, AudioStreamPacketDescription * _Nullable outPacketDescriptions, SInt64 inStartingPacket, UInt32 *ioNumPackets, void *outBuffer);
typedef OSStatus (*AudioFileComponentReadPacketDataProc)( void *self, Boolean inUseCache, UInt32 *ioNumBytes, AudioStreamPacketDescription * _Nullable outPacketDescriptions, SInt64 inStartingPacket, UInt32 *ioNumPackets, void *outBuffer);
typedef OSStatus (*AudioFileComponentWritePacketsProc)( void *self, Boolean inUseCache, UInt32 inNumBytes, const AudioStreamPacketDescription * _Nullable inPacketDescriptions, SInt64 inStartingPacket, UInt32 *ioNumPackets, const void *inBuffer);
typedef OSStatus (*AudioFileComponentGetPropertyInfoProc)( void *self, AudioFileComponentPropertyID inPropertyID, UInt32 * _Nullable outPropertySize, UInt32 * _Nullable outWritable);
typedef OSStatus (*AudioFileComponentGetPropertyProc)( void *self, AudioFileComponentPropertyID inPropertyID, UInt32 *ioPropertyDataSize, void *outPropertyData);
typedef OSStatus (*AudioFileComponentSetPropertyProc)( void *self, AudioFileComponentPropertyID inPropertyID, UInt32 inPropertyDataSize, const void *inPropertyData);
typedef OSStatus (*AudioFileComponentCountUserDataProc)( void *self, UInt32 inUserDataID, UInt32 *outNumberItems);
typedef OSStatus (*AudioFileComponentGetUserDataSizeProc)( void *self, UInt32 inUserDataID, UInt32 inIndex, UInt32 *outUserDataSize);
typedef OSStatus (*AudioFileComponentGetUserDataProc)( void *self, UInt32 inUserDataID, UInt32 inIndex, UInt32 *ioUserDataSize, void *outUserData);
typedef OSStatus (*AudioFileComponentSetUserDataProc)( void *self, UInt32 inUserDataID, UInt32 inIndex, UInt32 inUserDataSize, const void *inUserData);
typedef OSStatus (*AudioFileComponentRemoveUserDataProc)( void *self, UInt32 inUserDataID, UInt32 inIndex);
typedef OSStatus (*AudioFileComponentExtensionIsThisFormatProc)( void *self, CFStringRef inExtension, UInt32 *outResult);
typedef OSStatus (*AudioFileComponentFileDataIsThisFormatProc)( void *self, UInt32 inDataByteSize, const void* inData, UInt32 *outResult);
typedef OSStatus (*AudioFileComponentGetGlobalInfoSizeProc)( void *self, AudioFileComponentPropertyID inPropertyID, UInt32 inSpecifierSize, const void * _Nullable inSpecifier, UInt32 *outPropertySize);
typedef OSStatus (*AudioFileComponentGetGlobalInfoProc)( void *self, AudioFileComponentPropertyID inPropertyID, UInt32 inSpecifierSize, const void * _Nullable inSpecifier, UInt32 *ioPropertyDataSize, void *outPropertyData);
#ifdef __cplusplus}#endif
#endif