this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove /src from the include path

Create proper include directories for components affected by this change

+3906 -2700
+1 -41
src/AudioUnit/AUComponent.h
··· 1 - #ifndef AUCOMPONENT_H 2 - #define AUCOMPONENT_H 3 - #include <MacTypes.h> 4 - #include <CoreServices/Components.h> 5 - #include <CoreFoundation/CFString.h> 6 - 7 - class AudioUnitComponent; 8 - 9 - typedef Component AudioComponent; 10 - typedef AudioUnitComponent* AudioComponentInstance; 11 - typedef ComponentDescription AudioComponentDescription; 12 - 13 - enum 14 - { 15 - kAudioUnitType_Output = 'auou', 16 - kAudioUnitType_MusicDevice = 'aumu', 17 - kAudioUnitType_MusicEffect = 'aumf', 18 - kAudioUnitType_FormatConverter = 'aufc', 19 - kAudioUnitType_Effect = 'aufx', 20 - kAudioUnitType_Mixer = 'aumx', 21 - kAudioUnitType_Panner = 'aupn', 22 - kAudioUnitType_Generator = 'augn', 23 - kAudioUnitType_OfflineEffect = 'auol' 24 - }; 25 - 26 - extern "C" { 27 - 28 - AudioComponent AudioComponentFindNext(AudioComponent inAComponent, AudioComponentDescription *inDesc); 29 - OSStatus AudioComponentGetDescription(AudioComponent inComponent, AudioComponentDescription *outDesc); 30 - OSStatus AudioComponentGetVersion(AudioComponent inComponent, UInt32 *outVersion); 31 - Boolean AudioComponentInstanceCanDo(AudioComponentInstance inInstance, SInt16 inSelectorID); 32 - OSStatus AudioComponentInstanceDispose(AudioComponentInstance inInstance); 33 - AudioComponent AudioComponentInstanceGetComponent(AudioComponentInstance inInstance); 34 - OSStatus AudioComponentInstanceNew(AudioComponent inComponent, AudioComponentInstance *outInstance); 35 - OSStatus AudioComponentCopyName(AudioComponent inComponent, CFStringRef *outName); 36 - UInt32 AudioComponentCount(AudioComponentDescription *inDesc); 37 - 38 - } 39 - 40 - #endif 41 - 1 + include/AudioUnit/AUComponent.h
+1 -78
src/AudioUnit/AUGraph.h
··· 1 - #ifndef AUGRAPH_H 2 - #define AUGRAPH_H 3 - #include "AudioUnit.h" 4 - #include "AudioUnitProperties.h" 5 - 6 - #ifdef __cplusplus 7 - extern "C" { 8 - #endif 9 - 10 - typedef struct AUGraphData* AUGraph; 11 - typedef SInt32 AUNode; 12 - 13 - struct AudioUnitNodeConnection 14 - { 15 - AUNode sourceNode; 16 - UInt32 sourceOutputNumber; 17 - AUNode destNode; 18 - UInt32 destInputNumber; 19 - }; 20 - 21 - typedef struct AudioUnitNodeConnection AudioUnitNodeConnection; 22 - typedef struct AudioUnitNodeConnection AUNodeConnection; 23 - 24 - struct AUNodeRenderCallback 25 - { 26 - AUNode destNode; 27 - AudioUnitElement destInputNumber; 28 - AURenderCallbackStruct cback; 29 - }; 30 - typedef struct AUNodeRenderCallback AUNodeRenderCallback; 31 - 32 - struct AUNodeInteraction 33 - { 34 - UInt32 nodeInteractionType; 35 - union 36 - { 37 - AUNodeConnection connection; 38 - AUNodeRenderCallback inputCallback; 39 - } nodeInteraction; 40 - }; 41 - typedef struct AUNodeInteraction AUNodeInteraction; 42 - 43 - OSStatus AUGraphAddNode(AUGraph inGraph, const AudioComponentDescription *inDescription, AUNode *outNode); 44 - OSStatus AUGraphAddRenderNotify(AUGraph inGraph, AURenderCallback inCallback, void *inRefCon); 45 - OSStatus AUGraphClearConnections(AUGraph inGraph); 46 - OSStatus AUGraphClose(AUGraph inGraph); 47 - OSStatus AUGraphConnectNodeInput(AUGraph inGraph, AUNode inSourceNode, UInt32 inSourceOutputNumber, AUNode inDestNode, UInt32 inDestInputNumber); 48 - OSStatus AUGraphCountNodeInteractions(AUGraph inGraph, AUNode inNode, UInt32 *outNumInteractions); 49 - OSStatus AUGraphDisconnectNodeInput(AUGraph inGraph, AUNode inDestNode, UInt32 inDestInputNumber); 50 - OSStatus AUGraphGetCPULoad(AUGraph inGraph, Float32 *outAverageCPULoad); 51 - OSStatus AUGraphGetIndNode(AUGraph inGraph, UInt32 inIndex, AUNode *outNode); 52 - OSStatus AUGraphGetInteractionInfo(AUGraph inGraph, UInt32 inInteractionIndex, AUNodeInteraction *outInteraction); 53 - OSStatus AUGraphGetMaxCPULoad(AUGraph inGraph, Float32 *outMaxLoad); 54 - OSStatus AUGraphGetNodeCount(AUGraph inGraph, UInt32 *outNumberOfNodes); 55 - OSStatus AUGraphGetNodeInteractions(AUGraph inGraph, AUNode inNode, UInt32 *ioNumInteractions, AUNodeInteraction *outInteractions); 56 - OSStatus AUGraphGetNumberOfInteractions(AUGraph inGraph, UInt32 *outNumInteractions); 57 - OSStatus AUGraphInitialize(AUGraph inGraph); 58 - OSStatus AUGraphIsInitialized(AUGraph inGraph, Boolean *outIsInitialized); 59 - OSStatus AUGraphIsOpen(AUGraph inGraph, Boolean *outIsOpen); 60 - OSStatus AUGraphIsRunning(AUGraph inGraph, Boolean *outIsRunning); 61 - OSStatus AUGraphNodeInfo(AUGraph inGraph, AUNode inNode, AudioComponentDescription *outDescription, AudioUnit *outAudioUnit); 62 - OSStatus AUGraphOpen(AUGraph inGraph); 63 - OSStatus AUGraphRemoveNode(AUGraph inGraph, AUNode inNode); 64 - OSStatus AUGraphRemoveRenderNotify(AUGraph inGraph, AURenderCallback inCallback, void *inRefCon); 65 - OSStatus AUGraphSetNodeInputCallback(AUGraph inGraph, AUNode inDestNode, UInt32 inDestInputNumber, const AURenderCallbackStruct *inInputCallback); 66 - OSStatus AUGraphStart(AUGraph inGraph); 67 - OSStatus AUGraphStop(AUGraph inGraph); 68 - OSStatus AUGraphUninitialize(AUGraph inGraph); 69 - OSStatus AUGraphUpdate(AUGraph inGraph, Boolean *outIsUpdated); 70 - OSStatus DisposeAUGraph(AUGraph inGraph); 71 - OSStatus NewAUGraph(AUGraph *outGraph); 72 - 73 - #ifdef __cplusplus 74 - } 75 - #endif 76 - 77 - 78 - #endif 1 + include/AudioUnit/AUGraph.h
+1 -23
src/AudioUnit/AudioOutputUnitComponent.h
··· 1 - #ifndef AOUCOMPONENT_H 2 - #define AOUCOMPONENT_H 3 - #include "AudioUnitBase.h" 4 - 5 - class AudioOutputUnitComponent : public AudioUnitComponent 6 - { 7 - public: 8 - AudioOutputUnitComponent(); 9 - 10 - virtual OSStatus setProperty(AudioUnitPropertyID prop, AudioUnitScope scope, AudioUnitElement elem, const void* data, UInt32 dataSize) override; 11 - virtual OSStatus getProperty(AudioUnitPropertyID prop, AudioUnitScope scope, AudioUnitElement elem, void* data, UInt32* dataSize) override; 12 - virtual OSStatus getPropertyInfo(AudioUnitPropertyID prop, AudioUnitScope scope, AudioUnitElement elem, UInt32* dataSize, Boolean* writable) override; 13 - 14 - virtual OSStatus start() = 0; 15 - virtual OSStatus stop() = 0; 16 - 17 - virtual int cardIndex() const = 0; 18 - protected: 19 - bool m_enableOutput = true, m_enableInput = false; 20 - AURenderCallbackStruct m_outputCallback; 21 - }; 22 - 23 - #endif 1 + include/AudioUnit/AudioOutputUnitComponent.h
+1 -108
src/AudioUnit/AudioQueue.h
··· 1 - #ifndef AUDIOBUFFER_H 2 - #define AUDIOBUFFER_H 3 - #include <CoreAudio/CoreAudioTypes.h> 4 - #include <CoreServices/MacTypes.h> 5 - #include <CoreFoundation/CFString.h> 6 - #include <CoreFoundation/CFRunLoop.h> 7 - 8 - #ifdef __cplusplus 9 - extern "C" { 10 - #endif 11 - 12 - typedef UInt32 AudioQueuePropertyID; 13 - typedef UInt32 AudioQueueParameterID; 14 - typedef Float32 AudioQueueParameterValue; 15 - 16 - struct AudioQueueParameterEvent 17 - { 18 - AudioQueueParameterID mID; 19 - AudioQueueParameterValue mValue; 20 - }; 21 - 22 - class AudioQueue; 23 - typedef AudioQueue* AudioQueueRef; 24 - 25 - struct AudioQueueBuffer 26 - { 27 - const UInt32 mAudioDataBytesCapacity; 28 - void* mAudioData; 29 - UInt32 mAudioDataByteSize; 30 - void* mUserData; 31 - 32 - UInt32 mPacketDescriptionCapacity; 33 - AudioStreamPacketDescription* mPacketDescriptions; 34 - UInt32 mPacketDescriptionCount; 35 - }; 36 - typedef AudioQueueBuffer* AudioQueueBufferRef; 37 - 38 - OSStatus AudioQueueStart(AudioQueueRef inAQ, const AudioTimeStamp *inStartTime); 39 - OSStatus AudioQueuePrime(AudioQueueRef inAQ, UInt32 inNumberOfFramesToPrepare, UInt32 *outNumberOfFramesPrepared); 40 - OSStatus AudioQueueFlush(AudioQueueRef inAQ); 41 - OSStatus AudioQueueStop(AudioQueueRef inAQ, Boolean inImmediate); 42 - OSStatus AudioQueuePause(AudioQueueRef inAQ); 43 - OSStatus AudioQueueReset(AudioQueueRef inAQ); 44 - 45 - typedef void (*AudioQueueOutputCallback)(void* inUserData, AudioQueueRef inAQ, 46 - AudioQueueBufferRef inBuffer); 47 - OSStatus AudioQueueNewOutput(const AudioStreamBasicDescription *inFormat, 48 - AudioQueueOutputCallback inCallbackProc, 49 - void *inUserData, CFRunLoopRef inCallbackRunLoop, 50 - CFStringRef inCallbackRunLoopMode, UInt32 inFlags, 51 - AudioQueueRef *outAQ); 52 - 53 - typedef void (*AudioQueueInputCallback)(void* inUserData, AudioQueueRef inAQ, 54 - AudioQueueBufferRef inBuffer, const AudioTimeStamp* inStartTime, 55 - UInt32 inNumberPacketDescriptions, 56 - const AudioStreamPacketDescription* inPacketDescs); 57 - OSStatus AudioQueueNewInput(const AudioStreamBasicDescription *inFormat, 58 - AudioQueueInputCallback inCallbackProc, 59 - void *inUserData, CFRunLoopRef inCallbackRunLoop, 60 - CFStringRef inCallbackRunLoopMode, UInt32 inFlags, 61 - AudioQueueRef *outAQ); 62 - 63 - OSStatus AudioQueueDispose(AudioQueueRef inAQ, Boolean inImmediate); 64 - 65 - OSStatus AudioQueueGetParameter(AudioQueueRef inAQ, AudioQueueParameterID inParamID, AudioQueueParameterValue *outValue); 66 - OSStatus AudioQueueSetParameter(AudioQueueRef inAQ, AudioQueueParameterID inParamID, AudioQueueParameterValue inValue); 67 - 68 - OSStatus AudioQueueGetProperty(AudioQueueRef inAQ, AudioQueuePropertyID inID, void *outData, UInt32 *ioDataSize); 69 - OSStatus AudioQueueSetProperty(AudioQueueRef inAQ, AudioQueuePropertyID inID, const void *inData, UInt32 inDataSize); 70 - OSStatus AudioQueueGetPropertySize(AudioQueueRef inAQ, AudioQueuePropertyID inID, UInt32 *outDataSize); 71 - 72 - typedef void (*AudioQueuePropertyListenerProc)(void* inUserData, AudioQueueRef inAQ, AudioQueuePropertyID inID); 73 - OSStatus AudioQueueAddPropertyListener(AudioQueueRef inAQ, AudioQueuePropertyID inID, AudioQueuePropertyListenerProc inProc, void *inUserData); 74 - OSStatus AudioQueueRemovePropertyListener(AudioQueueRef inAQ, AudioQueuePropertyID inID, AudioQueuePropertyListenerProc inProc, void *inUserData); 75 - 76 - OSStatus AudioQueueSetOfflineRenderFormat(AudioQueueRef inAQ, const AudioStreamBasicDescription *inFormat, const AudioChannelLayout *inLayout); 77 - OSStatus AudioQueueOfflineRender(AudioQueueRef inAQ, const AudioTimeStamp *inTimestamp, AudioQueueBufferRef ioBuffer, UInt32 inNumberFrames); 78 - 79 - OSStatus AudioQueueAllocateBuffer(AudioQueueRef inAQ, UInt32 inBufferByteSize, AudioQueueBufferRef *outBuffer); 80 - OSStatus AudioQueueAllocateBufferWithPacketDescriptions(AudioQueueRef inAQ, 81 - UInt32 inBufferByteSize, UInt32 inNumberPacketDescriptions, 82 - AudioQueueBufferRef *outBuffer); 83 - OSStatus AudioQueueFreeBuffer(AudioQueueRef inAQ, AudioQueueBufferRef inBuffer); 84 - OSStatus AudioQueueEnqueueBuffer(AudioQueueRef inAQ, AudioQueueBufferRef inBuffer, 85 - UInt32 inNumPacketDescs, const AudioStreamPacketDescription *inPacketDescs); 86 - OSStatus AudioQueueEnqueueBufferWithParameters(AudioQueueRef inAQ, 87 - AudioQueueBufferRef inBuffer, UInt32 inNumPacketDescs, 88 - const AudioStreamPacketDescription *inPacketDescs, 89 - UInt32 inTrimFramesAtStart, UInt32 inTrimFramesAtEnd, 90 - UInt32 inNumParamValues, const AudioQueueParameterEvent *inParamValues, 91 - const AudioTimeStamp *inStartTime, AudioTimeStamp *outActualStartTime); 92 - 93 - class AudioQueueTimeline; 94 - typedef AudioQueueTimeline* AudioQueueTimelineRef; 95 - 96 - OSStatus AudioQueueCreateTimeline(AudioQueueRef inAQ, AudioQueueTimelineRef *outTimeline); 97 - OSStatus AudioQueueDisposeTimeline(AudioQueueRef inAQ, AudioQueueTimelineRef inTimeline); 98 - OSStatus AudioQueueDeviceGetCurrentTime(AudioQueueRef inAQ, AudioTimeStamp *outTimeStamp); 99 - OSStatus AudioQueueDeviceGetNearestStartTime(AudioQueueRef inAQ, AudioTimeStamp *ioRequestedStartTime, UInt32 inFlags); 100 - OSStatus AudioQueueDeviceTranslateTime(AudioQueueRef inAQ, const AudioTimeStamp *inTime, AudioTimeStamp *outTime); 101 - OSStatus AudioQueueGetCurrentTime(AudioQueueRef inAQ, AudioQueueTimelineRef inTimeline, AudioTimeStamp *outTimeStamp, Boolean *outTimelineDiscontinuity); 102 - 103 - #ifdef __cplusplus 104 - } 105 - #endif 106 - 107 - #endif /* AUDIOBUFFER_H */ 108 - 1 + include/AudioUnit/AudioQueue.h
+1 -42
src/AudioUnit/AudioQueueBase.h
··· 1 - #ifndef AUDIOQUEUEBASE_H 2 - #define AUDIOQUEUEBASE_H 3 - #include "AudioQueue.h" 4 - 5 - class AudioQueue 6 - { 7 - public: 8 - AudioQueue(const AudioStreamBasicDescription* format, void* userData, 9 - CFRunLoopRef runloop, CFStringRef runloopMode, UInt32 flags); 10 - virtual ~AudioQueue(); 11 - 12 - virtual OSStatus start(const AudioTimeStamp *inStartTime) = 0; 13 - virtual OSStatus prime(UInt32 inNumberOfFramesToPrepare, UInt32 *outNumberOfFramesPrepared) = 0; 14 - virtual OSStatus flush() = 0; 15 - virtual OSStatus stop(Boolean inImmediate) = 0; 16 - virtual OSStatus pause() = 0; 17 - virtual OSStatus reset() = 0; 18 - 19 - virtual OSStatus dispose(Boolean inImmediate) = 0; 20 - 21 - virtual OSStatus getParameter(AudioQueueParameterID inParamID, AudioQueueParameterValue *outValue); 22 - virtual OSStatus setParameter(AudioQueueParameterID inParamID, AudioQueueParameterValue inValue); 23 - 24 - virtual OSStatus getProperty(AudioQueuePropertyID inID, void *outData, UInt32 *ioDataSize); 25 - virtual OSStatus setProperty(AudioQueuePropertyID inID, const void *inData, UInt32 inDataSize); 26 - virtual OSStatus getPropertySize(AudioQueuePropertyID inID, UInt32 *outDataSize); 27 - 28 - OSStatus addPropertyListener(AudioQueuePropertyID inID, AudioQueuePropertyListenerProc inProc, void *inUserData); 29 - OSStatus removePropertyListener(AudioQueuePropertyID inID, AudioQueuePropertyListenerProc inProc, void *inUserData); 30 - 31 - virtual OSStatus setOfflineRenderFormat(const AudioStreamBasicDescription *inFormat, const AudioChannelLayout *inLayout) = 0; 32 - virtual OSStatus offlineRender(const AudioTimeStamp *inTimestamp, AudioQueueBufferRef ioBuffer, UInt32 inNumberFrames) = 0; 33 - protected: 34 - AudioStreamBasicDescription m_format; 35 - void* m_userData; 36 - CFRunLoopRef m_runloop; 37 - CFStringRef m_runloopMode; 38 - UInt32 m_flags; 39 - }; 40 - 41 - #endif /* AUDIOQUEUEBASE_H */ 42 - 1 + include/AudioUnit/AudioQueueBase.h
+1 -37
src/AudioUnit/AudioQueueOutput.h
··· 1 - #ifndef AUDIOQUEUEOUTPUT_H 2 - #define AUDIOQUEUEOUTPUT_H 3 - #include "AudioQueueBase.h" 4 - 5 - class AudioQueueOutput : public AudioQueue 6 - { 7 - public: 8 - AudioQueueOutput(const AudioStreamBasicDescription *inFormat, 9 - AudioQueueOutputCallback inCallbackProc, 10 - void *inUserData, CFRunLoopRef inCallbackRunLoop, 11 - CFStringRef inCallbackRunLoopMode, UInt32 inFlags); 12 - 13 - virtual ~AudioQueueOutput(); 14 - 15 - virtual OSStatus start(const AudioTimeStamp *inStartTime) override; 16 - virtual OSStatus prime(UInt32 inNumberOfFramesToPrepare, UInt32 *outNumberOfFramesPrepared) override; 17 - virtual OSStatus flush() override; 18 - virtual OSStatus stop(Boolean inImmediate) override; 19 - virtual OSStatus pause() override; 20 - virtual OSStatus reset() override; 21 - 22 - virtual OSStatus setOfflineRenderFormat(const AudioStreamBasicDescription *inFormat, const AudioChannelLayout *inLayout) override; 23 - virtual OSStatus offlineRender(const AudioTimeStamp *inTimestamp, AudioQueueBufferRef ioBuffer, UInt32 inNumberFrames) override; 24 - 25 - virtual OSStatus dispose(Boolean inImmediate) override; 26 - 27 - static OSStatus create(const AudioStreamBasicDescription *inFormat, 28 - AudioQueueOutputCallback inCallbackProc, 29 - void *inUserData, CFRunLoopRef inCallbackRunLoop, 30 - CFStringRef inCallbackRunLoopMode, UInt32 inFlags, 31 - AudioQueueOutput** newQueue); 32 - private: 33 - AudioQueueOutputCallback m_callback; 34 - }; 35 - 36 - #endif /* AUDIOQUEUEOUTPUT_H */ 37 - 1 + include/AudioUnit/AudioQueueOutput.h
+1 -47
src/AudioUnit/AudioUnit.h
··· 1 - #ifndef AUDIOUNIT_H 2 - #define AUDIOUNIT_H 3 - #include <MacTypes.h> 4 - #include <CoreAudio/CoreAudioTypes.h> 5 - #include "AUComponent.h" 6 - 7 - typedef AudioComponentInstance AudioUnit; 8 - typedef UInt32 AudioUnitRenderActionFlags; 9 - typedef UInt32 AudioUnitElement; 10 - typedef UInt32 AudioUnitScope; 11 - typedef UInt32 AudioUnitPropertyID; 12 - 13 - typedef OSStatus (*AURenderCallback) (void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData); 14 - 15 - enum { 16 - kAudioUnitRenderAction_PreRender = (1 << 2), 17 - kAudioUnitRenderAction_PostRender = (1 << 3), 18 - kAudioUnitRenderAction_OutputIsSilence = (1 << 4), 19 - kAudioOfflineUnitRenderAction_Preflight = (1 << 5), 20 - kAudioOfflineUnitRenderAction_Render = (1 << 6), 21 - kAudioOfflineUnitRenderAction_Complete = (1 << 7), 22 - kAudioUnitRenderAction_PostRenderError = (1 << 8), 23 - kAudioUnitRenderAction_DoNotCheckRenderArgs = (1 << 9) 24 - }; 25 - 26 - extern "C" { 27 - 28 - OSStatus AudioUnitInitialize(AudioUnit inUnit); 29 - OSStatus AudioUnitUninitialize(AudioUnit inUnit); 30 - 31 - OSStatus AudioUnitAddRenderNotify(AudioUnit inUnit, AURenderCallback inProc, void* opaque); 32 - OSStatus AudioUnitRemoveRenderNotify(AudioUnit inUnit, AURenderCallback inProc, void* opaque); 33 - 34 - OSStatus AudioUnitRender(AudioUnit inUnit, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inOutputBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData); 35 - OSStatus AudioUnitReset(AudioUnit inUnit, AudioUnitScope inScope, AudioUnitElement inElement); 36 - 37 - OSStatus AudioUnitGetProperty(AudioUnit inUnit, AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, void* outData, UInt32 *ioDataSize); 38 - OSStatus AudioUnitGetPropertyInfo(AudioUnit inUnit, AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, UInt32 *outDataSize, Boolean *outWritable); 39 - OSStatus AudioUnitSetProperty(AudioUnit inUnit, AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, const void *inData, UInt32 inDataSize); 40 - 41 - OSStatus AudioOutputUnitStart(AudioUnit inUnit); 42 - OSStatus AudioOutputUnitStop(AudioUnit inUnit); 43 - 44 - } 45 - 46 - #endif 47 - 1 + include/AudioUnit/AudioUnit.h
+1 -64
src/AudioUnit/AudioUnitALSA.h
··· 1 - #ifndef AUCOMPONENTINTERNAL_H 2 - #define AUCOMPONENTINTERNAL_H 3 - #include "AudioUnit.h" 4 - #include <CoreServices/ComponentsInternal.h> 5 - #include <asoundlib.h> 6 - #include <dispatch/dispatch.h> 7 - #include <vector> 8 - #include "AudioOutputUnitComponent.h" 9 - 10 - #ifndef kOutputBus 11 - # define kOutputBus 0 // playback 12 - # define kInputBus 1 // recording 13 - #endif 14 - 15 - class AudioUnitALSA : public AudioOutputUnitComponent 16 - { 17 - private: 18 - AudioUnitALSA(int cardIndex, char* cardName); 19 - public: 20 - static AudioUnitComponent* create(int cardIndex); 21 - virtual ~AudioUnitALSA(); 22 - 23 - int cardIndex() const override { return m_cardIndex; } 24 - 25 - OSStatus init() override; 26 - OSStatus deinit() override; 27 - 28 - OSStatus start() override; 29 - OSStatus stop() override; 30 - 31 - OSStatus reset(AudioUnitScope inScope, AudioUnitElement inElement) override; 32 - 33 - OSStatus render(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) override; 34 - private: 35 - void initOutput(); 36 - void initInput(); 37 - 38 - void startOutput(); 39 - void startInput(); 40 - void startDescriptors(const struct pollfd* fds, int count); 41 - 42 - void processAudioEvent(struct pollfd origPoll, int event); 43 - void requestDataForPlayback(); 44 - void pushDataFromInput(); 45 - 46 - OSStatus renderOutput(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 47 - OSStatus renderInterleavedOutput(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 48 - OSStatus renderPlanarOutput(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 49 - 50 - OSStatus renderInput(AudioUnitRenderActionFlags *ioActionFlags,const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 51 - OSStatus renderInterleavedInput(AudioUnitRenderActionFlags *ioActionFlags,const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 52 - OSStatus renderPlanarInput(AudioUnitRenderActionFlags *ioActionFlags,const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 53 - 54 - inline bool isOutputPlanar() const { return m_config[kOutputBus].second.mFormatFlags & kAudioFormatFlagIsNonInterleaved; } 55 - inline bool isInputPlanar() const { return m_config[kInputBus].first.mFormatFlags & kAudioFormatFlagIsNonInterleaved; } 56 - private: 57 - int m_cardIndex; 58 - char* m_cardName; 59 - snd_pcm_t *m_pcmOutput, *m_pcmInput; 60 - std::vector<dispatch_source_t> m_sources; 61 - }; 62 - 63 - #endif 64 - 1 + include/AudioUnit/AudioUnitALSA.h
+1 -46
src/AudioUnit/AudioUnitBase.h
··· 1 - #ifndef AUDIOUNITBASE_H 2 - #define AUDIOUNITBASE_H 3 - 4 - #include "AudioUnit.h" 5 - #include "AudioUnitProperties.h" 6 - #include <vector> 7 - #include <set> 8 - #include <mutex> 9 - #include <CoreFoundation/CFString.h> 10 - #include <CoreServices/ComponentsInternal.h> 11 - 12 - class AudioUnitComponent : public CarbonComponent 13 - { 14 - protected: 15 - AudioUnitComponent(std::initializer_list<CFStringRef> elements); 16 - public: 17 - virtual ~AudioUnitComponent(); 18 - 19 - virtual OSStatus init() = 0; 20 - virtual OSStatus deinit() = 0; 21 - 22 - virtual OSStatus reset(AudioUnitScope inScope, AudioUnitElement inElement) = 0; 23 - 24 - virtual OSStatus render(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) = 0; 25 - 26 - virtual OSStatus setProperty(AudioUnitPropertyID prop, AudioUnitScope scope, AudioUnitElement elem, const void* data, UInt32 dataSize); 27 - virtual OSStatus getProperty(AudioUnitPropertyID prop, AudioUnitScope scope, AudioUnitElement elem, void* data, UInt32* dataSize); 28 - virtual OSStatus getPropertyInfo(AudioUnitPropertyID prop, AudioUnitScope scope, AudioUnitElement elem, UInt32* dataSize, Boolean* writable); 29 - 30 - OSStatus addRenderNotify(AURenderCallback inProc, void* opaque); 31 - OSStatus removeRenderNotify(AURenderCallback inProc, void* opaque); 32 - OSStatus notifyListeners(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData); 33 - protected: 34 - std::vector<CFStringRef> m_elementNames; 35 - std::vector<std::pair<AudioStreamBasicDescription, AudioStreamBasicDescription>> m_config; 36 - //AudioStreamBasicDescription m_configOutputPlayback, m_configInputPlayback, m_configInputCapture, m_configOutputCapture; 37 - AudioUnitConnection m_inputUnit; 38 - bool m_shouldAllocateBuffer = true; 39 - OSStatus m_lastRenderError = 0; 40 - CFStringRef m_contextName = nullptr; 41 - std::mutex m_listenersMutex; 42 - std::set<std::pair<AURenderCallback, void*>> m_listeners; 43 - }; 44 - 45 - #endif 46 - 1 + include/AudioUnit/AudioUnitBase.h
+1 -66
src/AudioUnit/AudioUnitPA.h
··· 1 - #ifndef AUDIOUNITPA_H 2 - #define AUDIOUNITPA_H 3 - #include "AudioOutputUnitComponent.h" 4 - #include <pulse/pulseaudio.h> 5 - #include <thread> 6 - 7 - #ifndef kOutputBus 8 - # define kOutputBus 0 // playback 9 - # define kInputBus 1 // recording 10 - #endif 11 - 12 - class AudioUnitPA : public AudioOutputUnitComponent 13 - { 14 - public: 15 - AudioUnitPA(); 16 - virtual ~AudioUnitPA(); 17 - 18 - OSStatus init() override; 19 - OSStatus deinit() override; 20 - 21 - OSStatus start() override; 22 - OSStatus stop() override; 23 - 24 - OSStatus reset(AudioUnitScope inScope, AudioUnitElement inElement) override; 25 - 26 - OSStatus render(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) override; 27 - 28 - int cardIndex() const override; 29 - private: 30 - OSStatus initOutput(); 31 - private: 32 - static void initializePA(); 33 - static void deinitializePA(); 34 - static void paContextStateCB(pa_context* c, void*); 35 - static void paStreamStateCB(pa_stream* s, void*); 36 - static void paStreamWriteCB(pa_stream* s, size_t length, void*); 37 - static std::string getAppName(); 38 - pa_sample_spec paSampleSpecForASBD(const AudioStreamBasicDescription& asbd); 39 - 40 - void requestDataForPlayback(size_t length); 41 - 42 - inline bool isOutputPlanar() const { return m_config[kOutputBus].second.mFormatFlags & kAudioFormatFlagIsNonInterleaved; } 43 - inline bool isInputPlanar() const { return m_config[kInputBus].first.mFormatFlags & kAudioFormatFlagIsNonInterleaved; } 44 - 45 - OSStatus renderOutput(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 46 - OSStatus renderInterleavedOutput(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 47 - OSStatus renderPlanarOutput(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 48 - 49 - OSStatus renderInput(AudioUnitRenderActionFlags *ioActionFlags,const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 50 - OSStatus renderInterleavedInput(AudioUnitRenderActionFlags *ioActionFlags,const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 51 - OSStatus renderPlanarInput(AudioUnitRenderActionFlags *ioActionFlags,const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 52 - private: 53 - static pa_mainloop* m_mainloop; 54 - static pa_context* m_context; 55 - static std::thread* m_mainloopThread; 56 - private: 57 - pa_stream* m_stream; 58 - 59 - // PulseAudio supports only unsigned 8-bit PCM and only signed >8-bit PCM. 60 - // We need to perform conversion of samples if input/output differs. 61 - bool m_convertUnsignedSigned = false; 62 - bool m_started = false; 63 - }; 64 - 65 - #endif /* AUDIOUNITPA_H */ 66 - 1 + include/AudioUnit/AudioUnitPA.h
+1 -71
src/AudioUnit/AudioUnitProperties.h
··· 1 - #ifndef AUDIOUNITPROPERTIES_H 2 - #define AUDIOUNITPROPERTIES_H 3 - 4 - enum { 5 - kAudioOutputUnitProperty_CurrentDevice = 2000, 6 - kAudioOutputUnitProperty_ChannelMap = 2002, 7 - kAudioOutputUnitProperty_EnableIO = 2003, 8 - kAudioOutputUnitProperty_StartTime = 2004, 9 - kAudioOutputUnitProperty_SetInputCallback = 2005, 10 - kAudioOutputUnitProperty_HasIO = 2006, 11 - kAudioOutputUnitProperty_StartTimestampsAtZero = 2007 12 - }; 13 - 14 - enum { 15 - kAudioUnitScope_Global = 0, 16 - kAudioUnitScope_Input = 1, 17 - kAudioUnitScope_Output = 2, 18 - kAudioUnitScope_Group = 3, 19 - kAudioUnitScope_Part = 4, 20 - kAudioUnitScope_Note = 5, 21 - kAudioUnitScope_Layer = 6, 22 - kAudioUnitScope_LayerItem = 7 23 - }; 24 - 25 - enum 26 - { 27 - kAudioUnitProperty_ClassInfo = 0, 28 - kAudioUnitProperty_MakeConnection = 1, 29 - kAudioUnitProperty_SampleRate = 2, 30 - kAudioUnitProperty_ParameterList = 3, 31 - kAudioUnitProperty_ParameterInfo = 4, 32 - kAudioUnitProperty_CPULoad = 6, 33 - kAudioUnitProperty_StreamFormat = 8, 34 - kAudioUnitProperty_ElementCount = 11, 35 - kAudioUnitProperty_Latency = 12, 36 - kAudioUnitProperty_SupportedNumChannels = 13, 37 - kAudioUnitProperty_MaximumFramesPerSlice = 14, 38 - kAudioUnitProperty_ParameterValueStrings = 16, 39 - kAudioUnitProperty_AudioChannelLayout = 19, 40 - kAudioUnitProperty_TailTime = 20, 41 - kAudioUnitProperty_BypassEffect = 21, 42 - kAudioUnitProperty_LastRenderError = 22, 43 - kAudioUnitProperty_SetRenderCallback = 23, 44 - kAudioUnitProperty_FactoryPresets = 24, 45 - kAudioUnitProperty_ContextName = 25, 46 - kAudioUnitProperty_RenderQuality = 26, 47 - kAudioUnitProperty_InPlaceProcessing = 29, 48 - kAudioUnitProperty_ElementName = 30, 49 - kAudioUnitProperty_SupportedChannelLayoutTags = 32, 50 - kAudioUnitProperty_PresentPreset = 36, 51 - kAudioUnitProperty_ShouldAllocateBuffer = 51, 52 - kAudioUnitProperty_ParameterHistoryInfo = 53 53 - }; 54 - 55 - struct AURenderCallbackStruct 56 - { 57 - AURenderCallback inputProc; 58 - void *inputProcRefCon; 59 - }; 60 - typedef struct AURenderCallbackStruct AURenderCallbackStruct; 61 - 62 - struct AudioUnitConnection 63 - { 64 - AudioUnit sourceAudioUnit; 65 - UInt32 sourceOutputNumber; 66 - UInt32 destInputNumber; 67 - }; 68 - typedef struct AudioUnitConnection AudioUnitConnection; 69 - 70 - #endif 71 - 1 + include/AudioUnit/AudioUnitProperties.h
+1 -20
src/AudioUnit/AudioUnitRenderer.h
··· 1 - #ifndef AUDIOUNITRENDERER_H 2 - #define AUDIOUNITRENDERER_H 3 - #include "AudioUnitBase.h" 4 - 5 - // Wraps AURenderCallbackStruct 6 - class AudioUnitRenderer : public AudioUnitComponent 7 - { 8 - public: 9 - AudioUnitRenderer(const AURenderCallbackStruct& cb); 10 - OSStatus init() override; 11 - OSStatus deinit() override; 12 - 13 - OSStatus reset(AudioUnitScope inScope, AudioUnitElement inElement) override; 14 - 15 - OSStatus render(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) override; 16 - private: 17 - AURenderCallbackStruct m_renderCallback; 18 - }; 19 - 20 - #endif 1 + include/AudioUnit/AudioUnitRenderer.h
-1
src/AudioUnit/Availability.h
··· 1 - ../../platform-include/Availability.h
-1
src/AudioUnit/AvailabilityInternal.h
··· 1 - ../../platform-include/AvailabilityInternal.h
-1
src/AudioUnit/AvailabilityMacros.h
··· 1 - ../../platform-include/AvailabilityMacros.h
+41
src/AudioUnit/include/AudioUnit/AUComponent.h
··· 1 + #ifndef AUCOMPONENT_H 2 + #define AUCOMPONENT_H 3 + #include <MacTypes.h> 4 + #include <CoreServices/Components.h> 5 + #include <CoreFoundation/CFString.h> 6 + 7 + class AudioUnitComponent; 8 + 9 + typedef Component AudioComponent; 10 + typedef AudioUnitComponent* AudioComponentInstance; 11 + typedef ComponentDescription AudioComponentDescription; 12 + 13 + enum 14 + { 15 + kAudioUnitType_Output = 'auou', 16 + kAudioUnitType_MusicDevice = 'aumu', 17 + kAudioUnitType_MusicEffect = 'aumf', 18 + kAudioUnitType_FormatConverter = 'aufc', 19 + kAudioUnitType_Effect = 'aufx', 20 + kAudioUnitType_Mixer = 'aumx', 21 + kAudioUnitType_Panner = 'aupn', 22 + kAudioUnitType_Generator = 'augn', 23 + kAudioUnitType_OfflineEffect = 'auol' 24 + }; 25 + 26 + extern "C" { 27 + 28 + AudioComponent AudioComponentFindNext(AudioComponent inAComponent, AudioComponentDescription *inDesc); 29 + OSStatus AudioComponentGetDescription(AudioComponent inComponent, AudioComponentDescription *outDesc); 30 + OSStatus AudioComponentGetVersion(AudioComponent inComponent, UInt32 *outVersion); 31 + Boolean AudioComponentInstanceCanDo(AudioComponentInstance inInstance, SInt16 inSelectorID); 32 + OSStatus AudioComponentInstanceDispose(AudioComponentInstance inInstance); 33 + AudioComponent AudioComponentInstanceGetComponent(AudioComponentInstance inInstance); 34 + OSStatus AudioComponentInstanceNew(AudioComponent inComponent, AudioComponentInstance *outInstance); 35 + OSStatus AudioComponentCopyName(AudioComponent inComponent, CFStringRef *outName); 36 + UInt32 AudioComponentCount(AudioComponentDescription *inDesc); 37 + 38 + } 39 + 40 + #endif 41 +
+78
src/AudioUnit/include/AudioUnit/AUGraph.h
··· 1 + #ifndef AUGRAPH_H 2 + #define AUGRAPH_H 3 + #include "AudioUnit.h" 4 + #include "AudioUnitProperties.h" 5 + 6 + #ifdef __cplusplus 7 + extern "C" { 8 + #endif 9 + 10 + typedef struct AUGraphData* AUGraph; 11 + typedef SInt32 AUNode; 12 + 13 + struct AudioUnitNodeConnection 14 + { 15 + AUNode sourceNode; 16 + UInt32 sourceOutputNumber; 17 + AUNode destNode; 18 + UInt32 destInputNumber; 19 + }; 20 + 21 + typedef struct AudioUnitNodeConnection AudioUnitNodeConnection; 22 + typedef struct AudioUnitNodeConnection AUNodeConnection; 23 + 24 + struct AUNodeRenderCallback 25 + { 26 + AUNode destNode; 27 + AudioUnitElement destInputNumber; 28 + AURenderCallbackStruct cback; 29 + }; 30 + typedef struct AUNodeRenderCallback AUNodeRenderCallback; 31 + 32 + struct AUNodeInteraction 33 + { 34 + UInt32 nodeInteractionType; 35 + union 36 + { 37 + AUNodeConnection connection; 38 + AUNodeRenderCallback inputCallback; 39 + } nodeInteraction; 40 + }; 41 + typedef struct AUNodeInteraction AUNodeInteraction; 42 + 43 + OSStatus AUGraphAddNode(AUGraph inGraph, const AudioComponentDescription *inDescription, AUNode *outNode); 44 + OSStatus AUGraphAddRenderNotify(AUGraph inGraph, AURenderCallback inCallback, void *inRefCon); 45 + OSStatus AUGraphClearConnections(AUGraph inGraph); 46 + OSStatus AUGraphClose(AUGraph inGraph); 47 + OSStatus AUGraphConnectNodeInput(AUGraph inGraph, AUNode inSourceNode, UInt32 inSourceOutputNumber, AUNode inDestNode, UInt32 inDestInputNumber); 48 + OSStatus AUGraphCountNodeInteractions(AUGraph inGraph, AUNode inNode, UInt32 *outNumInteractions); 49 + OSStatus AUGraphDisconnectNodeInput(AUGraph inGraph, AUNode inDestNode, UInt32 inDestInputNumber); 50 + OSStatus AUGraphGetCPULoad(AUGraph inGraph, Float32 *outAverageCPULoad); 51 + OSStatus AUGraphGetIndNode(AUGraph inGraph, UInt32 inIndex, AUNode *outNode); 52 + OSStatus AUGraphGetInteractionInfo(AUGraph inGraph, UInt32 inInteractionIndex, AUNodeInteraction *outInteraction); 53 + OSStatus AUGraphGetMaxCPULoad(AUGraph inGraph, Float32 *outMaxLoad); 54 + OSStatus AUGraphGetNodeCount(AUGraph inGraph, UInt32 *outNumberOfNodes); 55 + OSStatus AUGraphGetNodeInteractions(AUGraph inGraph, AUNode inNode, UInt32 *ioNumInteractions, AUNodeInteraction *outInteractions); 56 + OSStatus AUGraphGetNumberOfInteractions(AUGraph inGraph, UInt32 *outNumInteractions); 57 + OSStatus AUGraphInitialize(AUGraph inGraph); 58 + OSStatus AUGraphIsInitialized(AUGraph inGraph, Boolean *outIsInitialized); 59 + OSStatus AUGraphIsOpen(AUGraph inGraph, Boolean *outIsOpen); 60 + OSStatus AUGraphIsRunning(AUGraph inGraph, Boolean *outIsRunning); 61 + OSStatus AUGraphNodeInfo(AUGraph inGraph, AUNode inNode, AudioComponentDescription *outDescription, AudioUnit *outAudioUnit); 62 + OSStatus AUGraphOpen(AUGraph inGraph); 63 + OSStatus AUGraphRemoveNode(AUGraph inGraph, AUNode inNode); 64 + OSStatus AUGraphRemoveRenderNotify(AUGraph inGraph, AURenderCallback inCallback, void *inRefCon); 65 + OSStatus AUGraphSetNodeInputCallback(AUGraph inGraph, AUNode inDestNode, UInt32 inDestInputNumber, const AURenderCallbackStruct *inInputCallback); 66 + OSStatus AUGraphStart(AUGraph inGraph); 67 + OSStatus AUGraphStop(AUGraph inGraph); 68 + OSStatus AUGraphUninitialize(AUGraph inGraph); 69 + OSStatus AUGraphUpdate(AUGraph inGraph, Boolean *outIsUpdated); 70 + OSStatus DisposeAUGraph(AUGraph inGraph); 71 + OSStatus NewAUGraph(AUGraph *outGraph); 72 + 73 + #ifdef __cplusplus 74 + } 75 + #endif 76 + 77 + 78 + #endif
+23
src/AudioUnit/include/AudioUnit/AudioOutputUnitComponent.h
··· 1 + #ifndef AOUCOMPONENT_H 2 + #define AOUCOMPONENT_H 3 + #include "AudioUnitBase.h" 4 + 5 + class AudioOutputUnitComponent : public AudioUnitComponent 6 + { 7 + public: 8 + AudioOutputUnitComponent(); 9 + 10 + virtual OSStatus setProperty(AudioUnitPropertyID prop, AudioUnitScope scope, AudioUnitElement elem, const void* data, UInt32 dataSize) override; 11 + virtual OSStatus getProperty(AudioUnitPropertyID prop, AudioUnitScope scope, AudioUnitElement elem, void* data, UInt32* dataSize) override; 12 + virtual OSStatus getPropertyInfo(AudioUnitPropertyID prop, AudioUnitScope scope, AudioUnitElement elem, UInt32* dataSize, Boolean* writable) override; 13 + 14 + virtual OSStatus start() = 0; 15 + virtual OSStatus stop() = 0; 16 + 17 + virtual int cardIndex() const = 0; 18 + protected: 19 + bool m_enableOutput = true, m_enableInput = false; 20 + AURenderCallbackStruct m_outputCallback; 21 + }; 22 + 23 + #endif
+108
src/AudioUnit/include/AudioUnit/AudioQueue.h
··· 1 + #ifndef AUDIOBUFFER_H 2 + #define AUDIOBUFFER_H 3 + #include <CoreAudio/CoreAudioTypes.h> 4 + #include <CoreServices/MacTypes.h> 5 + #include <CoreFoundation/CFString.h> 6 + #include <CoreFoundation/CFRunLoop.h> 7 + 8 + #ifdef __cplusplus 9 + extern "C" { 10 + #endif 11 + 12 + typedef UInt32 AudioQueuePropertyID; 13 + typedef UInt32 AudioQueueParameterID; 14 + typedef Float32 AudioQueueParameterValue; 15 + 16 + struct AudioQueueParameterEvent 17 + { 18 + AudioQueueParameterID mID; 19 + AudioQueueParameterValue mValue; 20 + }; 21 + 22 + class AudioQueue; 23 + typedef AudioQueue* AudioQueueRef; 24 + 25 + struct AudioQueueBuffer 26 + { 27 + const UInt32 mAudioDataBytesCapacity; 28 + void* mAudioData; 29 + UInt32 mAudioDataByteSize; 30 + void* mUserData; 31 + 32 + UInt32 mPacketDescriptionCapacity; 33 + AudioStreamPacketDescription* mPacketDescriptions; 34 + UInt32 mPacketDescriptionCount; 35 + }; 36 + typedef AudioQueueBuffer* AudioQueueBufferRef; 37 + 38 + OSStatus AudioQueueStart(AudioQueueRef inAQ, const AudioTimeStamp *inStartTime); 39 + OSStatus AudioQueuePrime(AudioQueueRef inAQ, UInt32 inNumberOfFramesToPrepare, UInt32 *outNumberOfFramesPrepared); 40 + OSStatus AudioQueueFlush(AudioQueueRef inAQ); 41 + OSStatus AudioQueueStop(AudioQueueRef inAQ, Boolean inImmediate); 42 + OSStatus AudioQueuePause(AudioQueueRef inAQ); 43 + OSStatus AudioQueueReset(AudioQueueRef inAQ); 44 + 45 + typedef void (*AudioQueueOutputCallback)(void* inUserData, AudioQueueRef inAQ, 46 + AudioQueueBufferRef inBuffer); 47 + OSStatus AudioQueueNewOutput(const AudioStreamBasicDescription *inFormat, 48 + AudioQueueOutputCallback inCallbackProc, 49 + void *inUserData, CFRunLoopRef inCallbackRunLoop, 50 + CFStringRef inCallbackRunLoopMode, UInt32 inFlags, 51 + AudioQueueRef *outAQ); 52 + 53 + typedef void (*AudioQueueInputCallback)(void* inUserData, AudioQueueRef inAQ, 54 + AudioQueueBufferRef inBuffer, const AudioTimeStamp* inStartTime, 55 + UInt32 inNumberPacketDescriptions, 56 + const AudioStreamPacketDescription* inPacketDescs); 57 + OSStatus AudioQueueNewInput(const AudioStreamBasicDescription *inFormat, 58 + AudioQueueInputCallback inCallbackProc, 59 + void *inUserData, CFRunLoopRef inCallbackRunLoop, 60 + CFStringRef inCallbackRunLoopMode, UInt32 inFlags, 61 + AudioQueueRef *outAQ); 62 + 63 + OSStatus AudioQueueDispose(AudioQueueRef inAQ, Boolean inImmediate); 64 + 65 + OSStatus AudioQueueGetParameter(AudioQueueRef inAQ, AudioQueueParameterID inParamID, AudioQueueParameterValue *outValue); 66 + OSStatus AudioQueueSetParameter(AudioQueueRef inAQ, AudioQueueParameterID inParamID, AudioQueueParameterValue inValue); 67 + 68 + OSStatus AudioQueueGetProperty(AudioQueueRef inAQ, AudioQueuePropertyID inID, void *outData, UInt32 *ioDataSize); 69 + OSStatus AudioQueueSetProperty(AudioQueueRef inAQ, AudioQueuePropertyID inID, const void *inData, UInt32 inDataSize); 70 + OSStatus AudioQueueGetPropertySize(AudioQueueRef inAQ, AudioQueuePropertyID inID, UInt32 *outDataSize); 71 + 72 + typedef void (*AudioQueuePropertyListenerProc)(void* inUserData, AudioQueueRef inAQ, AudioQueuePropertyID inID); 73 + OSStatus AudioQueueAddPropertyListener(AudioQueueRef inAQ, AudioQueuePropertyID inID, AudioQueuePropertyListenerProc inProc, void *inUserData); 74 + OSStatus AudioQueueRemovePropertyListener(AudioQueueRef inAQ, AudioQueuePropertyID inID, AudioQueuePropertyListenerProc inProc, void *inUserData); 75 + 76 + OSStatus AudioQueueSetOfflineRenderFormat(AudioQueueRef inAQ, const AudioStreamBasicDescription *inFormat, const AudioChannelLayout *inLayout); 77 + OSStatus AudioQueueOfflineRender(AudioQueueRef inAQ, const AudioTimeStamp *inTimestamp, AudioQueueBufferRef ioBuffer, UInt32 inNumberFrames); 78 + 79 + OSStatus AudioQueueAllocateBuffer(AudioQueueRef inAQ, UInt32 inBufferByteSize, AudioQueueBufferRef *outBuffer); 80 + OSStatus AudioQueueAllocateBufferWithPacketDescriptions(AudioQueueRef inAQ, 81 + UInt32 inBufferByteSize, UInt32 inNumberPacketDescriptions, 82 + AudioQueueBufferRef *outBuffer); 83 + OSStatus AudioQueueFreeBuffer(AudioQueueRef inAQ, AudioQueueBufferRef inBuffer); 84 + OSStatus AudioQueueEnqueueBuffer(AudioQueueRef inAQ, AudioQueueBufferRef inBuffer, 85 + UInt32 inNumPacketDescs, const AudioStreamPacketDescription *inPacketDescs); 86 + OSStatus AudioQueueEnqueueBufferWithParameters(AudioQueueRef inAQ, 87 + AudioQueueBufferRef inBuffer, UInt32 inNumPacketDescs, 88 + const AudioStreamPacketDescription *inPacketDescs, 89 + UInt32 inTrimFramesAtStart, UInt32 inTrimFramesAtEnd, 90 + UInt32 inNumParamValues, const AudioQueueParameterEvent *inParamValues, 91 + const AudioTimeStamp *inStartTime, AudioTimeStamp *outActualStartTime); 92 + 93 + class AudioQueueTimeline; 94 + typedef AudioQueueTimeline* AudioQueueTimelineRef; 95 + 96 + OSStatus AudioQueueCreateTimeline(AudioQueueRef inAQ, AudioQueueTimelineRef *outTimeline); 97 + OSStatus AudioQueueDisposeTimeline(AudioQueueRef inAQ, AudioQueueTimelineRef inTimeline); 98 + OSStatus AudioQueueDeviceGetCurrentTime(AudioQueueRef inAQ, AudioTimeStamp *outTimeStamp); 99 + OSStatus AudioQueueDeviceGetNearestStartTime(AudioQueueRef inAQ, AudioTimeStamp *ioRequestedStartTime, UInt32 inFlags); 100 + OSStatus AudioQueueDeviceTranslateTime(AudioQueueRef inAQ, const AudioTimeStamp *inTime, AudioTimeStamp *outTime); 101 + OSStatus AudioQueueGetCurrentTime(AudioQueueRef inAQ, AudioQueueTimelineRef inTimeline, AudioTimeStamp *outTimeStamp, Boolean *outTimelineDiscontinuity); 102 + 103 + #ifdef __cplusplus 104 + } 105 + #endif 106 + 107 + #endif /* AUDIOBUFFER_H */ 108 +
+42
src/AudioUnit/include/AudioUnit/AudioQueueBase.h
··· 1 + #ifndef AUDIOQUEUEBASE_H 2 + #define AUDIOQUEUEBASE_H 3 + #include "AudioQueue.h" 4 + 5 + class AudioQueue 6 + { 7 + public: 8 + AudioQueue(const AudioStreamBasicDescription* format, void* userData, 9 + CFRunLoopRef runloop, CFStringRef runloopMode, UInt32 flags); 10 + virtual ~AudioQueue(); 11 + 12 + virtual OSStatus start(const AudioTimeStamp *inStartTime) = 0; 13 + virtual OSStatus prime(UInt32 inNumberOfFramesToPrepare, UInt32 *outNumberOfFramesPrepared) = 0; 14 + virtual OSStatus flush() = 0; 15 + virtual OSStatus stop(Boolean inImmediate) = 0; 16 + virtual OSStatus pause() = 0; 17 + virtual OSStatus reset() = 0; 18 + 19 + virtual OSStatus dispose(Boolean inImmediate) = 0; 20 + 21 + virtual OSStatus getParameter(AudioQueueParameterID inParamID, AudioQueueParameterValue *outValue); 22 + virtual OSStatus setParameter(AudioQueueParameterID inParamID, AudioQueueParameterValue inValue); 23 + 24 + virtual OSStatus getProperty(AudioQueuePropertyID inID, void *outData, UInt32 *ioDataSize); 25 + virtual OSStatus setProperty(AudioQueuePropertyID inID, const void *inData, UInt32 inDataSize); 26 + virtual OSStatus getPropertySize(AudioQueuePropertyID inID, UInt32 *outDataSize); 27 + 28 + OSStatus addPropertyListener(AudioQueuePropertyID inID, AudioQueuePropertyListenerProc inProc, void *inUserData); 29 + OSStatus removePropertyListener(AudioQueuePropertyID inID, AudioQueuePropertyListenerProc inProc, void *inUserData); 30 + 31 + virtual OSStatus setOfflineRenderFormat(const AudioStreamBasicDescription *inFormat, const AudioChannelLayout *inLayout) = 0; 32 + virtual OSStatus offlineRender(const AudioTimeStamp *inTimestamp, AudioQueueBufferRef ioBuffer, UInt32 inNumberFrames) = 0; 33 + protected: 34 + AudioStreamBasicDescription m_format; 35 + void* m_userData; 36 + CFRunLoopRef m_runloop; 37 + CFStringRef m_runloopMode; 38 + UInt32 m_flags; 39 + }; 40 + 41 + #endif /* AUDIOQUEUEBASE_H */ 42 +
+37
src/AudioUnit/include/AudioUnit/AudioQueueOutput.h
··· 1 + #ifndef AUDIOQUEUEOUTPUT_H 2 + #define AUDIOQUEUEOUTPUT_H 3 + #include "AudioQueueBase.h" 4 + 5 + class AudioQueueOutput : public AudioQueue 6 + { 7 + public: 8 + AudioQueueOutput(const AudioStreamBasicDescription *inFormat, 9 + AudioQueueOutputCallback inCallbackProc, 10 + void *inUserData, CFRunLoopRef inCallbackRunLoop, 11 + CFStringRef inCallbackRunLoopMode, UInt32 inFlags); 12 + 13 + virtual ~AudioQueueOutput(); 14 + 15 + virtual OSStatus start(const AudioTimeStamp *inStartTime) override; 16 + virtual OSStatus prime(UInt32 inNumberOfFramesToPrepare, UInt32 *outNumberOfFramesPrepared) override; 17 + virtual OSStatus flush() override; 18 + virtual OSStatus stop(Boolean inImmediate) override; 19 + virtual OSStatus pause() override; 20 + virtual OSStatus reset() override; 21 + 22 + virtual OSStatus setOfflineRenderFormat(const AudioStreamBasicDescription *inFormat, const AudioChannelLayout *inLayout) override; 23 + virtual OSStatus offlineRender(const AudioTimeStamp *inTimestamp, AudioQueueBufferRef ioBuffer, UInt32 inNumberFrames) override; 24 + 25 + virtual OSStatus dispose(Boolean inImmediate) override; 26 + 27 + static OSStatus create(const AudioStreamBasicDescription *inFormat, 28 + AudioQueueOutputCallback inCallbackProc, 29 + void *inUserData, CFRunLoopRef inCallbackRunLoop, 30 + CFStringRef inCallbackRunLoopMode, UInt32 inFlags, 31 + AudioQueueOutput** newQueue); 32 + private: 33 + AudioQueueOutputCallback m_callback; 34 + }; 35 + 36 + #endif /* AUDIOQUEUEOUTPUT_H */ 37 +
+47
src/AudioUnit/include/AudioUnit/AudioUnit.h
··· 1 + #ifndef AUDIOUNIT_H 2 + #define AUDIOUNIT_H 3 + #include <MacTypes.h> 4 + #include <CoreAudio/CoreAudioTypes.h> 5 + #include "AUComponent.h" 6 + 7 + typedef AudioComponentInstance AudioUnit; 8 + typedef UInt32 AudioUnitRenderActionFlags; 9 + typedef UInt32 AudioUnitElement; 10 + typedef UInt32 AudioUnitScope; 11 + typedef UInt32 AudioUnitPropertyID; 12 + 13 + typedef OSStatus (*AURenderCallback) (void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData); 14 + 15 + enum { 16 + kAudioUnitRenderAction_PreRender = (1 << 2), 17 + kAudioUnitRenderAction_PostRender = (1 << 3), 18 + kAudioUnitRenderAction_OutputIsSilence = (1 << 4), 19 + kAudioOfflineUnitRenderAction_Preflight = (1 << 5), 20 + kAudioOfflineUnitRenderAction_Render = (1 << 6), 21 + kAudioOfflineUnitRenderAction_Complete = (1 << 7), 22 + kAudioUnitRenderAction_PostRenderError = (1 << 8), 23 + kAudioUnitRenderAction_DoNotCheckRenderArgs = (1 << 9) 24 + }; 25 + 26 + extern "C" { 27 + 28 + OSStatus AudioUnitInitialize(AudioUnit inUnit); 29 + OSStatus AudioUnitUninitialize(AudioUnit inUnit); 30 + 31 + OSStatus AudioUnitAddRenderNotify(AudioUnit inUnit, AURenderCallback inProc, void* opaque); 32 + OSStatus AudioUnitRemoveRenderNotify(AudioUnit inUnit, AURenderCallback inProc, void* opaque); 33 + 34 + OSStatus AudioUnitRender(AudioUnit inUnit, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inOutputBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData); 35 + OSStatus AudioUnitReset(AudioUnit inUnit, AudioUnitScope inScope, AudioUnitElement inElement); 36 + 37 + OSStatus AudioUnitGetProperty(AudioUnit inUnit, AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, void* outData, UInt32 *ioDataSize); 38 + OSStatus AudioUnitGetPropertyInfo(AudioUnit inUnit, AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, UInt32 *outDataSize, Boolean *outWritable); 39 + OSStatus AudioUnitSetProperty(AudioUnit inUnit, AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, const void *inData, UInt32 inDataSize); 40 + 41 + OSStatus AudioOutputUnitStart(AudioUnit inUnit); 42 + OSStatus AudioOutputUnitStop(AudioUnit inUnit); 43 + 44 + } 45 + 46 + #endif 47 +
+64
src/AudioUnit/include/AudioUnit/AudioUnitALSA.h
··· 1 + #ifndef AUCOMPONENTINTERNAL_H 2 + #define AUCOMPONENTINTERNAL_H 3 + #include "AudioUnit.h" 4 + #include <CoreServices/ComponentsInternal.h> 5 + #include <asoundlib.h> 6 + #include <dispatch/dispatch.h> 7 + #include <vector> 8 + #include "AudioOutputUnitComponent.h" 9 + 10 + #ifndef kOutputBus 11 + # define kOutputBus 0 // playback 12 + # define kInputBus 1 // recording 13 + #endif 14 + 15 + class AudioUnitALSA : public AudioOutputUnitComponent 16 + { 17 + private: 18 + AudioUnitALSA(int cardIndex, char* cardName); 19 + public: 20 + static AudioUnitComponent* create(int cardIndex); 21 + virtual ~AudioUnitALSA(); 22 + 23 + int cardIndex() const override { return m_cardIndex; } 24 + 25 + OSStatus init() override; 26 + OSStatus deinit() override; 27 + 28 + OSStatus start() override; 29 + OSStatus stop() override; 30 + 31 + OSStatus reset(AudioUnitScope inScope, AudioUnitElement inElement) override; 32 + 33 + OSStatus render(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) override; 34 + private: 35 + void initOutput(); 36 + void initInput(); 37 + 38 + void startOutput(); 39 + void startInput(); 40 + void startDescriptors(const struct pollfd* fds, int count); 41 + 42 + void processAudioEvent(struct pollfd origPoll, int event); 43 + void requestDataForPlayback(); 44 + void pushDataFromInput(); 45 + 46 + OSStatus renderOutput(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 47 + OSStatus renderInterleavedOutput(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 48 + OSStatus renderPlanarOutput(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 49 + 50 + OSStatus renderInput(AudioUnitRenderActionFlags *ioActionFlags,const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 51 + OSStatus renderInterleavedInput(AudioUnitRenderActionFlags *ioActionFlags,const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 52 + OSStatus renderPlanarInput(AudioUnitRenderActionFlags *ioActionFlags,const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 53 + 54 + inline bool isOutputPlanar() const { return m_config[kOutputBus].second.mFormatFlags & kAudioFormatFlagIsNonInterleaved; } 55 + inline bool isInputPlanar() const { return m_config[kInputBus].first.mFormatFlags & kAudioFormatFlagIsNonInterleaved; } 56 + private: 57 + int m_cardIndex; 58 + char* m_cardName; 59 + snd_pcm_t *m_pcmOutput, *m_pcmInput; 60 + std::vector<dispatch_source_t> m_sources; 61 + }; 62 + 63 + #endif 64 +
+46
src/AudioUnit/include/AudioUnit/AudioUnitBase.h
··· 1 + #ifndef AUDIOUNITBASE_H 2 + #define AUDIOUNITBASE_H 3 + 4 + #include "AudioUnit.h" 5 + #include "AudioUnitProperties.h" 6 + #include <vector> 7 + #include <set> 8 + #include <mutex> 9 + #include <CoreFoundation/CFString.h> 10 + #include <CoreServices/ComponentsInternal.h> 11 + 12 + class AudioUnitComponent : public CarbonComponent 13 + { 14 + protected: 15 + AudioUnitComponent(std::initializer_list<CFStringRef> elements); 16 + public: 17 + virtual ~AudioUnitComponent(); 18 + 19 + virtual OSStatus init() = 0; 20 + virtual OSStatus deinit() = 0; 21 + 22 + virtual OSStatus reset(AudioUnitScope inScope, AudioUnitElement inElement) = 0; 23 + 24 + virtual OSStatus render(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) = 0; 25 + 26 + virtual OSStatus setProperty(AudioUnitPropertyID prop, AudioUnitScope scope, AudioUnitElement elem, const void* data, UInt32 dataSize); 27 + virtual OSStatus getProperty(AudioUnitPropertyID prop, AudioUnitScope scope, AudioUnitElement elem, void* data, UInt32* dataSize); 28 + virtual OSStatus getPropertyInfo(AudioUnitPropertyID prop, AudioUnitScope scope, AudioUnitElement elem, UInt32* dataSize, Boolean* writable); 29 + 30 + OSStatus addRenderNotify(AURenderCallback inProc, void* opaque); 31 + OSStatus removeRenderNotify(AURenderCallback inProc, void* opaque); 32 + OSStatus notifyListeners(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData); 33 + protected: 34 + std::vector<CFStringRef> m_elementNames; 35 + std::vector<std::pair<AudioStreamBasicDescription, AudioStreamBasicDescription>> m_config; 36 + //AudioStreamBasicDescription m_configOutputPlayback, m_configInputPlayback, m_configInputCapture, m_configOutputCapture; 37 + AudioUnitConnection m_inputUnit; 38 + bool m_shouldAllocateBuffer = true; 39 + OSStatus m_lastRenderError = 0; 40 + CFStringRef m_contextName = nullptr; 41 + std::mutex m_listenersMutex; 42 + std::set<std::pair<AURenderCallback, void*>> m_listeners; 43 + }; 44 + 45 + #endif 46 +
+66
src/AudioUnit/include/AudioUnit/AudioUnitPA.h
··· 1 + #ifndef AUDIOUNITPA_H 2 + #define AUDIOUNITPA_H 3 + #include "AudioOutputUnitComponent.h" 4 + #include <pulse/pulseaudio.h> 5 + #include <thread> 6 + 7 + #ifndef kOutputBus 8 + # define kOutputBus 0 // playback 9 + # define kInputBus 1 // recording 10 + #endif 11 + 12 + class AudioUnitPA : public AudioOutputUnitComponent 13 + { 14 + public: 15 + AudioUnitPA(); 16 + virtual ~AudioUnitPA(); 17 + 18 + OSStatus init() override; 19 + OSStatus deinit() override; 20 + 21 + OSStatus start() override; 22 + OSStatus stop() override; 23 + 24 + OSStatus reset(AudioUnitScope inScope, AudioUnitElement inElement) override; 25 + 26 + OSStatus render(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) override; 27 + 28 + int cardIndex() const override; 29 + private: 30 + OSStatus initOutput(); 31 + private: 32 + static void initializePA(); 33 + static void deinitializePA(); 34 + static void paContextStateCB(pa_context* c, void*); 35 + static void paStreamStateCB(pa_stream* s, void*); 36 + static void paStreamWriteCB(pa_stream* s, size_t length, void*); 37 + static std::string getAppName(); 38 + pa_sample_spec paSampleSpecForASBD(const AudioStreamBasicDescription& asbd); 39 + 40 + void requestDataForPlayback(size_t length); 41 + 42 + inline bool isOutputPlanar() const { return m_config[kOutputBus].second.mFormatFlags & kAudioFormatFlagIsNonInterleaved; } 43 + inline bool isInputPlanar() const { return m_config[kInputBus].first.mFormatFlags & kAudioFormatFlagIsNonInterleaved; } 44 + 45 + OSStatus renderOutput(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 46 + OSStatus renderInterleavedOutput(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 47 + OSStatus renderPlanarOutput(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 48 + 49 + OSStatus renderInput(AudioUnitRenderActionFlags *ioActionFlags,const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 50 + OSStatus renderInterleavedInput(AudioUnitRenderActionFlags *ioActionFlags,const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 51 + OSStatus renderPlanarInput(AudioUnitRenderActionFlags *ioActionFlags,const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList *ioData); 52 + private: 53 + static pa_mainloop* m_mainloop; 54 + static pa_context* m_context; 55 + static std::thread* m_mainloopThread; 56 + private: 57 + pa_stream* m_stream; 58 + 59 + // PulseAudio supports only unsigned 8-bit PCM and only signed >8-bit PCM. 60 + // We need to perform conversion of samples if input/output differs. 61 + bool m_convertUnsignedSigned = false; 62 + bool m_started = false; 63 + }; 64 + 65 + #endif /* AUDIOUNITPA_H */ 66 +
+71
src/AudioUnit/include/AudioUnit/AudioUnitProperties.h
··· 1 + #ifndef AUDIOUNITPROPERTIES_H 2 + #define AUDIOUNITPROPERTIES_H 3 + 4 + enum { 5 + kAudioOutputUnitProperty_CurrentDevice = 2000, 6 + kAudioOutputUnitProperty_ChannelMap = 2002, 7 + kAudioOutputUnitProperty_EnableIO = 2003, 8 + kAudioOutputUnitProperty_StartTime = 2004, 9 + kAudioOutputUnitProperty_SetInputCallback = 2005, 10 + kAudioOutputUnitProperty_HasIO = 2006, 11 + kAudioOutputUnitProperty_StartTimestampsAtZero = 2007 12 + }; 13 + 14 + enum { 15 + kAudioUnitScope_Global = 0, 16 + kAudioUnitScope_Input = 1, 17 + kAudioUnitScope_Output = 2, 18 + kAudioUnitScope_Group = 3, 19 + kAudioUnitScope_Part = 4, 20 + kAudioUnitScope_Note = 5, 21 + kAudioUnitScope_Layer = 6, 22 + kAudioUnitScope_LayerItem = 7 23 + }; 24 + 25 + enum 26 + { 27 + kAudioUnitProperty_ClassInfo = 0, 28 + kAudioUnitProperty_MakeConnection = 1, 29 + kAudioUnitProperty_SampleRate = 2, 30 + kAudioUnitProperty_ParameterList = 3, 31 + kAudioUnitProperty_ParameterInfo = 4, 32 + kAudioUnitProperty_CPULoad = 6, 33 + kAudioUnitProperty_StreamFormat = 8, 34 + kAudioUnitProperty_ElementCount = 11, 35 + kAudioUnitProperty_Latency = 12, 36 + kAudioUnitProperty_SupportedNumChannels = 13, 37 + kAudioUnitProperty_MaximumFramesPerSlice = 14, 38 + kAudioUnitProperty_ParameterValueStrings = 16, 39 + kAudioUnitProperty_AudioChannelLayout = 19, 40 + kAudioUnitProperty_TailTime = 20, 41 + kAudioUnitProperty_BypassEffect = 21, 42 + kAudioUnitProperty_LastRenderError = 22, 43 + kAudioUnitProperty_SetRenderCallback = 23, 44 + kAudioUnitProperty_FactoryPresets = 24, 45 + kAudioUnitProperty_ContextName = 25, 46 + kAudioUnitProperty_RenderQuality = 26, 47 + kAudioUnitProperty_InPlaceProcessing = 29, 48 + kAudioUnitProperty_ElementName = 30, 49 + kAudioUnitProperty_SupportedChannelLayoutTags = 32, 50 + kAudioUnitProperty_PresentPreset = 36, 51 + kAudioUnitProperty_ShouldAllocateBuffer = 51, 52 + kAudioUnitProperty_ParameterHistoryInfo = 53 53 + }; 54 + 55 + struct AURenderCallbackStruct 56 + { 57 + AURenderCallback inputProc; 58 + void *inputProcRefCon; 59 + }; 60 + typedef struct AURenderCallbackStruct AURenderCallbackStruct; 61 + 62 + struct AudioUnitConnection 63 + { 64 + AudioUnit sourceAudioUnit; 65 + UInt32 sourceOutputNumber; 66 + UInt32 destInputNumber; 67 + }; 68 + typedef struct AudioUnitConnection AudioUnitConnection; 69 + 70 + #endif 71 +
+20
src/AudioUnit/include/AudioUnit/AudioUnitRenderer.h
··· 1 + #ifndef AUDIOUNITRENDERER_H 2 + #define AUDIOUNITRENDERER_H 3 + #include "AudioUnitBase.h" 4 + 5 + // Wraps AURenderCallbackStruct 6 + class AudioUnitRenderer : public AudioUnitComponent 7 + { 8 + public: 9 + AudioUnitRenderer(const AURenderCallbackStruct& cb); 10 + OSStatus init() override; 11 + OSStatus deinit() override; 12 + 13 + OSStatus reset(AudioUnitScope inScope, AudioUnitElement inElement) override; 14 + 15 + OSStatus render(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) override; 16 + private: 17 + AURenderCallbackStruct m_renderCallback; 18 + }; 19 + 20 + #endif
+24 -14
src/CMakeLists.txt
··· 7 7 include(mig) 8 8 include(pyc) 9 9 10 - add_definitions(-D_DARWIN_C_SOURCE -D_POSIX_C_SOURCE -DDARLING) 10 + add_definitions( 11 + -D_DARWIN_C_SOURCE 12 + -D_POSIX_C_SOURCE 13 + -DDARLING 14 + -D__APPLE__ 15 + -D__DYNAMIC__ 16 + ) 17 + 11 18 set(DARLING TRUE) 12 - 13 - add_definitions(-D__APPLE__ -D__DYNAMIC__) 14 19 15 20 execute_process( 16 21 COMMAND git rev-parse --abbrev-ref HEAD ··· 25 30 OUTPUT_STRIP_TRAILING_WHITESPACE 26 31 ) 27 32 28 - configure_file(darling-config.h.in darling-config.h) 29 - include_directories("${CMAKE_CURRENT_BINARY_DIR}") 30 - include_directories("${CMAKE_CURRENT_SOURCE_DIR}") 33 + configure_file(include/darling-config.h.in include/darling-config.h) 34 + include_directories("${CMAKE_CURRENT_BINARY_DIR}/include") 35 + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include") 31 36 32 37 include(compiler_include) 33 38 GetCompilerInclude(COMPILER_INC_PATH) ··· 76 81 ) 77 82 78 83 include_directories(AFTER 84 + ${CMAKE_CURRENT_SOURCE_DIR}/DiskArbitration/include 85 + ${CMAKE_CURRENT_SOURCE_DIR}/CoreAudio/include 79 86 ${CMAKE_CURRENT_SOURCE_DIR}/external/SmartCardServices/include 87 + ${CMAKE_CURRENT_SOURCE_DIR}/AudioUnit/include 80 88 ${CMAKE_CURRENT_SOURCE_DIR}/login/include 81 89 ${CMAKE_CURRENT_SOURCE_DIR}/external/IOKitUser/include 82 90 ${CMAKE_CURRENT_SOURCE_DIR}/launchd/liblaunch/include 83 91 ${CMAKE_CURRENT_SOURCE_DIR}/sandbox/include 84 92 ${CMAKE_CURRENT_SOURCE_DIR}/CoreServices/include 85 93 ${CMAKE_CURRENT_SOURCE_DIR}/external/coretls/include 86 - ${CMAKE_SOURCE_DIR}/src/libmalloc/include 87 - ${CMAKE_SOURCE_DIR}/src/libinfo/include 88 - ${CMAKE_SOURCE_DIR}/src/external/syslog/libsystem_asl.tproj/include 89 - ${CMAKE_SOURCE_DIR}/src/external/openssl/src/include 94 + ${CMAKE_CURRENT_SOURCE_DIR}/libmalloc/include 95 + ${CMAKE_CURRENT_SOURCE_DIR}/libinfo/include 96 + ${CMAKE_CURRENT_SOURCE_DIR}/external/syslog/libsystem_asl.tproj/include 97 + ${CMAKE_CURRENT_SOURCE_DIR}/external/openssl/src/include 90 98 ${CMAKE_SOURCE_DIR}/kernel-include/iokit 91 - ${CMAKE_SOURCE_DIR}/src/external/IOKitUser 99 + ${CMAKE_CURRENT_SOURCE_DIR}/external/IOKitUser 92 100 ${CMAKE_CURRENT_SOURCE_DIR}/external/openpam/include 93 101 ${CMAKE_CURRENT_SOURCE_DIR}/external/sqlite/include 94 102 ${CMAKE_CURRENT_SOURCE_DIR}/DebugSymbols/include 95 103 ${CMAKE_CURRENT_SOURCE_DIR}/OpenScripting/include 96 - ${CMAKE_SOURCE_DIR}/src/CryptoTokenKit/include 97 - ${CMAKE_SOURCE_DIR}/src/LocalAuthentication/include 104 + ${CMAKE_CURRENT_SOURCE_DIR}/CryptoTokenKit/include 105 + ${CMAKE_CURRENT_SOURCE_DIR}/LocalAuthentication/include 98 106 ${CMAKE_CURRENT_SOURCE_DIR}/AppleSystemInfo/include 99 107 ${CMAKE_CURRENT_SOURCE_DIR}/SystemConfiguration/include 100 108 ${CMAKE_CURRENT_SOURCE_DIR}/libiconv/include ··· 129 137 ${CMAKE_CURRENT_SOURCE_DIR}/external/DirectoryService/include 130 138 ${CMAKE_CURRENT_SOURCE_DIR}/DiskImages/include 131 139 ${CMAKE_CURRENT_SOURCE_DIR}/external/cocotron 140 + ${CMAKE_CURRENT_SOURCE_DIR}/lkm/include 132 141 ) 133 142 134 143 add_subdirectory(external/libkqueue) ··· 205 214 add_subdirectory(external/ruby) 206 215 add_subdirectory(external/expat) 207 216 add_subdirectory(shellspawn) 208 - #add_subdirectory(external/libauto) 209 217 add_subdirectory(external/libarchive/libarchive) 210 218 add_subdirectory(external/apr) 211 219 add_subdirectory(sandbox) ··· 278 286 279 287 include_directories(BEFORE 280 288 ${CMAKE_CURRENT_SOURCE_DIR}/external/libcxx/include 289 + ${CMAKE_CURRENT_SOURCE_DIR}/libunwind/include 281 290 ) 282 291 283 292 add_subdirectory(external/libcxxabi) ··· 287 296 # Has build issues 288 297 #add_subdirectory(external/security) 289 298 add_subdirectory(external/cctools) 299 + add_subdirectory(external/libauto) 290 300 291 301 add_subdirectory(lkm) 292 302
+1 -125
src/CoreAudio/AudioHardware.h
··· 1 - #ifndef AUDIOHARDWARE_H 2 - #define AUDIOHARDWARE_H 3 - 4 - #ifdef __cplusplus 5 - extern "C" { 6 - #endif 7 - 8 - #include <CoreAudio/CoreAudiotypes.h> 9 - #include <CoreAudio/AudioHardwareBase.h> 10 - 11 - enum 12 - { 13 - kAudioObjectSystemObject = 1 14 - }; 15 - 16 - typedef OSStatus (*AudioObjectPropertyListenerProc)(AudioObjectID inObjectID, 17 - UInt32 inNumberAddresses, const AudioObjectPropertyAddress* inAddresses, 18 - void* inClientData); 19 - 20 - #ifdef __BLOCKS__ 21 - typedef void (^AudioObjectPropertyListenerBlock)(UInt32 inNumberAddresses, 22 - const AudioObjectPropertyAddress* inAddresses); 23 - #endif 24 - 25 - void AudioObjectShow(AudioObjectID inObjectID); 26 - 27 - Boolean AudioObjectHasProperty(AudioObjectID inObjectID, 28 - const AudioObjectPropertyAddress* inAddress); 29 - 30 - OSStatus AudioObjectIsPropertySettable(AudioObjectID inObjectID, 31 - const AudioObjectPropertyAddress* inAddress, Boolean* outIsSettable); 32 - 33 - OSStatus AudioObjectGetPropertyDataSize(AudioObjectID inObjectID, 34 - const AudioObjectPropertyAddress* inAddress, UInt32 inQualifierDataSize, 35 - const void* inQualifierData, UInt32* outDataSize); 36 - 37 - OSStatus AudioObjectGetPropertyData(AudioObjectID inObjectID, 38 - const AudioObjectPropertyAddress* inAddress, UInt32 inQualifierDataSize, 39 - const void* inQualifierData, UInt32* ioDataSize, void* outData); 40 - 41 - OSStatus AudioObjectSetPropertyData(AudioObjectID inObjectID, 42 - const AudioObjectPropertyAddress* inAddress, UInt32 inQualifierDataSize, 43 - const void* inQualifierData, UInt32 inDataSize, const void* inData); 44 - 45 - OSStatus AudioObjectAddPropertyListener(AudioObjectID inObjectID, 46 - const AudioObjectPropertyAddress* inAddress, 47 - AudioObjectPropertyListenerProc inListener, void* inClientData); 48 - 49 - OSStatus AudioObjectRemovePropertyListener(AudioObjectID inObjectID, 50 - const AudioObjectPropertyAddress* inAddress, 51 - AudioObjectPropertyListenerProc inListener, void* inClientData); 52 - 53 - #ifdef __BLOCKS__ 54 - 55 - OSStatus AudioObjectAddPropertyListenerBlock(AudioObjectID inObjectID, 56 - const AudioObjectPropertyAddress* inAddress, 57 - dispatch_queue_t inDispatchQueue, AudioObjectPropertyListenerBlock inListener); 58 - 59 - OSStatus AudioObjectRemovePropertyListenerBlock(AudioObjectID inObjectID, 60 - const AudioObjectPropertyAddress* inAddress, 61 - dispatch_queue_t inDispatchQueue, AudioObjectPropertyListenerBlock inListener); 62 - 63 - #endif 64 - 65 - OSStatus AudioHardwareUnload(void); 66 - 67 - OSStatus AudioHardwareCreateAggregateDevice(CFDictionaryRef, AudioObjectID* outDeviceID); 68 - 69 - OSStatus AudioHardwareDestroyAggregateDevice(AudioObjectID inDeviceID); 70 - 71 - typedef OSStatus (*AudioDeviceIOProc)(AudioObjectID inObjectID, 72 - const AudioTimeStamp* inNow, const AudioBufferList* inInputData, 73 - const AudioTimeStamp* inInputTime, 74 - AudioBufferList* outOutputData, const AudioTimeStamp* inOutputTime, 75 - void* inClientData); 76 - 77 - typedef AudioDeviceIOProc AudioDeviceIOProcID; 78 - 79 - OSStatus AudioDeviceCreateIOProcID(AudioObjectID inDevice, 80 - AudioDeviceIOProc inProc, void* inClientData, 81 - AudioDeviceIOProcID* outIOProcID); 82 - 83 - #ifdef __BLOCKS__ 84 - 85 - typedef void (^AudioDeviceIOBlock)(const AudioTimeStamp* inNow, const AudioBufferList* inInputData, 86 - const AudioTimeStamp* inInputTime, 87 - AudioBufferList* outOutputData, const AudioTimeStamp* inOutputTime); 88 - 89 - OSStatus AudioDeviceCreateIOProcIDWithBlock(AudioDeviceIOProcID* outIOProcID, 90 - AudioObjectID inDevice, dispatch_queue_t inDispatchQueue, 91 - AudioDeviceIOBlock inIOBlock); 92 - 93 - #endif 94 - 95 - OSStatus AudioDeviceDestroyIOProcID(AudioObjectID inDevice, 96 - AudioDeviceIOProcID inIOProcID); 97 - 98 - OSStatus AudioDeviceStart(AudioObjectID inDevice, AudioDeviceIOProcID inProcID); 99 - 100 - OSStatus AudioDeviceStartAtTime(AudioObjectID inDevice, AudioDeviceIOProcID inProcID, 101 - AudioTimeStamp* ioRequestedStartTime, UInt32 inFlags); 102 - 103 - OSStatus AudioDeviceStop(AudioObjectID inDevice, AudioDeviceIOProcID inProcID); 104 - 105 - struct AudioHardwareIOProcStreamUsage 106 - { 107 - void* mIOProc; 108 - UInt32 mNumberStreams; 109 - UInt32 mStreamIsOn[1]; 110 - }; 111 - 112 - OSStatus AudioDeviceGetCurrentTime(AudioObjectID inDevice, AudioTimeStamp* outTime); 113 - 114 - OSStatus AudioDeviceTranslateTime(AudioObjectID inDevice, const AudioTimeStamp* inTime, 115 - AudioTimeStamp* outTime); 116 - 117 - OSStatus AudioDeviceGetNearestStartTime(AudioObjectID inDevice, 118 - AudioTimeStamp* ioRequestedStartTime, UInt32 inFlags); 119 - 120 - #ifdef __cplusplus 121 - } 122 - #endif 123 - 124 - #endif /* AUDIOHARDWARE_H */ 125 - 1 + include/CoreAudio/AudioHardware.h
+1 -72
src/CoreAudio/AudioHardwareBase.h
··· 1 - #ifndef AUDIOHARDWAREBASE_H 2 - #define AUDIOHARDWAREBASE_H 3 - 4 - #ifdef __cplusplus 5 - extern "C" { 6 - #endif 7 - 8 - #include <CoreAudio/CoreAudioTypes.h> 9 - 10 - typedef UInt32 AudioObjectID; 11 - typedef UInt32 AudioClassID; 12 - typedef UInt32 AudioObjectPropertySelector; 13 - typedef UInt32 AudioObjectPropertyScope; 14 - typedef UInt32 AudioObjectPropertyElement; 15 - 16 - struct AudioObjectPropertyAddress 17 - { 18 - AudioObjectPropertySelector mSelector; 19 - AudioObjectPropertyScope mScope; 20 - AudioObjectPropertyElement mElement; 21 - }; 22 - 23 - enum 24 - { 25 - kAudioHardwareNoError = 0, 26 - kAudioHardwareNotRunningError = 'stop', 27 - kAudioHardwareUnspecifiedError = 'what', 28 - kAudioHardwareUnknownPropertyError = 'who?', 29 - kAudioHardwareBadPropertySizeError = '!siz', 30 - kAudioHardwareIllegalOperationError = 'nope', 31 - kAudioHardwareBadObjectError = '!obj', 32 - kAudioHardwareBadDeviceError = '!dev', 33 - kAudioHardwareBadStreamError = '!str', 34 - kAudioHardwareUnsupportedOperationError = 'unop', 35 - kAudioDeviceUnsupportedFormatError = '!dat', 36 - kAudioDevicePermissionsError = '!hog', 37 - }; 38 - 39 - enum 40 - { 41 - kAudioObjectPropertyScopeGlobal = 'glob', 42 - kAudioObjectPropertyScopeInput = 'inpt', 43 - kAudioObjectPropertyScopeOutput = 'outp', 44 - kAudioObjectPropertyScopePlayThrough = 'ptru', 45 - kAudioObjectPropertyElementMaster = 0, 46 - }; 47 - 48 - enum 49 - { 50 - kAudioObjectPropertyBaseClass = 'bcls', 51 - kAudioObjectPropertyClass = 'clas', 52 - kAudioObjectPropertyOwner = 'stdv', 53 - kAudioObjectPropertyName = 'lnam', 54 - kAudioObjectPropertyModelName = 'lmod', 55 - kAudioObjectPropertyManufacturer = 'lmak', 56 - kAudioObjectPropertyElementName = 'lchn', 57 - kAudioObjectPropertyElementCategoryName = 'lccn', 58 - kAudioObjectPropertyElementNumberName = 'lcnn', 59 - kAudioObjectPropertyOwnedObjects = 'ownd', 60 - kAudioObjectPropertyIdentify = 'iden', 61 - kAudioObjectPropertySerialNumber = 'snum', 62 - kAudioObjectPropertyFirmwareVersion = 'fwvn', 63 - }; 64 - 65 - // TODO: A lot more is missing 66 - 67 - #ifdef __cplusplus 68 - } 69 - #endif 70 - 71 - #endif /* AUDIOHARDWAREBASE_H */ 72 - 1 + include/CoreAudio/AudioHardwareBase.h
+1 -78
src/CoreAudio/AudioHardwareImpl.h
··· 1 - /* 2 - This file is part of Darling. 3 - 4 - Copyright (C) 2015-2016 Lubos Dolezel 5 - 6 - Darling is free software: you can redistribute it and/or modify 7 - it under the terms of the GNU General Public License as published by 8 - the Free Software Foundation, either version 3 of the License, or 9 - (at your option) any later version. 10 - 11 - Darling is distributed in the hope that it will be useful, 12 - but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - GNU General Public License for more details. 15 - 16 - You should have received a copy of the GNU General Public License 17 - along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 - */ 19 - 20 - #ifndef AUDIOHARDWAREIMPL_H 21 - #define AUDIOHARDWAREIMPL_H 22 - #include <CoreAudio/AudioHardware.h> 23 - #include <map> 24 - #include <mutex> 25 - #include "AudioHardwareStream.h" 26 - 27 - class AudioHardwareImpl 28 - { 29 - public: 30 - AudioHardwareImpl(); 31 - virtual ~AudioHardwareImpl(); 32 - 33 - virtual void show(); 34 - virtual bool hasProperty(const AudioObjectPropertyAddress* address); 35 - virtual OSStatus getPropertyDataSize(const AudioObjectPropertyAddress* inAddress, UInt32 inQualifierDataSize, 36 - const void* inQualifierData, UInt32* outDataSize); 37 - 38 - virtual OSStatus isPropertySettable(const AudioObjectPropertyAddress* inAddress, Boolean* outIsSettable); 39 - 40 - virtual OSStatus getPropertyData(const AudioObjectPropertyAddress* inAddress, UInt32 inQualifierDataSize, 41 - const void* inQualifierData, UInt32* ioDataSize, void* outData); 42 - 43 - virtual OSStatus setPropertyData(const AudioObjectPropertyAddress* inAddress, UInt32 inQualifierDataSize, 44 - const void* inQualifierData, UInt32 inDataSize, const void* inData); 45 - 46 - virtual OSStatus addPropertyListener(const AudioObjectPropertyAddress* inAddress, 47 - AudioObjectPropertyListenerProc inListener, void* inClientData); 48 - 49 - virtual OSStatus removePropertyListener(const AudioObjectPropertyAddress* inAddress, 50 - AudioObjectPropertyListenerProc inListener, void* inClientData); 51 - 52 - OSStatus createIOProcID(AudioDeviceIOProc inProc, void* inClientData, 53 - AudioDeviceIOProcID* outIOProcID); 54 - OSStatus destroyIOProcID(AudioDeviceIOProcID inIOProcID); 55 - 56 - virtual OSStatus start(AudioDeviceIOProcID inProcID, 57 - AudioTimeStamp* ioRequestedStartTime, UInt32 inFlags); 58 - virtual OSStatus stop(AudioDeviceIOProcID inProcID); 59 - 60 - virtual OSStatus getCurrentTime(AudioTimeStamp* outTime) = 0; 61 - 62 - virtual OSStatus translateTime(const AudioTimeStamp* inTime, 63 - AudioTimeStamp* outTime) = 0; 64 - 65 - virtual OSStatus getNearestStartTime(AudioTimeStamp* ioRequestedStartTime, 66 - UInt32 inFlags) = 0; 67 - protected: 68 - virtual AudioHardwareStream* createStream(AudioDeviceIOProcID procID) = 0; 69 - protected: 70 - std::mutex m_procMutex; 71 - std::map<AudioDeviceIOProcID, std::pair<AudioDeviceIOProc, void*>> m_proc; 72 - int m_nextProcId = 1; 73 - 74 - std::map<AudioDeviceIOProcID, std::unique_ptr<AudioHardwareStream> m_streams; 75 - }; 76 - 77 - #endif /* AUDIOHARDWAREIMPL_H */ 78 - 1 + include/CoreAudio/AudioHardwareImpl.h
+1 -33
src/CoreAudio/AudioHardwareStream.h
··· 1 - /* 2 - This file is part of Darling. 3 - 4 - Copyright (C) 2015-2016 Lubos Dolezel 5 - 6 - Darling is free software: you can redistribute it and/or modify 7 - it under the terms of the GNU General Public License as published by 8 - the Free Software Foundation, either version 3 of the License, or 9 - (at your option) any later version. 10 - 11 - Darling is distributed in the hope that it will be useful, 12 - but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - GNU General Public License for more details. 15 - 16 - You should have received a copy of the GNU General Public License 17 - along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 - */ 19 - 20 - #ifndef AUDIOHARDWARESTREAM_H 21 - #define AUDIOHARDWARESTREAM_H 22 - 23 - class AudioHardwareStream 24 - { 25 - public: 26 - AudioHardwareStream(); 27 - virtual ~AudioHardwareStream(); 28 - private: 29 - 30 - }; 31 - 32 - #endif /* AUDIOHARDWARESTREAM_H */ 33 - 1 + include/CoreAudio/AudioHardwareStream.h
+1 -365
src/CoreAudio/CoreAudioTypes.h
··· 1 - #ifndef COREAUDIOTYPES_H 2 - #define COREAUDIOTYPES_H 3 - #include <MacTypes.h> 4 - 5 - struct AudioStreamBasicDescription 6 - { 7 - Float64 mSampleRate; 8 - UInt32 mFormatID; 9 - UInt32 mFormatFlags; 10 - UInt32 mBytesPerPacket; // 0 for VBR 11 - UInt32 mFramesPerPacket; 12 - UInt32 mBytesPerFrame; 13 - UInt32 mChannelsPerFrame; 14 - UInt32 mBitsPerChannel; 15 - UInt32 mReserved; 16 - }; 17 - 18 - struct AudioClassDescription 19 - { 20 - OSType mType; 21 - OSType mSubType; 22 - OSType mManufacturer; 23 - }; 24 - 25 - struct AudioBuffer 26 - { 27 - UInt32 mNumberChannels; 28 - UInt32 mDataByteSize; 29 - void* mData; 30 - }; 31 - 32 - struct AudioBufferList 33 - { 34 - UInt32 mNumberBuffers; 35 - AudioBuffer mBuffers[1]; 36 - }; 37 - 38 - struct AudioStreamPacketDescription 39 - { 40 - SInt64 mStartOffset; 41 - UInt32 mVariableFramesInPacket; // 0 for constant streams 42 - UInt32 mDataByteSize; 43 - }; 44 - 45 - struct SMPTETime 46 - { 47 - SInt64 mSubframes, mSubframeDivisor; 48 - UInt32 mCounter, mType, mFlags; 49 - SInt16 mHours, mMinutes, mSeconds, mFrames; 50 - }; 51 - 52 - struct AudioTimeStamp 53 - { 54 - Float64 mSampleTime; 55 - UInt64 mHostTime; 56 - Float64 mRateScalar; 57 - UInt64 mWordClockTime; 58 - SMPTETime mSMPTETime; 59 - UInt32 mFlags, mReserved; 60 - }; 61 - 62 - enum 63 - { 64 - kAudioFormatLinearPCM = 'lpcm', 65 - kAudioFormatAC3 = 'ac-3', 66 - kAudioFormat60958AC3 = 'cac3', 67 - kAudioFormatAppleIMA4 = 'ima4', 68 - kAudioFormatMPEG4AAC = 'aac ', 69 - kAudioFormatMPEG4CELP = 'celp', 70 - kAudioFormatMPEG4HVXC = 'hvxc', 71 - kAudioFormatMPEG4TwinVQ = 'twvq', 72 - kAudioFormatMACE3 = 'MAC3', 73 - kAudioFormatMACE6 = 'MAC6', 74 - kAudioFormatULaw = 'ulaw', 75 - kAudioFormatALaw = 'alaw', 76 - kAudioFormatQDesign = 'QDMC', 77 - kAudioFormatQDesign2 = 'QDM2', 78 - kAudioFormatQUALCOMM = 'Qclp', 79 - kAudioFormatMPEGLayer1 = '.mp1', 80 - kAudioFormatMPEGLayer2 = '.mp2', 81 - kAudioFormatMPEGLayer3 = '.mp3', 82 - kAudioFormatTimeCode = 'time', 83 - kAudioFormatMIDIStream = 'midi', 84 - kAudioFormatParameterValueStream = 'apvs', 85 - kAudioFormatAppleLossless = 'alac', 86 - kAudioFormatMPEG4AAC_HE = 'aach', 87 - kAudioFormatMPEG4AAC_LD = 'aacl', 88 - kAudioFormatMPEG4AAC_ELD = 'aace', 89 - kAudioFormatMPEG4AAC_ELD_SBR = 'aacf', 90 - kAudioFormatMPEG4AAC_ELD_V2 = 'aacg', 91 - kAudioFormatMPEG4AAC_HE_V2 = 'aacp', 92 - kAudioFormatMPEG4AAC_Spatial = 'aacs', 93 - kAudioFormatAMR = 'samr', 94 - kAudioFormatAudible = 'AUDB', 95 - kAudioFormatiLBC = 'ilbc', 96 - kAudioFormatDVIIntelIMA = 0x6D730011, 97 - kAudioFormatMicrosoftGSM = 0x6D730031, 98 - kAudioFormatAES3 = 'aes3' 99 - }; 100 - 101 - enum 102 - { 103 - kAudioFormatFlagIsFloat = (1 << 0), // 0x1 104 - kAudioFormatFlagIsBigEndian = (1 << 1), // 0x2 105 - kAudioFormatFlagIsSignedInteger = (1 << 2), // 0x4 106 - kAudioFormatFlagIsPacked = (1 << 3), // 0x8 107 - kAudioFormatFlagIsAlignedHigh = (1 << 4), // 0x10 108 - kAudioFormatFlagIsNonInterleaved = (1 << 5), // 0x20 109 - kAudioFormatFlagIsNonMixable = (1 << 6), // 0x40 110 - kAudioFormatFlagsAreAllClear = (1 << 31), 111 - 112 - kLinearPCMFormatFlagIsFloat = kAudioFormatFlagIsFloat, 113 - kLinearPCMFormatFlagIsBigEndian = kAudioFormatFlagIsBigEndian, 114 - kLinearPCMFormatFlagIsSignedInteger = kAudioFormatFlagIsSignedInteger, 115 - kLinearPCMFormatFlagIsPacked = kAudioFormatFlagIsPacked, 116 - kLinearPCMFormatFlagIsAlignedHigh = kAudioFormatFlagIsAlignedHigh, 117 - kLinearPCMFormatFlagIsNonInterleaved = kAudioFormatFlagIsNonInterleaved, 118 - kLinearPCMFormatFlagIsNonMixable = kAudioFormatFlagIsNonMixable, 119 - kLinearPCMFormatFlagsSampleFractionShift = 7, 120 - kLinearPCMFormatFlagsSampleFractionMask = (0x3F << kLinearPCMFormatFlagsSampleFractionShift), 121 - kLinearPCMFormatFlagsAreAllClear = kAudioFormatFlagsAreAllClear, 122 - 123 - kAppleLosslessFormatFlag_16BitSourceData = 1, 124 - kAppleLosslessFormatFlag_20BitSourceData = 2, 125 - kAppleLosslessFormatFlag_24BitSourceData = 3, 126 - kAppleLosslessFormatFlag_32BitSourceData = 4 127 - }; 128 - 129 - enum // typedef UInt32 AudioConverterPropertyID 130 - { 131 - kAudioConverterPropertyMinimumInputBufferSize = 'mibs', 132 - kAudioConverterPropertyMinimumOutputBufferSize = 'mobs', 133 - kAudioConverterPropertyMaximumInputBufferSize = 'xibs', 134 - kAudioConverterPropertyMaximumInputPacketSize = 'xips', 135 - kAudioConverterPropertyMaximumOutputPacketSize = 'xops', 136 - kAudioConverterPropertyCalculateInputBufferSize = 'cibs', 137 - kAudioConverterPropertyCalculateOutputBufferSize = 'cobs', 138 - kAudioConverterPropertyInputCodecParameters = 'icdp', 139 - kAudioConverterPropertyOutputCodecParameters = 'ocdp', 140 - kAudioConverterSampleRateConverterAlgorithm = 'srci', 141 - kAudioConverterSampleRateConverterComplexity = 'srca', 142 - kAudioConverterSampleRateConverterQuality = 'srcq', 143 - kAudioConverterSampleRateConverterInitialPhase = 'srcp', 144 - kAudioConverterCodecQuality = 'cdqu', 145 - kAudioConverterPrimeMethod = 'prmm', 146 - kAudioConverterPrimeInfo = 'prim', 147 - kAudioConverterChannelMap = 'chmp', 148 - kAudioConverterDecompressionMagicCookie = 'dmgc', 149 - kAudioConverterCompressionMagicCookie = 'cmgc', 150 - kAudioConverterEncodeBitRate = 'brat', 151 - kAudioConverterEncodeAdjustableSampleRate = 'ajsr', 152 - kAudioConverterInputChannelLayout = 'icl ', 153 - kAudioConverterOutputChannelLayout = 'ocl ', 154 - kAudioConverterApplicableEncodeBitRates = 'aebr', 155 - kAudioConverterAvailableEncodeBitRates = 'vebr', 156 - kAudioConverterApplicableEncodeSampleRates = 'aesr', 157 - kAudioConverterAvailableEncodeSampleRates = 'vesr', 158 - kAudioConverterAvailableEncodeChannelLayoutTags = 'aecl', 159 - kAudioConverterCurrentOutputStreamDescription = 'acod', 160 - kAudioConverterCurrentInputStreamDescription = 'acid', 161 - kAudioConverterPropertySettings = 'acps', 162 - kAudioConverterPropertyBitDepthHint = 'acbd', 163 - kAudioConverterPropertyFormatList = 'flst', 164 - kAudioConverterPropertyDithering = 'dith', 165 - kAudioConverterPropertyDitherBitDepth = 'dbit' 166 - }; 167 - 168 - enum { 169 - kAudioChannelLayoutTag_UseChannelDescriptions = (0<<16) | 0, 170 - kAudioChannelLayoutTag_UseChannelBitmap = (1<<16) | 0, 171 - 172 - kAudioChannelLayoutTag_Mono = (100<<16) | 1, 173 - kAudioChannelLayoutTag_Stereo = (101<<16) | 2, 174 - kAudioChannelLayoutTag_StereoHeadphones = (102<<16) | 2, 175 - kAudioChannelLayoutTag_MatrixStereo = (103<<16) | 2, 176 - kAudioChannelLayoutTag_MidSide = (104<<16) | 2, 177 - kAudioChannelLayoutTag_XY = (105<<16) | 2, 178 - kAudioChannelLayoutTag_Binaural = (106<<16) | 2, 179 - kAudioChannelLayoutTag_Ambisonic_B_Format = (107<<16) | 4, 180 - kAudioChannelLayoutTag_Quadraphonic = (108<<16) | 4, 181 - kAudioChannelLayoutTag_Pentagonal = (109<<16) | 5, 182 - kAudioChannelLayoutTag_Hexagonal = (110<<16) | 6, 183 - kAudioChannelLayoutTag_Octagonal = (111<<16) | 8, 184 - kAudioChannelLayoutTag_Cube = (112<<16) | 8, 185 - 186 - 187 - kAudioChannelLayoutTag_MPEG_1_0 = kAudioChannelLayoutTag_Mono, 188 - kAudioChannelLayoutTag_MPEG_2_0 = kAudioChannelLayoutTag_Stereo, 189 - kAudioChannelLayoutTag_MPEG_3_0_A = (113<<16) | 3, 190 - kAudioChannelLayoutTag_MPEG_3_0_B = (114<<16) | 3, 191 - kAudioChannelLayoutTag_MPEG_4_0_A = (115<<16) | 4, 192 - kAudioChannelLayoutTag_MPEG_4_0_B = (116<<16) | 4, 193 - kAudioChannelLayoutTag_MPEG_5_0_A = (117<<16) | 5, 194 - kAudioChannelLayoutTag_MPEG_5_0_B = (118<<16) | 5, 195 - kAudioChannelLayoutTag_MPEG_5_0_C = (119<<16) | 5, 196 - kAudioChannelLayoutTag_MPEG_5_0_D = (120<<16) | 5, 197 - kAudioChannelLayoutTag_MPEG_5_1_A = (121<<16) | 6, 198 - kAudioChannelLayoutTag_MPEG_5_1_B = (122<<16) | 6, 199 - kAudioChannelLayoutTag_MPEG_5_1_C = (123<<16) | 6, 200 - kAudioChannelLayoutTag_MPEG_5_1_D = (124<<16) | 6, 201 - kAudioChannelLayoutTag_MPEG_6_1_A = (125<<16) | 7, 202 - kAudioChannelLayoutTag_MPEG_7_1_A = (126<<16) | 8, 203 - kAudioChannelLayoutTag_MPEG_7_1_B = (127<<16) | 8, 204 - kAudioChannelLayoutTag_MPEG_7_1_C = (128<<16) | 8, 205 - kAudioChannelLayoutTag_Emagic_Default_7_1 = (129<<16) | 8, 206 - kAudioChannelLayoutTag_SMPTE_DTV = (130<<16) | 8, 207 - 208 - 209 - kAudioChannelLayoutTag_ITU_1_0 = kAudioChannelLayoutTag_Mono, 210 - kAudioChannelLayoutTag_ITU_2_0 = kAudioChannelLayoutTag_Stereo, 211 - kAudioChannelLayoutTag_ITU_2_1 = (131<<16) | 3, 212 - kAudioChannelLayoutTag_ITU_2_2 = (132<<16) | 4, 213 - kAudioChannelLayoutTag_ITU_3_0 = 214 - kAudioChannelLayoutTag_MPEG_3_0_A, 215 - kAudioChannelLayoutTag_ITU_3_1 = 216 - kAudioChannelLayoutTag_MPEG_4_0_A, 217 - kAudioChannelLayoutTag_ITU_3_2 = 218 - kAudioChannelLayoutTag_MPEG_5_0_A, 219 - kAudioChannelLayoutTag_ITU_3_2_1 = 220 - kAudioChannelLayoutTag_MPEG_5_1_A, 221 - kAudioChannelLayoutTag_ITU_3_4_1 = 222 - kAudioChannelLayoutTag_MPEG_7_1_C, 223 - 224 - 225 - kAudioChannelLayoutTag_DVD_0 = kAudioChannelLayoutTag_Mono, 226 - kAudioChannelLayoutTag_DVD_1 = kAudioChannelLayoutTag_Stereo, 227 - kAudioChannelLayoutTag_DVD_2 = kAudioChannelLayoutTag_ITU_2_1, 228 - kAudioChannelLayoutTag_DVD_3 = kAudioChannelLayoutTag_ITU_2_2, 229 - kAudioChannelLayoutTag_DVD_4 = (133<<16) | 3, 230 - kAudioChannelLayoutTag_DVD_5 = (134<<16) | 4, 231 - kAudioChannelLayoutTag_DVD_6 = (135<<16) | 5, 232 - kAudioChannelLayoutTag_DVD_7 = 233 - kAudioChannelLayoutTag_MPEG_3_0_A, 234 - kAudioChannelLayoutTag_DVD_8 = 235 - kAudioChannelLayoutTag_MPEG_4_0_A, 236 - kAudioChannelLayoutTag_DVD_9 = 237 - kAudioChannelLayoutTag_MPEG_5_0_A, 238 - kAudioChannelLayoutTag_DVD_10 = (136<<16) | 4, 239 - kAudioChannelLayoutTag_DVD_11 = (137<<16) | 5, 240 - kAudioChannelLayoutTag_DVD_12 = 241 - kAudioChannelLayoutTag_MPEG_5_1_A, 242 - kAudioChannelLayoutTag_DVD_13 = kAudioChannelLayoutTag_DVD_8, 243 - kAudioChannelLayoutTag_DVD_14 = kAudioChannelLayoutTag_DVD_9, 244 - kAudioChannelLayoutTag_DVD_15 = kAudioChannelLayoutTag_DVD_10, 245 - kAudioChannelLayoutTag_DVD_16 = kAudioChannelLayoutTag_DVD_11, 246 - kAudioChannelLayoutTag_DVD_17 = kAudioChannelLayoutTag_DVD_12, 247 - kAudioChannelLayoutTag_DVD_18 = (138<<16) | 5, 248 - kAudioChannelLayoutTag_DVD_19 = 249 - kAudioChannelLayoutTag_MPEG_5_0_B, 250 - kAudioChannelLayoutTag_DVD_20 = 251 - kAudioChannelLayoutTag_MPEG_5_1_B, 252 - 253 - 254 - kAudioChannelLayoutTag_AudioUnit_4 = 255 - kAudioChannelLayoutTag_Quadraphonic, 256 - kAudioChannelLayoutTag_AudioUnit_5 = 257 - kAudioChannelLayoutTag_Pentagonal, 258 - kAudioChannelLayoutTag_AudioUnit_6 = 259 - kAudioChannelLayoutTag_Hexagonal, 260 - kAudioChannelLayoutTag_AudioUnit_8 = 261 - kAudioChannelLayoutTag_Octagonal, 262 - 263 - kAudioChannelLayoutTag_AudioUnit_5_0 = 264 - kAudioChannelLayoutTag_MPEG_5_0_B, 265 - kAudioChannelLayoutTag_AudioUnit_6_0 = (139<<16) | 6, 266 - kAudioChannelLayoutTag_AudioUnit_7_0 = (140<<16) | 7, 267 - kAudioChannelLayoutTag_AudioUnit_7_0_Front = (148<<16) | 7, 268 - kAudioChannelLayoutTag_AudioUnit_5_1 = 269 - kAudioChannelLayoutTag_MPEG_5_1_A, 270 - kAudioChannelLayoutTag_AudioUnit_6_1 = 271 - kAudioChannelLayoutTag_MPEG_6_1_A, 272 - kAudioChannelLayoutTag_AudioUnit_7_1 = 273 - kAudioChannelLayoutTag_MPEG_7_1_C, 274 - kAudioChannelLayoutTag_AudioUnit_7_1_Front = 275 - kAudioChannelLayoutTag_MPEG_7_1_A, 276 - 277 - kAudioChannelLayoutTag_AAC_3_0 = 278 - kAudioChannelLayoutTag_MPEG_3_0_B, 279 - kAudioChannelLayoutTag_AAC_Quadraphonic = 280 - kAudioChannelLayoutTag_Quadraphonic, 281 - kAudioChannelLayoutTag_AAC_4_0 = 282 - kAudioChannelLayoutTag_MPEG_4_0_B, 283 - kAudioChannelLayoutTag_AAC_5_0 = 284 - kAudioChannelLayoutTag_MPEG_5_0_D, 285 - kAudioChannelLayoutTag_AAC_5_1 = 286 - kAudioChannelLayoutTag_MPEG_5_1_D, 287 - kAudioChannelLayoutTag_AAC_6_0 = (141<<16) | 6, 288 - kAudioChannelLayoutTag_AAC_6_1 = (142<<16) | 7, 289 - kAudioChannelLayoutTag_AAC_7_0 = (143<<16) | 7, 290 - kAudioChannelLayoutTag_AAC_7_1 = 291 - kAudioChannelLayoutTag_MPEG_7_1_B, 292 - kAudioChannelLayoutTag_AAC_Octagonal = (144<<16) | 8, 293 - 294 - kAudioChannelLayoutTag_TMH_10_2_std = (145<<16) | 16, 295 - kAudioChannelLayoutTag_TMH_10_2_full = (146<<16) | 21, 296 - 297 - kAudioChannelLayoutTag_AC3_1_0_1 = (149<<16) | 2, 298 - kAudioChannelLayoutTag_AC3_3_0 = (150<<16) | 3, 299 - kAudioChannelLayoutTag_AC3_3_1 = (151<<16) | 4, 300 - kAudioChannelLayoutTag_AC3_3_0_1 = (152<<16) | 4, 301 - kAudioChannelLayoutTag_AC3_2_1_1 = (153<<16) | 4, 302 - kAudioChannelLayoutTag_AC3_3_1_1 = (154<<16) | 5, 303 - 304 - kAudioChannelLayoutTag_EAC_6_0_A = (155<<16) | 6, 305 - kAudioChannelLayoutTag_EAC_7_0_A = (156<<16) | 7, 306 - kAudioChannelLayoutTag_EAC3_6_1_A = (157<<16) | 7, 307 - kAudioChannelLayoutTag_EAC3_6_1_B = (158<<16) | 7, 308 - kAudioChannelLayoutTag_EAC3_6_1_C = (159<<16) | 7, 309 - kAudioChannelLayoutTag_EAC3_7_1_A = (160<<16) | 8, 310 - kAudioChannelLayoutTag_EAC3_7_1_B = (161<<16) | 8, 311 - kAudioChannelLayoutTag_EAC3_7_1_C = (162<<16) | 8, 312 - kAudioChannelLayoutTag_EAC3_7_1_D = (163<<16) | 8, 313 - kAudioChannelLayoutTag_EAC3_7_1_E = (164<<16) | 8, 314 - kAudioChannelLayoutTag_EAC3_7_1_F = (165<<16) | 8, 315 - kAudioChannelLayoutTag_EAC3_7_1_G = (166<<16) | 8, 316 - kAudioChannelLayoutTag_EAC3_7_1_H = (167<<16) | 8, 317 - 318 - kAudioChannelLayoutTag_DTS_3_1 = (168<<16) | 4, 319 - kAudioChannelLayoutTag_DTS_4_1 = (169<<16) | 5, 320 - kAudioChannelLayoutTag_DTS_6_0_A = (170<<16) | 6, 321 - kAudioChannelLayoutTag_DTS_6_0_B = (171<<16) | 6, 322 - kAudioChannelLayoutTag_DTS_6_0_C = (172<<16) | 6, 323 - kAudioChannelLayoutTag_DTS_6_1_A = (173<<16) | 7, 324 - kAudioChannelLayoutTag_DTS_6_1_B = (174<<16) | 7, 325 - kAudioChannelLayoutTag_DTS_6_1_C = (175<<16) | 7, 326 - kAudioChannelLayoutTag_DTS_6_1_D = (182<<16) | 7, 327 - kAudioChannelLayoutTag_DTS_7_0 = (176<<16) | 7, 328 - kAudioChannelLayoutTag_DTS_7_1 = (177<<16) | 8, 329 - kAudioChannelLayoutTag_DTS_8_0_A = (178<<16) | 8, 330 - kAudioChannelLayoutTag_DTS_8_0_B = (179<<16) | 8, 331 - kAudioChannelLayoutTag_DTS_8_1_A = (180<<16) | 9, 332 - kAudioChannelLayoutTag_DTS_8_1_B = (181<<16) | 9, 333 - 334 - kAudioChannelLayoutTag_DiscreteInOrder = (147<<16) | 0, 335 - kAudioChannelLayoutTag_Unknown = 0xFFFF0000 336 - }; 337 - 338 - enum { 339 - kAudioConverterErr_PropertyNotSupported = 'prop', 340 - kAudioConverterErr_BadPropertySizeError = '!siz', 341 - kAudioConverterErr_FormatNotSupported = 'fmt?', 342 - kAudioConverterErr_OperationNotSupported = 0x6F703F3F, 343 - kAudioConverterErr_UnspecifiedError = 'what', 344 - }; 345 - 346 - typedef UInt32 AudioChannelLabel; 347 - typedef UInt32 AudioChannelLayoutTag; 348 - 349 - struct AudioChannelDescription 350 - { 351 - AudioChannelLabel mChannelLabel; 352 - UInt32 mChannelFlags; 353 - Float32 mCoordinates[3]; 354 - }; 355 - 356 - struct AudioChannelLayout 357 - { 358 - AudioChannelLayoutTag mChannelLayoutTag; 359 - UInt32 mChannelBitmap; 360 - UInt32 mNumberChannelDescriptions; 361 - AudioChannelDescription mChannelDescriptions[1]; 362 - }; 363 - 364 - #endif 365 - 1 + include/CoreAudio/CoreAudioTypes.h
+125
src/CoreAudio/include/CoreAudio/AudioHardware.h
··· 1 + #ifndef AUDIOHARDWARE_H 2 + #define AUDIOHARDWARE_H 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + #include <CoreAudio/CoreAudiotypes.h> 9 + #include <CoreAudio/AudioHardwareBase.h> 10 + 11 + enum 12 + { 13 + kAudioObjectSystemObject = 1 14 + }; 15 + 16 + typedef OSStatus (*AudioObjectPropertyListenerProc)(AudioObjectID inObjectID, 17 + UInt32 inNumberAddresses, const AudioObjectPropertyAddress* inAddresses, 18 + void* inClientData); 19 + 20 + #ifdef __BLOCKS__ 21 + typedef void (^AudioObjectPropertyListenerBlock)(UInt32 inNumberAddresses, 22 + const AudioObjectPropertyAddress* inAddresses); 23 + #endif 24 + 25 + void AudioObjectShow(AudioObjectID inObjectID); 26 + 27 + Boolean AudioObjectHasProperty(AudioObjectID inObjectID, 28 + const AudioObjectPropertyAddress* inAddress); 29 + 30 + OSStatus AudioObjectIsPropertySettable(AudioObjectID inObjectID, 31 + const AudioObjectPropertyAddress* inAddress, Boolean* outIsSettable); 32 + 33 + OSStatus AudioObjectGetPropertyDataSize(AudioObjectID inObjectID, 34 + const AudioObjectPropertyAddress* inAddress, UInt32 inQualifierDataSize, 35 + const void* inQualifierData, UInt32* outDataSize); 36 + 37 + OSStatus AudioObjectGetPropertyData(AudioObjectID inObjectID, 38 + const AudioObjectPropertyAddress* inAddress, UInt32 inQualifierDataSize, 39 + const void* inQualifierData, UInt32* ioDataSize, void* outData); 40 + 41 + OSStatus AudioObjectSetPropertyData(AudioObjectID inObjectID, 42 + const AudioObjectPropertyAddress* inAddress, UInt32 inQualifierDataSize, 43 + const void* inQualifierData, UInt32 inDataSize, const void* inData); 44 + 45 + OSStatus AudioObjectAddPropertyListener(AudioObjectID inObjectID, 46 + const AudioObjectPropertyAddress* inAddress, 47 + AudioObjectPropertyListenerProc inListener, void* inClientData); 48 + 49 + OSStatus AudioObjectRemovePropertyListener(AudioObjectID inObjectID, 50 + const AudioObjectPropertyAddress* inAddress, 51 + AudioObjectPropertyListenerProc inListener, void* inClientData); 52 + 53 + #ifdef __BLOCKS__ 54 + 55 + OSStatus AudioObjectAddPropertyListenerBlock(AudioObjectID inObjectID, 56 + const AudioObjectPropertyAddress* inAddress, 57 + dispatch_queue_t inDispatchQueue, AudioObjectPropertyListenerBlock inListener); 58 + 59 + OSStatus AudioObjectRemovePropertyListenerBlock(AudioObjectID inObjectID, 60 + const AudioObjectPropertyAddress* inAddress, 61 + dispatch_queue_t inDispatchQueue, AudioObjectPropertyListenerBlock inListener); 62 + 63 + #endif 64 + 65 + OSStatus AudioHardwareUnload(void); 66 + 67 + OSStatus AudioHardwareCreateAggregateDevice(CFDictionaryRef, AudioObjectID* outDeviceID); 68 + 69 + OSStatus AudioHardwareDestroyAggregateDevice(AudioObjectID inDeviceID); 70 + 71 + typedef OSStatus (*AudioDeviceIOProc)(AudioObjectID inObjectID, 72 + const AudioTimeStamp* inNow, const AudioBufferList* inInputData, 73 + const AudioTimeStamp* inInputTime, 74 + AudioBufferList* outOutputData, const AudioTimeStamp* inOutputTime, 75 + void* inClientData); 76 + 77 + typedef AudioDeviceIOProc AudioDeviceIOProcID; 78 + 79 + OSStatus AudioDeviceCreateIOProcID(AudioObjectID inDevice, 80 + AudioDeviceIOProc inProc, void* inClientData, 81 + AudioDeviceIOProcID* outIOProcID); 82 + 83 + #ifdef __BLOCKS__ 84 + 85 + typedef void (^AudioDeviceIOBlock)(const AudioTimeStamp* inNow, const AudioBufferList* inInputData, 86 + const AudioTimeStamp* inInputTime, 87 + AudioBufferList* outOutputData, const AudioTimeStamp* inOutputTime); 88 + 89 + OSStatus AudioDeviceCreateIOProcIDWithBlock(AudioDeviceIOProcID* outIOProcID, 90 + AudioObjectID inDevice, dispatch_queue_t inDispatchQueue, 91 + AudioDeviceIOBlock inIOBlock); 92 + 93 + #endif 94 + 95 + OSStatus AudioDeviceDestroyIOProcID(AudioObjectID inDevice, 96 + AudioDeviceIOProcID inIOProcID); 97 + 98 + OSStatus AudioDeviceStart(AudioObjectID inDevice, AudioDeviceIOProcID inProcID); 99 + 100 + OSStatus AudioDeviceStartAtTime(AudioObjectID inDevice, AudioDeviceIOProcID inProcID, 101 + AudioTimeStamp* ioRequestedStartTime, UInt32 inFlags); 102 + 103 + OSStatus AudioDeviceStop(AudioObjectID inDevice, AudioDeviceIOProcID inProcID); 104 + 105 + struct AudioHardwareIOProcStreamUsage 106 + { 107 + void* mIOProc; 108 + UInt32 mNumberStreams; 109 + UInt32 mStreamIsOn[1]; 110 + }; 111 + 112 + OSStatus AudioDeviceGetCurrentTime(AudioObjectID inDevice, AudioTimeStamp* outTime); 113 + 114 + OSStatus AudioDeviceTranslateTime(AudioObjectID inDevice, const AudioTimeStamp* inTime, 115 + AudioTimeStamp* outTime); 116 + 117 + OSStatus AudioDeviceGetNearestStartTime(AudioObjectID inDevice, 118 + AudioTimeStamp* ioRequestedStartTime, UInt32 inFlags); 119 + 120 + #ifdef __cplusplus 121 + } 122 + #endif 123 + 124 + #endif /* AUDIOHARDWARE_H */ 125 +
+72
src/CoreAudio/include/CoreAudio/AudioHardwareBase.h
··· 1 + #ifndef AUDIOHARDWAREBASE_H 2 + #define AUDIOHARDWAREBASE_H 3 + 4 + #ifdef __cplusplus 5 + extern "C" { 6 + #endif 7 + 8 + #include <CoreAudio/CoreAudioTypes.h> 9 + 10 + typedef UInt32 AudioObjectID; 11 + typedef UInt32 AudioClassID; 12 + typedef UInt32 AudioObjectPropertySelector; 13 + typedef UInt32 AudioObjectPropertyScope; 14 + typedef UInt32 AudioObjectPropertyElement; 15 + 16 + struct AudioObjectPropertyAddress 17 + { 18 + AudioObjectPropertySelector mSelector; 19 + AudioObjectPropertyScope mScope; 20 + AudioObjectPropertyElement mElement; 21 + }; 22 + 23 + enum 24 + { 25 + kAudioHardwareNoError = 0, 26 + kAudioHardwareNotRunningError = 'stop', 27 + kAudioHardwareUnspecifiedError = 'what', 28 + kAudioHardwareUnknownPropertyError = 'who?', 29 + kAudioHardwareBadPropertySizeError = '!siz', 30 + kAudioHardwareIllegalOperationError = 'nope', 31 + kAudioHardwareBadObjectError = '!obj', 32 + kAudioHardwareBadDeviceError = '!dev', 33 + kAudioHardwareBadStreamError = '!str', 34 + kAudioHardwareUnsupportedOperationError = 'unop', 35 + kAudioDeviceUnsupportedFormatError = '!dat', 36 + kAudioDevicePermissionsError = '!hog', 37 + }; 38 + 39 + enum 40 + { 41 + kAudioObjectPropertyScopeGlobal = 'glob', 42 + kAudioObjectPropertyScopeInput = 'inpt', 43 + kAudioObjectPropertyScopeOutput = 'outp', 44 + kAudioObjectPropertyScopePlayThrough = 'ptru', 45 + kAudioObjectPropertyElementMaster = 0, 46 + }; 47 + 48 + enum 49 + { 50 + kAudioObjectPropertyBaseClass = 'bcls', 51 + kAudioObjectPropertyClass = 'clas', 52 + kAudioObjectPropertyOwner = 'stdv', 53 + kAudioObjectPropertyName = 'lnam', 54 + kAudioObjectPropertyModelName = 'lmod', 55 + kAudioObjectPropertyManufacturer = 'lmak', 56 + kAudioObjectPropertyElementName = 'lchn', 57 + kAudioObjectPropertyElementCategoryName = 'lccn', 58 + kAudioObjectPropertyElementNumberName = 'lcnn', 59 + kAudioObjectPropertyOwnedObjects = 'ownd', 60 + kAudioObjectPropertyIdentify = 'iden', 61 + kAudioObjectPropertySerialNumber = 'snum', 62 + kAudioObjectPropertyFirmwareVersion = 'fwvn', 63 + }; 64 + 65 + // TODO: A lot more is missing 66 + 67 + #ifdef __cplusplus 68 + } 69 + #endif 70 + 71 + #endif /* AUDIOHARDWAREBASE_H */ 72 +
+78
src/CoreAudio/include/CoreAudio/AudioHardwareImpl.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2015-2016 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #ifndef AUDIOHARDWAREIMPL_H 21 + #define AUDIOHARDWAREIMPL_H 22 + #include <CoreAudio/AudioHardware.h> 23 + #include <map> 24 + #include <mutex> 25 + #include "AudioHardwareStream.h" 26 + 27 + class AudioHardwareImpl 28 + { 29 + public: 30 + AudioHardwareImpl(); 31 + virtual ~AudioHardwareImpl(); 32 + 33 + virtual void show(); 34 + virtual bool hasProperty(const AudioObjectPropertyAddress* address); 35 + virtual OSStatus getPropertyDataSize(const AudioObjectPropertyAddress* inAddress, UInt32 inQualifierDataSize, 36 + const void* inQualifierData, UInt32* outDataSize); 37 + 38 + virtual OSStatus isPropertySettable(const AudioObjectPropertyAddress* inAddress, Boolean* outIsSettable); 39 + 40 + virtual OSStatus getPropertyData(const AudioObjectPropertyAddress* inAddress, UInt32 inQualifierDataSize, 41 + const void* inQualifierData, UInt32* ioDataSize, void* outData); 42 + 43 + virtual OSStatus setPropertyData(const AudioObjectPropertyAddress* inAddress, UInt32 inQualifierDataSize, 44 + const void* inQualifierData, UInt32 inDataSize, const void* inData); 45 + 46 + virtual OSStatus addPropertyListener(const AudioObjectPropertyAddress* inAddress, 47 + AudioObjectPropertyListenerProc inListener, void* inClientData); 48 + 49 + virtual OSStatus removePropertyListener(const AudioObjectPropertyAddress* inAddress, 50 + AudioObjectPropertyListenerProc inListener, void* inClientData); 51 + 52 + OSStatus createIOProcID(AudioDeviceIOProc inProc, void* inClientData, 53 + AudioDeviceIOProcID* outIOProcID); 54 + OSStatus destroyIOProcID(AudioDeviceIOProcID inIOProcID); 55 + 56 + virtual OSStatus start(AudioDeviceIOProcID inProcID, 57 + AudioTimeStamp* ioRequestedStartTime, UInt32 inFlags); 58 + virtual OSStatus stop(AudioDeviceIOProcID inProcID); 59 + 60 + virtual OSStatus getCurrentTime(AudioTimeStamp* outTime) = 0; 61 + 62 + virtual OSStatus translateTime(const AudioTimeStamp* inTime, 63 + AudioTimeStamp* outTime) = 0; 64 + 65 + virtual OSStatus getNearestStartTime(AudioTimeStamp* ioRequestedStartTime, 66 + UInt32 inFlags) = 0; 67 + protected: 68 + virtual AudioHardwareStream* createStream(AudioDeviceIOProcID procID) = 0; 69 + protected: 70 + std::mutex m_procMutex; 71 + std::map<AudioDeviceIOProcID, std::pair<AudioDeviceIOProc, void*>> m_proc; 72 + int m_nextProcId = 1; 73 + 74 + std::map<AudioDeviceIOProcID, std::unique_ptr<AudioHardwareStream> m_streams; 75 + }; 76 + 77 + #endif /* AUDIOHARDWAREIMPL_H */ 78 +
+33
src/CoreAudio/include/CoreAudio/AudioHardwareStream.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2015-2016 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #ifndef AUDIOHARDWARESTREAM_H 21 + #define AUDIOHARDWARESTREAM_H 22 + 23 + class AudioHardwareStream 24 + { 25 + public: 26 + AudioHardwareStream(); 27 + virtual ~AudioHardwareStream(); 28 + private: 29 + 30 + }; 31 + 32 + #endif /* AUDIOHARDWARESTREAM_H */ 33 +
+365
src/CoreAudio/include/CoreAudio/CoreAudioTypes.h
··· 1 + #ifndef COREAUDIOTYPES_H 2 + #define COREAUDIOTYPES_H 3 + #include <MacTypes.h> 4 + 5 + struct AudioStreamBasicDescription 6 + { 7 + Float64 mSampleRate; 8 + UInt32 mFormatID; 9 + UInt32 mFormatFlags; 10 + UInt32 mBytesPerPacket; // 0 for VBR 11 + UInt32 mFramesPerPacket; 12 + UInt32 mBytesPerFrame; 13 + UInt32 mChannelsPerFrame; 14 + UInt32 mBitsPerChannel; 15 + UInt32 mReserved; 16 + }; 17 + 18 + struct AudioClassDescription 19 + { 20 + OSType mType; 21 + OSType mSubType; 22 + OSType mManufacturer; 23 + }; 24 + 25 + struct AudioBuffer 26 + { 27 + UInt32 mNumberChannels; 28 + UInt32 mDataByteSize; 29 + void* mData; 30 + }; 31 + 32 + struct AudioBufferList 33 + { 34 + UInt32 mNumberBuffers; 35 + AudioBuffer mBuffers[1]; 36 + }; 37 + 38 + struct AudioStreamPacketDescription 39 + { 40 + SInt64 mStartOffset; 41 + UInt32 mVariableFramesInPacket; // 0 for constant streams 42 + UInt32 mDataByteSize; 43 + }; 44 + 45 + struct SMPTETime 46 + { 47 + SInt64 mSubframes, mSubframeDivisor; 48 + UInt32 mCounter, mType, mFlags; 49 + SInt16 mHours, mMinutes, mSeconds, mFrames; 50 + }; 51 + 52 + struct AudioTimeStamp 53 + { 54 + Float64 mSampleTime; 55 + UInt64 mHostTime; 56 + Float64 mRateScalar; 57 + UInt64 mWordClockTime; 58 + SMPTETime mSMPTETime; 59 + UInt32 mFlags, mReserved; 60 + }; 61 + 62 + enum 63 + { 64 + kAudioFormatLinearPCM = 'lpcm', 65 + kAudioFormatAC3 = 'ac-3', 66 + kAudioFormat60958AC3 = 'cac3', 67 + kAudioFormatAppleIMA4 = 'ima4', 68 + kAudioFormatMPEG4AAC = 'aac ', 69 + kAudioFormatMPEG4CELP = 'celp', 70 + kAudioFormatMPEG4HVXC = 'hvxc', 71 + kAudioFormatMPEG4TwinVQ = 'twvq', 72 + kAudioFormatMACE3 = 'MAC3', 73 + kAudioFormatMACE6 = 'MAC6', 74 + kAudioFormatULaw = 'ulaw', 75 + kAudioFormatALaw = 'alaw', 76 + kAudioFormatQDesign = 'QDMC', 77 + kAudioFormatQDesign2 = 'QDM2', 78 + kAudioFormatQUALCOMM = 'Qclp', 79 + kAudioFormatMPEGLayer1 = '.mp1', 80 + kAudioFormatMPEGLayer2 = '.mp2', 81 + kAudioFormatMPEGLayer3 = '.mp3', 82 + kAudioFormatTimeCode = 'time', 83 + kAudioFormatMIDIStream = 'midi', 84 + kAudioFormatParameterValueStream = 'apvs', 85 + kAudioFormatAppleLossless = 'alac', 86 + kAudioFormatMPEG4AAC_HE = 'aach', 87 + kAudioFormatMPEG4AAC_LD = 'aacl', 88 + kAudioFormatMPEG4AAC_ELD = 'aace', 89 + kAudioFormatMPEG4AAC_ELD_SBR = 'aacf', 90 + kAudioFormatMPEG4AAC_ELD_V2 = 'aacg', 91 + kAudioFormatMPEG4AAC_HE_V2 = 'aacp', 92 + kAudioFormatMPEG4AAC_Spatial = 'aacs', 93 + kAudioFormatAMR = 'samr', 94 + kAudioFormatAudible = 'AUDB', 95 + kAudioFormatiLBC = 'ilbc', 96 + kAudioFormatDVIIntelIMA = 0x6D730011, 97 + kAudioFormatMicrosoftGSM = 0x6D730031, 98 + kAudioFormatAES3 = 'aes3' 99 + }; 100 + 101 + enum 102 + { 103 + kAudioFormatFlagIsFloat = (1 << 0), // 0x1 104 + kAudioFormatFlagIsBigEndian = (1 << 1), // 0x2 105 + kAudioFormatFlagIsSignedInteger = (1 << 2), // 0x4 106 + kAudioFormatFlagIsPacked = (1 << 3), // 0x8 107 + kAudioFormatFlagIsAlignedHigh = (1 << 4), // 0x10 108 + kAudioFormatFlagIsNonInterleaved = (1 << 5), // 0x20 109 + kAudioFormatFlagIsNonMixable = (1 << 6), // 0x40 110 + kAudioFormatFlagsAreAllClear = (1 << 31), 111 + 112 + kLinearPCMFormatFlagIsFloat = kAudioFormatFlagIsFloat, 113 + kLinearPCMFormatFlagIsBigEndian = kAudioFormatFlagIsBigEndian, 114 + kLinearPCMFormatFlagIsSignedInteger = kAudioFormatFlagIsSignedInteger, 115 + kLinearPCMFormatFlagIsPacked = kAudioFormatFlagIsPacked, 116 + kLinearPCMFormatFlagIsAlignedHigh = kAudioFormatFlagIsAlignedHigh, 117 + kLinearPCMFormatFlagIsNonInterleaved = kAudioFormatFlagIsNonInterleaved, 118 + kLinearPCMFormatFlagIsNonMixable = kAudioFormatFlagIsNonMixable, 119 + kLinearPCMFormatFlagsSampleFractionShift = 7, 120 + kLinearPCMFormatFlagsSampleFractionMask = (0x3F << kLinearPCMFormatFlagsSampleFractionShift), 121 + kLinearPCMFormatFlagsAreAllClear = kAudioFormatFlagsAreAllClear, 122 + 123 + kAppleLosslessFormatFlag_16BitSourceData = 1, 124 + kAppleLosslessFormatFlag_20BitSourceData = 2, 125 + kAppleLosslessFormatFlag_24BitSourceData = 3, 126 + kAppleLosslessFormatFlag_32BitSourceData = 4 127 + }; 128 + 129 + enum // typedef UInt32 AudioConverterPropertyID 130 + { 131 + kAudioConverterPropertyMinimumInputBufferSize = 'mibs', 132 + kAudioConverterPropertyMinimumOutputBufferSize = 'mobs', 133 + kAudioConverterPropertyMaximumInputBufferSize = 'xibs', 134 + kAudioConverterPropertyMaximumInputPacketSize = 'xips', 135 + kAudioConverterPropertyMaximumOutputPacketSize = 'xops', 136 + kAudioConverterPropertyCalculateInputBufferSize = 'cibs', 137 + kAudioConverterPropertyCalculateOutputBufferSize = 'cobs', 138 + kAudioConverterPropertyInputCodecParameters = 'icdp', 139 + kAudioConverterPropertyOutputCodecParameters = 'ocdp', 140 + kAudioConverterSampleRateConverterAlgorithm = 'srci', 141 + kAudioConverterSampleRateConverterComplexity = 'srca', 142 + kAudioConverterSampleRateConverterQuality = 'srcq', 143 + kAudioConverterSampleRateConverterInitialPhase = 'srcp', 144 + kAudioConverterCodecQuality = 'cdqu', 145 + kAudioConverterPrimeMethod = 'prmm', 146 + kAudioConverterPrimeInfo = 'prim', 147 + kAudioConverterChannelMap = 'chmp', 148 + kAudioConverterDecompressionMagicCookie = 'dmgc', 149 + kAudioConverterCompressionMagicCookie = 'cmgc', 150 + kAudioConverterEncodeBitRate = 'brat', 151 + kAudioConverterEncodeAdjustableSampleRate = 'ajsr', 152 + kAudioConverterInputChannelLayout = 'icl ', 153 + kAudioConverterOutputChannelLayout = 'ocl ', 154 + kAudioConverterApplicableEncodeBitRates = 'aebr', 155 + kAudioConverterAvailableEncodeBitRates = 'vebr', 156 + kAudioConverterApplicableEncodeSampleRates = 'aesr', 157 + kAudioConverterAvailableEncodeSampleRates = 'vesr', 158 + kAudioConverterAvailableEncodeChannelLayoutTags = 'aecl', 159 + kAudioConverterCurrentOutputStreamDescription = 'acod', 160 + kAudioConverterCurrentInputStreamDescription = 'acid', 161 + kAudioConverterPropertySettings = 'acps', 162 + kAudioConverterPropertyBitDepthHint = 'acbd', 163 + kAudioConverterPropertyFormatList = 'flst', 164 + kAudioConverterPropertyDithering = 'dith', 165 + kAudioConverterPropertyDitherBitDepth = 'dbit' 166 + }; 167 + 168 + enum { 169 + kAudioChannelLayoutTag_UseChannelDescriptions = (0<<16) | 0, 170 + kAudioChannelLayoutTag_UseChannelBitmap = (1<<16) | 0, 171 + 172 + kAudioChannelLayoutTag_Mono = (100<<16) | 1, 173 + kAudioChannelLayoutTag_Stereo = (101<<16) | 2, 174 + kAudioChannelLayoutTag_StereoHeadphones = (102<<16) | 2, 175 + kAudioChannelLayoutTag_MatrixStereo = (103<<16) | 2, 176 + kAudioChannelLayoutTag_MidSide = (104<<16) | 2, 177 + kAudioChannelLayoutTag_XY = (105<<16) | 2, 178 + kAudioChannelLayoutTag_Binaural = (106<<16) | 2, 179 + kAudioChannelLayoutTag_Ambisonic_B_Format = (107<<16) | 4, 180 + kAudioChannelLayoutTag_Quadraphonic = (108<<16) | 4, 181 + kAudioChannelLayoutTag_Pentagonal = (109<<16) | 5, 182 + kAudioChannelLayoutTag_Hexagonal = (110<<16) | 6, 183 + kAudioChannelLayoutTag_Octagonal = (111<<16) | 8, 184 + kAudioChannelLayoutTag_Cube = (112<<16) | 8, 185 + 186 + 187 + kAudioChannelLayoutTag_MPEG_1_0 = kAudioChannelLayoutTag_Mono, 188 + kAudioChannelLayoutTag_MPEG_2_0 = kAudioChannelLayoutTag_Stereo, 189 + kAudioChannelLayoutTag_MPEG_3_0_A = (113<<16) | 3, 190 + kAudioChannelLayoutTag_MPEG_3_0_B = (114<<16) | 3, 191 + kAudioChannelLayoutTag_MPEG_4_0_A = (115<<16) | 4, 192 + kAudioChannelLayoutTag_MPEG_4_0_B = (116<<16) | 4, 193 + kAudioChannelLayoutTag_MPEG_5_0_A = (117<<16) | 5, 194 + kAudioChannelLayoutTag_MPEG_5_0_B = (118<<16) | 5, 195 + kAudioChannelLayoutTag_MPEG_5_0_C = (119<<16) | 5, 196 + kAudioChannelLayoutTag_MPEG_5_0_D = (120<<16) | 5, 197 + kAudioChannelLayoutTag_MPEG_5_1_A = (121<<16) | 6, 198 + kAudioChannelLayoutTag_MPEG_5_1_B = (122<<16) | 6, 199 + kAudioChannelLayoutTag_MPEG_5_1_C = (123<<16) | 6, 200 + kAudioChannelLayoutTag_MPEG_5_1_D = (124<<16) | 6, 201 + kAudioChannelLayoutTag_MPEG_6_1_A = (125<<16) | 7, 202 + kAudioChannelLayoutTag_MPEG_7_1_A = (126<<16) | 8, 203 + kAudioChannelLayoutTag_MPEG_7_1_B = (127<<16) | 8, 204 + kAudioChannelLayoutTag_MPEG_7_1_C = (128<<16) | 8, 205 + kAudioChannelLayoutTag_Emagic_Default_7_1 = (129<<16) | 8, 206 + kAudioChannelLayoutTag_SMPTE_DTV = (130<<16) | 8, 207 + 208 + 209 + kAudioChannelLayoutTag_ITU_1_0 = kAudioChannelLayoutTag_Mono, 210 + kAudioChannelLayoutTag_ITU_2_0 = kAudioChannelLayoutTag_Stereo, 211 + kAudioChannelLayoutTag_ITU_2_1 = (131<<16) | 3, 212 + kAudioChannelLayoutTag_ITU_2_2 = (132<<16) | 4, 213 + kAudioChannelLayoutTag_ITU_3_0 = 214 + kAudioChannelLayoutTag_MPEG_3_0_A, 215 + kAudioChannelLayoutTag_ITU_3_1 = 216 + kAudioChannelLayoutTag_MPEG_4_0_A, 217 + kAudioChannelLayoutTag_ITU_3_2 = 218 + kAudioChannelLayoutTag_MPEG_5_0_A, 219 + kAudioChannelLayoutTag_ITU_3_2_1 = 220 + kAudioChannelLayoutTag_MPEG_5_1_A, 221 + kAudioChannelLayoutTag_ITU_3_4_1 = 222 + kAudioChannelLayoutTag_MPEG_7_1_C, 223 + 224 + 225 + kAudioChannelLayoutTag_DVD_0 = kAudioChannelLayoutTag_Mono, 226 + kAudioChannelLayoutTag_DVD_1 = kAudioChannelLayoutTag_Stereo, 227 + kAudioChannelLayoutTag_DVD_2 = kAudioChannelLayoutTag_ITU_2_1, 228 + kAudioChannelLayoutTag_DVD_3 = kAudioChannelLayoutTag_ITU_2_2, 229 + kAudioChannelLayoutTag_DVD_4 = (133<<16) | 3, 230 + kAudioChannelLayoutTag_DVD_5 = (134<<16) | 4, 231 + kAudioChannelLayoutTag_DVD_6 = (135<<16) | 5, 232 + kAudioChannelLayoutTag_DVD_7 = 233 + kAudioChannelLayoutTag_MPEG_3_0_A, 234 + kAudioChannelLayoutTag_DVD_8 = 235 + kAudioChannelLayoutTag_MPEG_4_0_A, 236 + kAudioChannelLayoutTag_DVD_9 = 237 + kAudioChannelLayoutTag_MPEG_5_0_A, 238 + kAudioChannelLayoutTag_DVD_10 = (136<<16) | 4, 239 + kAudioChannelLayoutTag_DVD_11 = (137<<16) | 5, 240 + kAudioChannelLayoutTag_DVD_12 = 241 + kAudioChannelLayoutTag_MPEG_5_1_A, 242 + kAudioChannelLayoutTag_DVD_13 = kAudioChannelLayoutTag_DVD_8, 243 + kAudioChannelLayoutTag_DVD_14 = kAudioChannelLayoutTag_DVD_9, 244 + kAudioChannelLayoutTag_DVD_15 = kAudioChannelLayoutTag_DVD_10, 245 + kAudioChannelLayoutTag_DVD_16 = kAudioChannelLayoutTag_DVD_11, 246 + kAudioChannelLayoutTag_DVD_17 = kAudioChannelLayoutTag_DVD_12, 247 + kAudioChannelLayoutTag_DVD_18 = (138<<16) | 5, 248 + kAudioChannelLayoutTag_DVD_19 = 249 + kAudioChannelLayoutTag_MPEG_5_0_B, 250 + kAudioChannelLayoutTag_DVD_20 = 251 + kAudioChannelLayoutTag_MPEG_5_1_B, 252 + 253 + 254 + kAudioChannelLayoutTag_AudioUnit_4 = 255 + kAudioChannelLayoutTag_Quadraphonic, 256 + kAudioChannelLayoutTag_AudioUnit_5 = 257 + kAudioChannelLayoutTag_Pentagonal, 258 + kAudioChannelLayoutTag_AudioUnit_6 = 259 + kAudioChannelLayoutTag_Hexagonal, 260 + kAudioChannelLayoutTag_AudioUnit_8 = 261 + kAudioChannelLayoutTag_Octagonal, 262 + 263 + kAudioChannelLayoutTag_AudioUnit_5_0 = 264 + kAudioChannelLayoutTag_MPEG_5_0_B, 265 + kAudioChannelLayoutTag_AudioUnit_6_0 = (139<<16) | 6, 266 + kAudioChannelLayoutTag_AudioUnit_7_0 = (140<<16) | 7, 267 + kAudioChannelLayoutTag_AudioUnit_7_0_Front = (148<<16) | 7, 268 + kAudioChannelLayoutTag_AudioUnit_5_1 = 269 + kAudioChannelLayoutTag_MPEG_5_1_A, 270 + kAudioChannelLayoutTag_AudioUnit_6_1 = 271 + kAudioChannelLayoutTag_MPEG_6_1_A, 272 + kAudioChannelLayoutTag_AudioUnit_7_1 = 273 + kAudioChannelLayoutTag_MPEG_7_1_C, 274 + kAudioChannelLayoutTag_AudioUnit_7_1_Front = 275 + kAudioChannelLayoutTag_MPEG_7_1_A, 276 + 277 + kAudioChannelLayoutTag_AAC_3_0 = 278 + kAudioChannelLayoutTag_MPEG_3_0_B, 279 + kAudioChannelLayoutTag_AAC_Quadraphonic = 280 + kAudioChannelLayoutTag_Quadraphonic, 281 + kAudioChannelLayoutTag_AAC_4_0 = 282 + kAudioChannelLayoutTag_MPEG_4_0_B, 283 + kAudioChannelLayoutTag_AAC_5_0 = 284 + kAudioChannelLayoutTag_MPEG_5_0_D, 285 + kAudioChannelLayoutTag_AAC_5_1 = 286 + kAudioChannelLayoutTag_MPEG_5_1_D, 287 + kAudioChannelLayoutTag_AAC_6_0 = (141<<16) | 6, 288 + kAudioChannelLayoutTag_AAC_6_1 = (142<<16) | 7, 289 + kAudioChannelLayoutTag_AAC_7_0 = (143<<16) | 7, 290 + kAudioChannelLayoutTag_AAC_7_1 = 291 + kAudioChannelLayoutTag_MPEG_7_1_B, 292 + kAudioChannelLayoutTag_AAC_Octagonal = (144<<16) | 8, 293 + 294 + kAudioChannelLayoutTag_TMH_10_2_std = (145<<16) | 16, 295 + kAudioChannelLayoutTag_TMH_10_2_full = (146<<16) | 21, 296 + 297 + kAudioChannelLayoutTag_AC3_1_0_1 = (149<<16) | 2, 298 + kAudioChannelLayoutTag_AC3_3_0 = (150<<16) | 3, 299 + kAudioChannelLayoutTag_AC3_3_1 = (151<<16) | 4, 300 + kAudioChannelLayoutTag_AC3_3_0_1 = (152<<16) | 4, 301 + kAudioChannelLayoutTag_AC3_2_1_1 = (153<<16) | 4, 302 + kAudioChannelLayoutTag_AC3_3_1_1 = (154<<16) | 5, 303 + 304 + kAudioChannelLayoutTag_EAC_6_0_A = (155<<16) | 6, 305 + kAudioChannelLayoutTag_EAC_7_0_A = (156<<16) | 7, 306 + kAudioChannelLayoutTag_EAC3_6_1_A = (157<<16) | 7, 307 + kAudioChannelLayoutTag_EAC3_6_1_B = (158<<16) | 7, 308 + kAudioChannelLayoutTag_EAC3_6_1_C = (159<<16) | 7, 309 + kAudioChannelLayoutTag_EAC3_7_1_A = (160<<16) | 8, 310 + kAudioChannelLayoutTag_EAC3_7_1_B = (161<<16) | 8, 311 + kAudioChannelLayoutTag_EAC3_7_1_C = (162<<16) | 8, 312 + kAudioChannelLayoutTag_EAC3_7_1_D = (163<<16) | 8, 313 + kAudioChannelLayoutTag_EAC3_7_1_E = (164<<16) | 8, 314 + kAudioChannelLayoutTag_EAC3_7_1_F = (165<<16) | 8, 315 + kAudioChannelLayoutTag_EAC3_7_1_G = (166<<16) | 8, 316 + kAudioChannelLayoutTag_EAC3_7_1_H = (167<<16) | 8, 317 + 318 + kAudioChannelLayoutTag_DTS_3_1 = (168<<16) | 4, 319 + kAudioChannelLayoutTag_DTS_4_1 = (169<<16) | 5, 320 + kAudioChannelLayoutTag_DTS_6_0_A = (170<<16) | 6, 321 + kAudioChannelLayoutTag_DTS_6_0_B = (171<<16) | 6, 322 + kAudioChannelLayoutTag_DTS_6_0_C = (172<<16) | 6, 323 + kAudioChannelLayoutTag_DTS_6_1_A = (173<<16) | 7, 324 + kAudioChannelLayoutTag_DTS_6_1_B = (174<<16) | 7, 325 + kAudioChannelLayoutTag_DTS_6_1_C = (175<<16) | 7, 326 + kAudioChannelLayoutTag_DTS_6_1_D = (182<<16) | 7, 327 + kAudioChannelLayoutTag_DTS_7_0 = (176<<16) | 7, 328 + kAudioChannelLayoutTag_DTS_7_1 = (177<<16) | 8, 329 + kAudioChannelLayoutTag_DTS_8_0_A = (178<<16) | 8, 330 + kAudioChannelLayoutTag_DTS_8_0_B = (179<<16) | 8, 331 + kAudioChannelLayoutTag_DTS_8_1_A = (180<<16) | 9, 332 + kAudioChannelLayoutTag_DTS_8_1_B = (181<<16) | 9, 333 + 334 + kAudioChannelLayoutTag_DiscreteInOrder = (147<<16) | 0, 335 + kAudioChannelLayoutTag_Unknown = 0xFFFF0000 336 + }; 337 + 338 + enum { 339 + kAudioConverterErr_PropertyNotSupported = 'prop', 340 + kAudioConverterErr_BadPropertySizeError = '!siz', 341 + kAudioConverterErr_FormatNotSupported = 'fmt?', 342 + kAudioConverterErr_OperationNotSupported = 0x6F703F3F, 343 + kAudioConverterErr_UnspecifiedError = 'what', 344 + }; 345 + 346 + typedef UInt32 AudioChannelLabel; 347 + typedef UInt32 AudioChannelLayoutTag; 348 + 349 + struct AudioChannelDescription 350 + { 351 + AudioChannelLabel mChannelLabel; 352 + UInt32 mChannelFlags; 353 + Float32 mCoordinates[3]; 354 + }; 355 + 356 + struct AudioChannelLayout 357 + { 358 + AudioChannelLayoutTag mChannelLayoutTag; 359 + UInt32 mChannelBitmap; 360 + UInt32 mNumberChannelDescriptions; 361 + AudioChannelDescription mChannelDescriptions[1]; 362 + }; 363 + 364 + #endif 365 +
+1 -44
src/CoreServices/Components.h
··· 1 - #ifndef COMPONENTS_H 2 - #define COMPONENTS_H 3 - #include <MacTypes.h> 4 - 5 - #ifdef __cplusplus 6 - class CarbonComponent; 7 - #else 8 - struct __CarbonComponent; 9 - typedef struct __CarbonComponent CarbonComponent; 10 - #endif 11 - struct ComponentDescription; 12 - typedef struct ComponentDescription ComponentDescription; 13 - 14 - typedef CarbonComponent* ComponentInstance; 15 - typedef void* Component; 16 - 17 - #ifdef __cplusplus 18 - extern "C" { 19 - #endif 20 - 21 - Component FindNextComponent(Component prev, ComponentDescription* desc); 22 - long CountComponents(ComponentDescription* desc); 23 - 24 - OSErr OpenAComponent(Component comp, ComponentInstance* out); 25 - ComponentInstance OpenComponent(Component comp); 26 - OSErr CloseComponent(ComponentInstance inst); 27 - 28 - #ifdef __cplusplus 29 - } 30 - #endif 31 - 32 - struct ComponentDescription 33 - { 34 - OSType componentType, componentSubType, componentManufacturer; 35 - UInt32 componentFlags, componentFlagsMask; 36 - }; 37 - 38 - enum 39 - { 40 - kAppleManufacturer = 'appl' 41 - }; 42 - 43 - #endif 44 - 1 + include/CoreServices/Components.h
+1 -35
src/CoreServices/ComponentsInternal.h
··· 1 - #ifndef COMPONENTSINTERNAL_H 2 - #define COMPONENTSINTERNAL_H 3 - 4 - class CarbonComponent 5 - { 6 - public: 7 - virtual ~CarbonComponent() {} 8 - }; 9 - 10 - inline static UInt32 GetComponentType(Component comp) 11 - { 12 - long l = long(comp); 13 - return l & 0xffff0000; 14 - } 15 - 16 - inline static UInt32 GetComponentIndex(Component comp) 17 - { 18 - long l = long(comp); 19 - return l & 0xffff; 20 - } 21 - 22 - inline static Component CreateComponent(UInt32 type, UInt32 index) 23 - { 24 - long l = type & 0xffff0000; 25 - l |= (index & 0xffff); 26 - return (void*) l; 27 - } 28 - 29 - enum 30 - { 31 - kComponentTypeAudioUnit = 'au\0\0' 32 - }; 33 - 34 - #endif 35 - 1 + include/CoreServices/ComponentsInternal.h
+1 -85
src/CoreServices/CoreEndian.h
··· 1 - /* 2 - This file is part of Darling. 3 - 4 - Copyright (C) 2013 Lubos Dolezel 5 - 6 - Darling is free software: you can redistribute it and/or modify 7 - it under the terms of the GNU General Public License as published by 8 - the Free Software Foundation, either version 3 of the License, or 9 - (at your option) any later version. 10 - 11 - Darling is distributed in the hope that it will be useful, 12 - but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - GNU General Public License for more details. 15 - 16 - You should have received a copy of the GNU General Public License 17 - along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 - */ 19 - 20 - #ifndef COREENDIAN_H 21 - #define COREENDIAN_H 22 - #include <MacTypes.h> 23 - #include <stdint.h> 24 - 25 - #ifdef __cplusplus 26 - extern "C" { 27 - #endif 28 - 29 - UInt16 Endian16_Swap(UInt16 value); 30 - UInt32 Endian32_Swap(UInt32 value); 31 - UInt64 Endian64_Swap(UInt64 value); 32 - 33 - SInt16 EndianS16_BtoL(SInt16 value); 34 - SInt16 EndianS16_BtoN(SInt16 value); 35 - SInt16 EndianS16_LtoB(SInt16 value); 36 - SInt16 EndianS16_LtoN(SInt16 value); 37 - SInt16 EndianS16_NtoB(SInt16 value); 38 - SInt16 EndianS16_NtoL(SInt16 value); 39 - 40 - SInt32 EndianS32_BtoL(SInt32 value); 41 - SInt32 EndianS32_BtoN(SInt32 value); 42 - SInt32 EndianS32_LtoB(SInt32 value); 43 - SInt32 EndianS32_LtoN(SInt32 value); 44 - SInt32 EndianS32_NtoB(SInt32 value); 45 - SInt32 EndianS32_NtoL(SInt32 value); 46 - 47 - SInt64 EndianS64_BtoL(SInt64 value); 48 - SInt64 EndianS64_BtoN(SInt64 value); 49 - SInt64 EndianS64_LtoB(SInt64 value); 50 - SInt64 EndianS64_LtoN(SInt64 value); 51 - SInt64 EndianS64_NtoB(SInt64 value); 52 - SInt64 EndianS64_NtoL(SInt64 value); 53 - 54 - UInt16 EndianU16_BtoL(UInt16 value); 55 - UInt16 EndianU16_BtoN(UInt16 value); 56 - UInt16 EndianU16_LtoB(UInt16 value); 57 - UInt16 EndianU16_LtoN(UInt16 value); 58 - UInt16 EndianU16_NtoB(UInt16 value); 59 - UInt16 EndianU16_NtoL(UInt16 value); 60 - 61 - UInt32 EndianU32_BtoL(UInt32 value); 62 - UInt32 EndianU32_BtoN(UInt32 value); 63 - UInt32 EndianU32_LtoB(UInt32 value); 64 - UInt32 EndianU32_LtoN(UInt32 value); 65 - UInt32 EndianU32_NtoB(UInt32 value); 66 - UInt32 EndianU32_NtoL(UInt32 value); 67 - 68 - UInt64 EndianU64_BtoL(UInt64 value); 69 - UInt64 EndianU64_BtoN(UInt64 value); 70 - UInt64 EndianU64_LtoB(UInt64 value); 71 - UInt64 EndianU64_LtoN(UInt64 value); 72 - UInt64 EndianU64_NtoB(UInt64 value); 73 - UInt64 EndianU64_NtoL(UInt64 value); 74 - 75 - typedef OSStatus (*CEFlipper)(uint32_t dataDomain, uint32_t dataType, int16_t id, void* data, unsigned long length, Boolean isNative, void* opaque); 76 - 77 - OSStatus CoreEndianFlipData(uint32_t dataDomain, uint32_t dataType, int16_t id, void* data, unsigned long length, Boolean isNative); 78 - OSStatus CoreEndianInstallFlipper(uint32_t dataDomain, uint32_t dataType, CEFlipper flipper, void* opaque); 79 - OSStatus CoreEndianGetFlipper(uint32_t dataDomain, uint32_t dataType, CEFlipper* flipper, void** opaque); 80 - 81 - #ifdef __cplusplus 82 - } 83 - #endif 84 - 85 - #endif 1 + include/CoreServices/CoreEndian.h
+1 -30
src/CoreServices/CoreServices.h
··· 1 - #ifndef _CORESERVICES_CORESERVICES_H_ 2 - #define _CORESERVICES_CORESERVICES_H_ 3 - 4 - #include <CoreServices/Components.h> 5 - #include <CoreServices/CoreEndian.h> 6 - #include <CoreServices/DateTimeUtils.h> 7 - #include <CoreServices/DriverServices.h> 8 - #include <CoreServices/DriverSynchronization.h> 9 - #include <CoreServices/FileManager.h> 10 - #include <CoreServices/FixMath.h> 11 - #include <CoreServices/Gestalt.h> 12 - #include <CoreServices/LaunchServices.h> 13 - #include <CoreServices/MacErrors.h> 14 - #include <CoreServices/MacMemory.h> 15 - #include <MacTypes.h> 16 - #include <CoreServices/Math64.h> 17 - #include <CoreServices/Multiprocessing.h> 18 - #include <CoreServices/OpenTransport.h> 19 - #include <CoreServices/Processes.h> 20 - #include <CoreServices/ScriptManager.h> 21 - #include <CoreServices/TextUtils.h> 22 - #include <CoreServices/Timer.h> 23 - #include <CoreServices/ToolUtils.h> 24 - #include <CoreServices/UniChar.h> 25 - #include <CoreServices/UnicodeUtilities.h> 26 - #include <CoreServices/TextCommon.h> 27 - #include <CoreServices/TextEncodingConverter.h> 28 - 29 - #endif 30 - 1 + include/CoreServices/CoreServices.h
+1 -24
src/CoreServices/CoreServicesPriv.h
··· 1 - #ifndef CORESERVICESPRIV_H_ 2 - #define CORESERVICESPRIV_H_ 3 - 4 - #include <CoreFoundation/CFString.h> 5 - #include <CoreFoundation/CFURLPriv.h> 6 - 7 - CF_EXTERN_C_BEGIN 8 - 9 - Boolean _CSCheckFix(CFStringRef str); 10 - 11 - // Assumed 12 - #define kLSDownloadRiskCategoryKey CFSTR("LSDownloadRiskCategory") 13 - 14 - #define kLSRiskCategorySafe "LSRiskCategorySafe" 15 - #define kLSRiskCategoryNeutral "LSRiskCategoryNeutral" 16 - #define kLSRiskCategoryUnknown "LSRiskCategoryUnknown" 17 - #define kLSRiskCategoryMayContainUnsafeExecutable "LSRiskCategoryMayContainUnsafeExecutable" 18 - 19 - // Also assumed 20 - #define QTN_FLAG_ASSESSMENT_OK 1 21 - 22 - CF_EXTERN_C_END 23 - 24 - #endif 1 + include/CoreServices/CoreServicesPriv.h
+1 -71
src/CoreServices/DateTimeUtils.h
··· 1 - /* 2 - This file is part of Darling. 3 - 4 - Copyright (C) 2012-2013 Lubos Dolezel 5 - 6 - Darling is free software: you can redistribute it and/or modify 7 - it under the terms of the GNU General Public License as published by 8 - the Free Software Foundation, either version 3 of the License, or 9 - (at your option) any later version. 10 - 11 - Darling is distributed in the hope that it will be useful, 12 - but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - GNU General Public License for more details. 15 - 16 - You should have received a copy of the GNU General Public License 17 - along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 - */ 19 - 20 - 21 - #ifndef UTCUTILS_H 22 - #define UTCUTILS_H 23 - #include <stdint.h> 24 - #include <time.h> 25 - #include <CoreFoundation/CFDate.h> 26 - #include "MacErrors.h" 27 - 28 - #define UNIX_OFFSET 2082844800ll // 1970 - 1904 29 - #define CF_OFFSET 3061152000ll // 2001 - 1904: "Seconds" is since 2001+ 30 - 31 - #pragma pack(2) 32 - struct UTCDateTime 33 - { 34 - uint16_t highSeconds; 35 - uint32_t lowSeconds; 36 - uint16_t fraction; 37 - }; 38 - #pragma pack() 39 - 40 - typedef struct UTCDateTime LocalDateTime; 41 - typedef struct UTCDateTime* UTCDateTimePtr; 42 - typedef struct UTCDateTime** UTCDateTimeHandle; 43 - typedef LocalDateTime* LocalDateTimePtr; 44 - typedef LocalDateTime** LocalDateTimeHandle; 45 - 46 - #ifdef __cplusplus 47 - extern "C" { 48 - #endif 49 - 50 - OSErr UCConvertUTCDateTimeToCFAbsoluteTime(const UTCDateTimePtr in, CFAbsoluteTime* out); 51 - OSErr UCConvertSecondsToCFAbsoluteTime(uint32_t seconds, CFAbsoluteTime* out); 52 - OSErr UCConvertLongDateTimeToCFAbsoluteTime(int64_t seconds, CFAbsoluteTime* out); 53 - OSErr UCConvertCFAbsoluteTimeToUTCDateTime(CFAbsoluteTime in, UTCDateTimePtr out); 54 - OSErr UCConvertCFAbsoluteTimeToSeconds(CFAbsoluteTime in, uint32_t* out); 55 - OSErr UCConvertCFAbsoluteTimeToLongDateTime(CFAbsoluteTime in, int64_t* out); 56 - 57 - // Seconds since 1.1.1904 58 - void GetDateTime(unsigned long* secs); 59 - 60 - #ifdef __cplusplus 61 - } 62 - 63 - namespace Darling 64 - { 65 - UTCDateTime time_tToUTC(time_t t); 66 - } 67 - 68 - #endif 69 - 70 - #endif 71 - 1 + include/CoreServices/DateTimeUtils.h
+1 -78
src/CoreServices/DriverServices.h
··· 1 - /* 2 - This file is part of Darling. 3 - 4 - Copyright (C) 2013 Lubos Dolezel 5 - 6 - Darling is free software: you can redistribute it and/or modify 7 - it under the terms of the GNU General Public License as published by 8 - the Free Software Foundation, either version 3 of the License, or 9 - (at your option) any later version. 10 - 11 - Darling is distributed in the hope that it will be useful, 12 - but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - GNU General Public License for more details. 15 - 16 - You should have received a copy of the GNU General Public License 17 - along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 - */ 19 - 20 - #ifndef DRIVERSERVICES_H 21 - #define DRIVERSERVICES_H 22 - #include <MacTypes.h> 23 - #include <limits.h> 24 - 25 - #ifdef __cplusplus 26 - extern "C" { 27 - #endif 28 - 29 - typedef UnsignedWide Nanoseconds; 30 - 31 - enum 32 - { 33 - durationMicrosecond = -1L, 34 - durationMillisecond = 1, 35 - durationSecond = 1000, 36 - durationMinute = 60*1000, 37 - durationHour = 60*60*1000, 38 - durationDay = 60*60*1000*24, 39 - durationNoWait = 0, 40 - durationForever = INT_MAX 41 - }; 42 - 43 - AbsoluteTime UpTime(); 44 - 45 - Nanoseconds AbsoluteToNanoseconds(AbsoluteTime absTime); 46 - 47 - Duration AbsoluteToDuration(AbsoluteTime absTime); 48 - 49 - AbsoluteTime NanosecondsToAbsolute(Nanoseconds ns); 50 - 51 - AbsoluteTime DurationToAbsolute(Duration duration); 52 - 53 - AbsoluteTime AddAbsoluteToAbsolute(AbsoluteTime time1, AbsoluteTime time2); 54 - 55 - AbsoluteTime SubAbsoluteFromAbsolute(AbsoluteTime time1, AbsoluteTime time2); 56 - 57 - AbsoluteTime AddNanosecondsToAbsolute(Nanoseconds ns, AbsoluteTime absTime); 58 - 59 - AbsoluteTime AddDurationToAbsolute(Duration duration, AbsoluteTime absTime); 60 - 61 - AbsoluteTime SubNanosecondsFromAbsolute(Nanoseconds ns, AbsoluteTime absTime); 62 - 63 - AbsoluteTime SubDurationFromAbsolute(Duration duration, AbsoluteTime absTime); 64 - 65 - Nanoseconds AbsoluteDeltaToNanoseconds(AbsoluteTime time1, AbsoluteTime time2); 66 - 67 - Duration AbsoluteDeltaToDuration(AbsoluteTime time1, AbsoluteTime time2); 68 - 69 - Nanoseconds DurationToNanoseconds(Duration duration); 70 - 71 - Duration NanosecondsToDuration(Nanoseconds ns); 72 - 73 - #ifdef __cplusplus 74 - } 75 - #endif 76 - 77 - #endif 78 - 1 + include/CoreServices/DriverServices.h
+1 -76
src/CoreServices/DriverSynchronization.h
··· 1 - /* 2 - This file is part of Darling. 3 - 4 - Copyright (C) 2013 Lubos Dolezel 5 - 6 - Darling is free software: you can redistribute it and/or modify 7 - it under the terms of the GNU General Public License as published by 8 - the Free Software Foundation, either version 3 of the License, or 9 - (at your option) any later version. 10 - 11 - Darling is distributed in the hope that it will be useful, 12 - but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - GNU General Public License for more details. 15 - 16 - You should have received a copy of the GNU General Public License 17 - along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 - */ 19 - 20 - #ifndef DRIVERSYNCHRONIZATION_H 21 - #define DRIVERSYNCHRONIZATION_H 22 - 23 - #include "MacTypes.h" 24 - 25 - #ifdef __cplusplus 26 - extern "C" { 27 - #endif 28 - 29 - Boolean CompareAndSwap(UInt32 old, UInt32 _new, UInt32* ptr); 30 - 31 - Boolean TestAndClear(UInt32 bit, UInt8* ptr); 32 - 33 - Boolean TestAndSet(UInt32 bit, UInt8* ptr) ; 34 - 35 - SInt8 IncrementAtomic8(SInt8* ptr); 36 - 37 - SInt8 DecrementAtomic8(SInt8* ptr); 38 - 39 - SInt8 AddAtomic8(SInt32 val, SInt8* ptr); 40 - 41 - UInt8 BitAndAtomic8(UInt32 val, UInt8* ptr); 42 - 43 - UInt8 BitOrAtomic8(UInt32 val, UInt8* ptr); 44 - 45 - UInt8 BitXorAtomic8(UInt32 val, UInt8* ptr); 46 - 47 - SInt16 IncrementAtomic16(SInt16* ptr); 48 - 49 - SInt16 DecrementAtomic16(SInt16* ptr); 50 - 51 - SInt16 AddAtomic16(SInt32 val, SInt16* ptr); 52 - 53 - UInt16 BitAndAtomic16(UInt32 val, UInt16* ptr); 54 - 55 - UInt16 BitOrAtomic16(UInt32 val, UInt16* ptr); 56 - 57 - UInt16 BitXorAtomic16(UInt32 val, UInt16* ptr); 58 - 59 - SInt32 IncrementAtomic(SInt32* ptr); 60 - 61 - SInt32 DecrementAtomic(SInt32* ptr); 62 - 63 - SInt32 AddAtomic(SInt32 val, SInt32* ptr); 64 - 65 - UInt32 BitAndAtomic(UInt32 val, UInt32* ptr); 66 - 67 - UInt32 BitOrAtomic(UInt32 val, UInt32* ptr); 68 - 69 - UInt32 BitXorAtomic(UInt32 val, UInt32* ptr); 70 - 71 - #ifdef __cplusplus 72 - } 73 - #endif 74 - 75 - #endif 76 - 1 + include/CoreServices/DriverSynchronization.h
+1 -74
src/CoreServices/FixMath.h
··· 1 - /* 2 - This file is part of Darling. 3 - 4 - Copyright (C) 2012-2013 Lubos Dolezel 5 - 6 - Darling is free software: you can redistribute it and/or modify 7 - it under the terms of the GNU General Public License as published by 8 - the Free Software Foundation, either version 3 of the License, or 9 - (at your option) any later version. 10 - 11 - Darling is distributed in the hope that it will be useful, 12 - but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - GNU General Public License for more details. 15 - 16 - You should have received a copy of the GNU General Public License 17 - along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 - */ 19 - 20 - #ifndef FIXMATH_H 21 - #define FIXMATH_H 22 - #include "MacTypes.h" 23 - #include <stdint.h> 24 - 25 - #ifdef __cplusplus 26 - extern "C" { 27 - #endif 28 - 29 - float FixedToFloat(Fixed f); 30 - Fixed FloatToFixed(float f); 31 - 32 - Fract FloatToFract(float f); 33 - float FractToFloat(Fract f); 34 - 35 - Fixed FixRatio(short n, short denominator); 36 - Fixed FixMul(Fixed a, Fixed b); 37 - short FixRound(Fixed f); 38 - Fract Fix2Frac(Fixed f); 39 - int32_t Fix2Long(Fixed f); 40 - Fixed Long2Fix(int32_t v); 41 - Fixed Frac2Fix(Fract f); 42 - 43 - Fract FracMul(Fract x, Fract y); 44 - Fixed FixDiv(Fixed x, Fixed y); 45 - Fract FracDiv(Fract x, Fract y); 46 - Fract FracSqrt(Fract x); 47 - Fract FracSin(Fixed x); 48 - Fract FracCos(Fixed x); 49 - Fixed FixATan2(int32_t x, int32_t y); 50 - 51 - double Frac2X(Fract f); 52 - double Fix2X(Fract f); 53 - Fixed X2Fix(double d); 54 - Fract X2Frac(double d); 55 - 56 - short WideCompare(const wide* a, const wide* b); 57 - wide* WideAdd(wide* dst, const wide* val); 58 - wide* WideSubtract(wide* dst, const wide* val); 59 - wide* WideNegate(wide* val); 60 - wide* WideShift(wide* dst, int32_t shift); // rounds upwards 61 - uint32_t WideSquareRoot(const wide* val); 62 - wide* WideMultiply(int32_t a, int32_t b, wide* dst); 63 - int32_t WideDivide(const wide* divd, int32_t divs, int32_t* remainder); 64 - wide* WideWideDivide(wide* divd, int32_t divs, int32_t* remainder); 65 - wide* WideBitShift(wide* dst, int32_t shift); 66 - 67 - UnsignedFixed UnsignedFixedMulDiv(UnsignedFixed a, UnsignedFixed mul, UnsignedFixed div); 68 - 69 - #ifdef __cplusplus 70 - } 71 - #endif 72 - 73 - #endif 74 - 1 + include/CoreServices/FixMath.h
+1 -43
src/CoreServices/Gestalt.h
··· 1 - /* 2 - This file is part of Darling. 3 - 4 - Copyright (C) 2012-2013 Lubos Dolezel 5 - 6 - Darling is free software: you can redistribute it and/or modify 7 - it under the terms of the GNU General Public License as published by 8 - the Free Software Foundation, either version 3 of the License, or 9 - (at your option) any later version. 10 - 11 - Darling is distributed in the hope that it will be useful, 12 - but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - GNU General Public License for more details. 15 - 16 - You should have received a copy of the GNU General Public License 17 - along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 - */ 19 - 20 - #ifndef GESTALT_H 21 - #define GESTALT_H 22 - 23 - #define gestaltSystemVersion 'sysv' 24 - #define gestaltSystemVersionMajor 'sys1' 25 - #define gestaltSystemVersionMinor 'sys2' 26 - #define gestaltSystemVersionPatch 'sys3' 27 - 28 - #define gestaltSysArchitecture 'sysa' 29 - #define gestaltPowerPC 2 30 - #define gestaltIntel 10 31 - 32 - #ifdef __cplusplus 33 - extern "C" { 34 - #endif 35 - 36 - OSStatus Gestalt(uint32_t type, int* value); 37 - 38 - #ifdef __cplusplus 39 - } 40 - #endif 41 - 42 - #endif 43 - 1 + include/CoreServices/Gestalt.h
+2 -2
src/CoreServices/LaunchServices.cpp
··· 1 - #include "LaunchServices.h" 2 - #include "MacErrors.h" 1 + #include <LaunchServices/LaunchServices.h> 2 + #include <CoreServices/MacErrors.h> 3 3 #include <unistd.h> 4 4 #include <string> 5 5 #include <memory>
+15 -3
src/CoreServices/LaunchServices.h src/CoreServices/include/LaunchServices/LaunchServices.h
··· 1 1 #ifndef LAUNCHSERVICES_H 2 2 #define LAUNCHSERVICES_H 3 - #include "MacTypes.h" 4 - #include "FileManager.h" 5 - #include "Processes.h" 3 + 4 + #include <CoreServices/MacTypes.h> 5 + #include <CoreServices/FileManager.h> 6 + #include <CoreServices/Processes.h> 6 7 #include <CoreFoundation/CFDictionary.h> 7 8 #include <CoreFoundation/CFArray.h> 8 9 #include <CoreFoundation/CFURL.h> ··· 14 15 typedef OptionBits LSInitializeFlags; 15 16 typedef OptionBits LSLaunchFlags; 16 17 typedef void AppleEvent; 18 + typedef int LSNotificationCode; 19 + typedef int LSNotificationID; 20 + typedef int LSASN; 21 + typedef LSASN *LSASNRef; 22 + typedef int LSSessionID; 23 + 24 + #define kLSNotificationInvalidID -1 25 + #define kLSNotifyApplicationDeath 1 26 + #define kLSUnknownErr -1 27 + 28 + #define kLSDefaultSessionID 1 17 29 18 30 enum 19 31 {
+1 -42
src/CoreServices/MacErrors.h
··· 1 - #ifndef MACERRORS_H 2 - #define MACERRORS_H 3 - #include <CoreFoundation/CFBase.h> 4 - #include <MacTypes.h> 5 - 6 - inline OSStatus makeOSStatus(int errNo) { return 100000 + errNo; } 7 - 8 - #define memFullErr -108 9 - #define internalComponentErr -2070 10 - //#define noErr 0 11 - #define unimpErr -4 12 - #define fnfErr -43 // file not found 13 - #define paramErr -50 14 - #define handlerNotFoundErr -1856 15 - #define kLocalesBufferTooSmallErr -30001 16 - #define kUCOutputBufferTooSmall -25340 17 - 18 - #define kAudioUnitErr_InvalidProperty -10879 19 - #define kAudioUnitErr_InvalidParameter -10878 20 - #define kAudioUnitErr_InvalidElement -10877 21 - #define kAudioUnitErr_NoConnection -10876 22 - #define kAudioUnitErr_FailedInitialization -10875 23 - #define kAudioUnitErr_TooManyFramesToProcess -10874 24 - #define kAudioUnitErr_IllegalInstrument -10873 25 - #define kAudioUnitErr_InstrumentTypeNotFound -10872 26 - #define kAudioUnitErr_InvalidFile -10871 27 - #define kAudioUnitErr_UnknownFileType -10870 28 - #define kAudioUnitErr_FileNotSpecified -10869 29 - #define kAudioUnitErr_FormatNotSupported -10868 30 - #define kAudioUnitErr_Uninitialized -10867 31 - #define kAudioUnitErr_InvalidScope -10866 32 - #define kAudioUnitErr_PropertyNotWritable -10865 33 - #define kAudioUnitErr_CannotDoInCurrentContext -10863 34 - #define kAudioUnitErr_InvalidPropertyValue -10851 35 - #define kAudioUnitErr_PropertyNotInUse -10850 36 - #define kAudioUnitErr_Initialized -10849 37 - #define kAudioUnitErr_InvalidOfflineRender -10848 38 - #define kAudioUnitErr_Unauthorized -10847 39 - 40 - #define kMPTimeoutErr -29296 41 - 42 - #endif 1 + include/CoreServices/MacErrors.h
+1 -78
src/CoreServices/MacLocales.h
··· 1 - /* 2 - This file is part of Darling. 3 - 4 - Copyright (C) 2012-2013 Lubos Dolezel 5 - 6 - Darling is free software: you can redistribute it and/or modify 7 - it under the terms of the GNU General Public License as published by 8 - the Free Software Foundation, either version 3 of the License, or 9 - (at your option) any later version. 10 - 11 - Darling is distributed in the hope that it will be useful, 12 - but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - GNU General Public License for more details. 15 - 16 - You should have received a copy of the GNU General Public License 17 - along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 - */ 19 - 20 - #ifndef MACLOCALES_H 21 - #define MACLOCALES_H 22 - #include "MacErrors.h" 23 - #include <stdint.h> 24 - 25 - typedef int16_t RegionCode; 26 - typedef int16_t LangCode; 27 - typedef int16_t Utf16Char; 28 - 29 - typedef int LocaleRef; 30 - typedef uint32_t LocaleOperationClass; 31 - typedef uint32_t LocaleOperationVariant; 32 - 33 - struct LocaleAndVariant 34 - { 35 - LocaleRef ref; 36 - LocaleOperationVariant variant; 37 - }; 38 - 39 - #define kLocaleLanguageMask 0x1 40 - #define kLocaleLanguageVariantMask 0x2 41 - #define kLocaleScriptMask 0x4 42 - #define kLocaleScriptVariantMask 0x8 43 - #define kLocaleRegionMask 0x10 44 - #define kLocaleRegionVariantMask 0x20 45 - #define kLocaleAllPartsMask 0x3f 46 - 47 - #define kLocaleNameMask 0x1 48 - #define kLocaleOperationVariantNameMask 0x2 49 - #define kLocaleAndVariantNameMask (kLocaleNameMask|kLocaleOperationVariantNameMask) 50 - 51 - #define kTextLanguageDontCare -128 52 - #define kTextScriptDontCare -128 53 - #define kTextRegionDontCare -128 54 - 55 - #ifdef __cplusplus 56 - extern "C" { 57 - #endif 58 - 59 - OSStatus LocaleRefFromLangOrRegionCode(LangCode langCode, RegionCode regionCode, LocaleRef* refOut); 60 - OSStatus LocaleRefFromLocaleString(const char* str, LocaleRef* refOut); 61 - OSStatus LocaleRefGetPartString(LocaleRef ref, uint32_t partMask, unsigned long maxStringLen, char* stringOut); 62 - OSStatus LocaleStringToLangAndRegionCodes(const char* name, LangCode* langCode, RegionCode* regionCode); 63 - OSStatus LocaleOperationCountLocales(LocaleOperationClass cls, unsigned long* count); 64 - OSStatus LocaleOperationGetLocales(LocaleOperationClass cls, unsigned long max, unsigned long* countOut, struct LocaleAndVariant* out); 65 - OSStatus LocaleGetName(LocaleRef ref, LocaleOperationVariant variant, uint32_t nameMask, LocaleRef refDisplay, unsigned long maxLen, unsigned long* lenOut, Utf16Char* displayName); 66 - OSStatus LocaleCountNames(LocaleRef ref, LocaleOperationVariant variant, uint32_t nameMask, unsigned long* countOut); 67 - OSStatus LocaleGetIndName(LocaleRef ref, LocaleOperationVariant variant, uint32_t nameMask, unsigned long index, unsigned long maxLen, unsigned long* lenOut, Utf16Char* displayName, LocaleRef* displayLocale); 68 - OSStatus LocaleGetRegionLanguageName(RegionCode regionCode, char name[256]); 69 - OSStatus LocaleOperationGetName(LocaleOperationClass cls, LocaleRef ref, unsigned long maxLen, unsigned long* lenOut, Utf16Char* displayName); 70 - OSStatus LocaleOperationCountNames(LocaleOperationClass cls, unsigned long* count); 71 - OSStatus LocaleOperationGetIndName(LocaleOperationClass cls, unsigned long index, unsigned long maxLen, unsigned long* lenOut, Utf16Char* displayName, LocaleRef* displayLocale); 72 - 73 - #ifdef __cplusplus 74 - } 75 - #endif 76 - 77 - #endif 78 - 1 + include/CoreServices/MacLocales.h
+1 -27
src/CoreServices/MacMemory.h
··· 1 - #ifndef MACMEMORY_H 2 - #define MACMEMORY_H 3 - #include <stddef.h> 4 - #include "MacTypes.h" 5 - 6 - #ifdef __cplusplus 7 - extern "C" { 8 - #endif 9 - 10 - void BlockMove(const void* src, void* dst, size_t count); 11 - void BlockMoveData(const void* src, void* dst, size_t count); 12 - void BlockMoveUncached(const void* src, void* dst, size_t count); 13 - void BlockMoveDataUncached(const void* src, void* dst, size_t count); 14 - void BlockZero(void* dst, size_t count); 15 - void BlockZeroUncached(void* dst, size_t count); 16 - 17 - Ptr NewPtr(long len); 18 - Ptr NewPtrClear(long len); 19 - void DiposePtr(Ptr p); 20 - void DisposeHandle(Handle handle); 21 - // and other crap with relocatable memory blocks etc. 22 - 23 - #ifdef __cplusplus 24 - } 25 - #endif 26 - 27 - #endif 1 + include/CoreServices/MacMemory.h
+1 -89
src/CoreServices/Math64.h
··· 1 - /* 2 - This file is part of Darling. 3 - 4 - Copyright (C) 2012-2013 Lubos Dolezel 5 - 6 - Darling is free software: you can redistribute it and/or modify 7 - it under the terms of the GNU General Public License as published by 8 - the Free Software Foundation, either version 3 of the License, or 9 - (at your option) any later version. 10 - 11 - Darling is distributed in the hope that it will be useful, 12 - but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - GNU General Public License for more details. 15 - 16 - You should have received a copy of the GNU General Public License 17 - along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 - */ 19 - 20 - #ifndef MATH64_H 21 - #define MATH64_H 22 - 23 - #include <MacTypes.h> 24 - #include <stdint.h> 25 - 26 - #ifdef __cplusplus 27 - extern "C" { 28 - #endif 29 - 30 - int64_t S64Max(); 31 - int64_t S64Min(); 32 - 33 - int64_t S64Add(int64_t v1, int64_t v2); 34 - int64_t S64Subtract(int64_t v1, int64_t v2); 35 - int64_t S64Negate(int64_t v); 36 - int64_t S64Absolute(int64_t v); 37 - int64_t S64Multiply(int64_t v1, int64_t v2); 38 - int64_t S64Mod(int64_t divd, int64_t divs); 39 - int64_t S64Divide(int64_t divd, int64_t divs, int64_t* rem); 40 - int64_t S64Div(int64_t divd, int64_t divs); 41 - int64_t S64Set(int32_t v); 42 - int64_t S64SetU(uint32_t v); 43 - int32_t S32Set(int64_t v); 44 - int S64And(int64_t v1, int64_t v2); 45 - int S64Or(int64_t v1, int64_t v2); 46 - int S64Eor(int64_t v1, int64_t v2); 47 - int S64Not(int64_t v); 48 - int32_t S64Compare(int64_t l, int64_t r); 49 - int64_t S64BitwiseAnd(int64_t v1, int64_t v2); 50 - int64_t S64BitwiseOr(int64_t v1, int64_t v2); 51 - int64_t S64BitwiseEor(int64_t v1, int64_t v2); 52 - int64_t S64BitwiseNor(int64_t v1); 53 - int64_t S64ShiftRight(int64_t v, uint32_t shift); 54 - int64_t S64ShiftLeft(int64_t v, uint32_t shift); 55 - long double S64ToLongDouble(int64_t v); 56 - int64_t LongDoubleToSInt64(long double v); 57 - 58 - uint64_t U64Max(); 59 - uint64_t U64Add(uint64_t v1, uint64_t v2); 60 - uint64_t U64Subtract(uint64_t v1, uint64_t v2); 61 - uint64_t U64Multiply(uint64_t v1, uint64_t v2); 62 - uint64_t U64Mod(uint64_t divd, uint64_t divs); 63 - uint64_t U64Divide(uint64_t divd, uint64_t divs, uint64_t* rem); 64 - uint64_t U64Div(uint64_t divd, uint64_t divs); 65 - uint64_t U64Set(int32_t v); 66 - uint64_t U64SetU(uint32_t v); 67 - int U64And(uint64_t v1, uint64_t v2); 68 - int U64Or(uint64_t v1, uint64_t v2); 69 - int U64Eor(uint64_t v1, uint64_t v2); 70 - int U64Not(uint64_t v); 71 - int32_t U64Compare(uint64_t l, uint64_t r); 72 - uint64_t U64BitwiseAnd(uint64_t v1, uint64_t v2); 73 - uint64_t U64BitwiseOr(uint64_t v1, uint64_t v2); 74 - uint64_t U64BitwiseEor(uint64_t v1, uint64_t v2); 75 - uint64_t U64BitwiseNor(uint64_t v1); 76 - uint64_t U64ShiftRight(uint64_t v, uint32_t shift); 77 - uint64_t U64ShiftLeft(uint64_t v, uint32_t shift); 78 - long double U64ToLongDouble(uint64_t v); 79 - uint64_t LongDoubleToUInt64(long double v); 80 - 81 - int64_t UInt64ToSInt64(uint64_t v); 82 - uint64_t SInt64ToUInt64(int64_t v); 83 - 84 - #ifdef __cplusplus 85 - } 86 - #endif 87 - 88 - #endif 89 - 1 + include/CoreServices/Math64.h
+1 -33
src/CoreServices/Multiprocessing.h
··· 1 - #ifndef MULTIPROCESSING_H 2 - #define MULTIPROCESSING_H 3 - #include "MacTypes.h" 4 - 5 - #ifdef __cplusplus 6 - extern "C" { 7 - #endif 8 - 9 - enum { 10 - kDurationImmediate = 0, 11 - kDurationForever = 0x7FFFFFFF, 12 - kDurationMillisecond = 1, 13 - kDurationMicrosecond = -1 14 - }; 15 - 16 - typedef void* MPCriticalRegionID; 17 - 18 - Boolean _MPIsFullyInitialized(); 19 - OSStatus MPDelayUntil(AbsoluteTime* time); 20 - unsigned long MPProcessors(); 21 - 22 - OSStatus MPCreateCriticalRegion(MPCriticalRegionID* criticalRegion); 23 - OSStatus MPDeleteCriticalRegion(MPCriticalRegionID criticalRegion); 24 - OSStatus MPEnterCriticalRegion(MPCriticalRegionID criticalRegion, Duration timeout); 25 - OSStatus MPExitCriticalRegion(MPCriticalRegionID criticalRegion); 26 - 27 - // other functions are missing... 28 - 29 - #ifdef __cplusplus 30 - } 31 - #endif 32 - 33 - #endif 1 + include/CoreServices/Multiprocessing.h
+1 -35
src/CoreServices/OpenTransport.h
··· 1 - #ifndef OPENTRANSPORT_H 2 - #define OPENTRANSPORT_H 3 - #include <MacTypes.h> 4 - #include <stdint.h> 5 - 6 - #ifdef __cplusplus 7 - extern "C" { 8 - #endif 9 - 10 - typedef unsigned int OTByteCount; 11 - typedef unsigned int OTItemCount; 12 - typedef int32_t OTInt32; 13 - typedef uint32_t OTUInt32; 14 - 15 - 16 - #if defined(__i386__) || defined(__ppc__) // This is deprecated stuff for Carbon apps 17 - 18 - Boolean OTAtomicSetBit(UInt8* bytePtr, OTByteCount bitNumber); 19 - Boolean OTAtomicClearBit(UInt8* bytePtr, OTByteCount bitNumber); 20 - Boolean OTAtomicTestBit(UInt8* bytePtr, OTByteCount bitNumber); 21 - Boolean OTCompareAndSwapPtr(void* oldValue, void* newValue, void** dest); 22 - Boolean OTCompareAndSwap32(UInt32 oldValue, UInt32 newValue, UInt32* dest); 23 - Boolean OTCompareAndSwap16(UInt32 oldValue, UInt32 newValue, UInt16* dest); 24 - Boolean OTCompareAndSwap8(UInt32 oldValue, UInt32 newValue, UInt8* dest); 25 - SInt32 OTAtomicAdd32(SInt32 toAdd, SInt32* dest); 26 - SInt16 OTAtomicAdd16(SInt32 toAdd, SInt16* dest); 27 - SInt8 OTAtomicAdd8(SInt32 toAdd, SInt8* dest); 28 - 29 - #endif 30 - 31 - #ifdef __cplusplus 32 - } 33 - #endif 34 - 35 - #endif 1 + include/CoreServices/OpenTransport.h
+1 -55
src/CoreServices/Processes.h
··· 1 - #ifndef PROCESSES_H 2 - #define PROCESSES_H 3 - #include "MacTypes.h" 4 - #include "FileManager.h" 5 - #include <CoreFoundation/CFString.h> 6 - #include <CoreFoundation/CFDictionary.h> 7 - #include <sys/types.h> 8 - 9 - struct ProcessInfoRec 10 - { 11 - unsigned long processInfoLength; 12 - // fields omitted 13 - }; 14 - 15 - struct LaunchParamBlockRec 16 - { 17 - // fields omitted 18 - }; 19 - 20 - enum { kNoProcess = 0, kSystemProcess = 1, kCurrentProcess = 2 }; 21 - enum { procNotFound = -600 }; 22 - 23 - #ifdef __cplusplus 24 - extern "C" { 25 - #endif 26 - 27 - OSStatus CopyProcessName(const ProcessSerialNumber* psn, CFStringRef* name); 28 - void ExitToShell(); 29 - OSErr GetCurrentProcess(ProcessSerialNumber* psn); 30 - OSErr GetFrontProcess(ProcessSerialNumber* psn); 31 - OSErr GetNextProcess(ProcessSerialNumber* psn); 32 - OSStatus GetProcessBundleLocation(const ProcessSerialNumber* psn, FSRef* location); 33 - OSStatus GetProcessForPID(pid_t pid, ProcessSerialNumber* psn); 34 - OSErr GetProcessInformation(const ProcessSerialNumber* psn, struct ProcessInfoRec* pi); 35 - OSStatus GetProcessPID(const ProcessSerialNumber* psn, pid_t* pid); 36 - Boolean IsProcessVisible(const ProcessSerialNumber* psn); 37 - OSErr KillProcess(const ProcessSerialNumber* psn); 38 - OSErr LaunchApplication(struct LaunchParamBlockRec* launch); 39 - CFDictionaryRef ProcessInformationCopyDictionary(const ProcessSerialNumber *PSN, UInt32 infoToReturn); 40 - OSErr SameProcess(const ProcessSerialNumber* psn1, const ProcessSerialNumber* psn2, Boolean* result); 41 - OSErr SetFrontProcess(const ProcessSerialNumber* psn); 42 - OSErr SetFrontProcessWithOptions(const ProcessSerialNumber* psn, OptionBits opts); 43 - OSErr ShowHideProcess(const ProcessSerialNumber* psn, Boolean visible); 44 - OSStatus TransformProcessType(const ProcessSerialNumber* psn, UInt32 type); 45 - OSErr WakeUpProcess(const ProcessSerialNumber* psn); 46 - 47 - // extern CFStringRef kCFBundleExecutableKey; 48 - // extern CFStringRef kCFBundleNameKey; 49 - // extern CFStringRef kCFBundleIdentifierKey; 50 - 51 - #ifdef __cplusplus 52 - } 53 - #endif 54 - 55 - #endif 1 + include/CoreServices/Processes.h
+1
src/CoreServices/ScriptManager.h
··· 1 + include/CoreServices/ScriptManager.h
+1 -75
src/CoreServices/TextCommon.h
··· 1 - /* 2 - This file is part of Darling. 3 - 4 - Copyright (C) 2017 Lubos Dolezel 5 - 6 - Darling is free software: you can redistribute it and/or modify 7 - it under the terms of the GNU General Public License as published by 8 - the Free Software Foundation, either version 3 of the License, or 9 - (at your option) any later version. 10 - 11 - Darling is distributed in the hope that it will be useful, 12 - but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - GNU General Public License for more details. 15 - 16 - You should have received a copy of the GNU General Public License 17 - along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 - */ 19 - 20 - #ifndef _TEXTCOMMON_H 21 - #define _TEXTCOMMON_H 22 - #include <MacTypes.h> 23 - 24 - #ifdef __cplusplus 25 - extern "C" { 26 - #endif 27 - 28 - typedef UInt8* TextPtr; 29 - typedef const UInt8* ConstTextPtr; 30 - 31 - enum { 32 - kTextEncodingUnicodeDefault = 0x100 33 - }; 34 - 35 - enum { 36 - kTextEncodingDefaultVariant = 0 37 - }; 38 - 39 - enum { 40 - kTextEncodingDefaultFormat = 0, 41 - kUnicodeUTF16Format = 0, 42 - kUnicodeUTF7Format = 1, 43 - kUnicodeUTF8Format = 2, 44 - kUnicodeUTF32Format = 3, 45 - kUnicodeUTF16BEFormat = 4, 46 - kUnicodeUTF16LEFormat = 5, 47 - kUnicodeUTF32BEFormat = 6, 48 - kUnicodeUTF32LEFormat = 7, 49 - kUnicodeSCSUFormat = 8, 50 - kUnicode16BitFormat = 0, 51 - kUnicode32BitFormat = 3, 52 - }; 53 - 54 - enum { 55 - kUnicodeNoSubset = 0, 56 - kUnicodeNormalizationFormD = 5, 57 - kUnicodeNormalizationFormC = 3, 58 - kUnicodeCanonicalCompVariant = kUnicodeNormalizationFormC, 59 - kUnicodeHFSPlusDecompVariant = 8, 60 - kUnicodeHFSPlusCompVariant = 9, 61 - }; 62 - 63 - typedef UInt32 TextEncoding; 64 - typedef UInt32 TextEncodingBase; 65 - typedef UInt32 TextEncodingFormat; 66 - typedef UInt32 TextEncodingVariant; 67 - 68 - TextEncoding CreateTextEncoding(TextEncodingBase encodingBase, TextEncodingVariant encodingVariant, TextEncodingFormat encodingFormat); 69 - 70 - #ifdef __cplusplus 71 - } 72 - #endif 73 - 74 - #endif 75 - 1 + include/CoreServices/TextCommon.h
+1 -44
src/CoreServices/TextEncodingConverter.h
··· 1 - /* 2 - This file is part of Darling. 3 - 4 - Copyright (C) 2017 Lubos Dolezel 5 - 6 - Darling is free software: you can redistribute it and/or modify 7 - it under the terms of the GNU General Public License as published by 8 - the Free Software Foundation, either version 3 of the License, or 9 - (at your option) any later version. 10 - 11 - Darling is distributed in the hope that it will be useful, 12 - but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - GNU General Public License for more details. 15 - 16 - You should have received a copy of the GNU General Public License 17 - along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 - */ 19 - 20 - #ifndef _TEXTENCODINGCONVERTER_H 21 - #define _TEXTENCODINGCONVERTER_H 22 - #include <MacTypes.h> 23 - #include "TextCommon.h" 24 - 25 - #ifdef __cplusplus 26 - extern "C" { 27 - #endif 28 - 29 - typedef struct OpaqueTECObjectRef* TECObjectRef; 30 - 31 - OSStatus TECCreateConverter(TECObjectRef *newEncodingConverter, TextEncoding inputEncoding, TextEncoding outputEncoding); 32 - 33 - OSStatus TECConvertText(TECObjectRef encodingConverter, ConstTextPtr inputBuffer, ByteCount inputBufferLength, ByteCount *actualInputLength, TextPtr outputBuffer, ByteCount outputBufferLength, ByteCount *actualOutputLength); 34 - 35 - OSStatus TECFlushText(TECObjectRef encodingConverter, TextPtr outputBuffer, ByteCount outputBufferLength, ByteCount *actualOutputLength); 36 - 37 - OSStatus TECDisposeConverter(TECObjectRef newEncodingConverter); 38 - 39 - #ifdef __cplusplus 40 - } 41 - #endif 42 - 43 - #endif 44 - 1 + include/CoreServices/TextEncodingConverter.h
+1 -31
src/CoreServices/TextUtils.h
··· 1 - #ifndef TEXTUTILS_H 2 - #define TEXTUTILS_H 3 - #include "MacTypes.h" 4 - 5 - #ifdef __cplusplus 6 - extern "C" { 7 - #endif 8 - 9 - // There are many functions missing, but will be added as-needed. 10 - // There is no point in spending time implementing all this ancient stuff. 11 - 12 - StringHandle NewString(const Str255 str); 13 - void SetString(StringHandle handle, const Str255 str); 14 - 15 - void UpperString(Str255 str, Boolean diac); 16 - void upperstring(char* str, Boolean diac); 17 - 18 - void c2pstrcpy(Str255 dst, const char* src); 19 - void p2cstrcpy(char* dst, const Str255 src); 20 - void CopyPascalStringToC(const Str255 src, char* dst); 21 - void CopyCStringToPascal(const char* src, Str255 dst); 22 - StringPtr c2pstr(char* str); 23 - StringPtr C2PStr(Ptr str); 24 - char* p2cstr(StringPtr str); 25 - Ptr P2CStr(StringPtr str); 26 - 27 - #ifdef __cplusplus 28 - } 29 - #endif 30 - 31 - #endif 1 + include/CoreServices/TextUtils.h
+1 -17
src/CoreServices/Timer.h
··· 1 - #ifndef TIMER_H_ 2 - #define TIMER_H_ 3 - #include "MacTypes.h" 4 - 5 - #ifdef __cplusplus 6 - extern "C" { 7 - #endif 8 - 9 - void Microseconds(UnsignedWide* tickCount); 10 - 11 - #ifdef __cplusplus 12 - } 13 - #endif 14 - 15 - #endif 16 - 17 - 1 + include/CoreServices/Timer.h
+1 -40
src/CoreServices/ToolUtils.h
··· 1 - /* 2 - This file is part of Darling. 3 - 4 - Copyright (C) 2012-2013 Lubos Dolezel 5 - 6 - Darling is free software: you can redistribute it and/or modify 7 - it under the terms of the GNU General Public License as published by 8 - the Free Software Foundation, either version 3 of the License, or 9 - (at your option) any later version. 10 - 11 - Darling is distributed in the hope that it will be useful, 12 - but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - GNU General Public License for more details. 15 - 16 - You should have received a copy of the GNU General Public License 17 - along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 - */ 19 - 20 - #ifndef TOOLUTILS_H 21 - #define TOOLUTILS_H 22 - 23 - #ifdef __cplusplus 24 - extern "C" { 25 - #endif 26 - 27 - int BitTst(const void* bytePtr, long bitNum); 28 - void BitSet(void* bytePtr, long bitNum); 29 - void BitClr(void* bytePtr, long bitNum); 30 - long BitAnd(long v1, long v2); 31 - long BitXor(long v1, long v2); 32 - long BitNot(long v1); 33 - long BitShift(long value, short count); 34 - 35 - #ifdef __cplusplus 36 - } 37 - #endif 38 - 39 - #endif 40 - 1 + include/CoreServices/ToolUtils.h
+1 -16
src/CoreServices/UniChar.h
··· 1 - #ifndef UNICHAR_H 2 - #define UNICHAR_H 3 - #include "MacTypes.h" 4 - #include <TargetConditionals.h> 5 - 6 - // UniChar uses platform endianness, whereas ICU expects BE by default 7 - #if TARGET_RT_BIG_ENDIAN 8 - # define UNICHAR_ENCODING "UTF-16BE" 9 - #elif TARGET_RT_LITTLE_ENDIAN 10 - # define UNICHAR_ENCODING "UTF-16LE" 11 - #else 12 - # error Cannot determine endianness! 13 - #endif 14 - 15 - #endif 16 - 1 + include/CoreServices/UniChar.h
+1 -61
src/CoreServices/UnicodeUtilities.h
··· 1 - /* 2 - This file is part of Darling. 3 - 4 - Copyright (C) 2013 Lubos Dolezel 5 - 6 - Darling is free software: you can redistribute it and/or modify 7 - it under the terms of the GNU General Public License as published by 8 - the Free Software Foundation, either version 3 of the License, or 9 - (at your option) any later version. 10 - 11 - Darling is distributed in the hope that it will be useful, 12 - but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - GNU General Public License for more details. 15 - 16 - You should have received a copy of the GNU General Public License 17 - along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 - */ 19 - 20 - #ifndef UNICODEUTILITIES_H 21 - #define UNICODEUTILITIES_H 22 - #include "MacTypes.h" 23 - #include "MacLocales.h" 24 - #include <stdint.h> 25 - 26 - #ifdef __cplusplus 27 - extern "C" { 28 - #endif 29 - 30 - typedef void* CollatorRef; 31 - enum //: uint32_t 32 - { 33 - kUCCollateComposeInsensitiveMask = 0x2, 34 - kUCCollateWidthInsensitiveMask = 0x4, 35 - kUCCollateCaseInsensitiveMask = 0x8, 36 - kUCCollateDiacritInsensitiveMask = 0x10, 37 - kUCCollatePunctuationSignificantMask = 0x8000, 38 - kUCCollateDigitsOverrideMask = 0x10000, 39 - kUCCollateDigitsAsNumberMask = 0x20000 40 - }; 41 - 42 - 43 - OSStatus UCCreateCollator(LocaleRef locale, LocaleOperationVariant opVariant, uint32_t options, CollatorRef* collator); 44 - 45 - OSStatus UCGetCollationKey(CollatorRef collator, const UniChar * text, unsigned long textlen, unsigned long maxKeySize, unsigned long* actualKeySize, uint32_t* collationKey); 46 - 47 - OSStatus UCCompareCollationKeys(const uint32_t* key1, unsigned long key1len, const uint32_t* key2, unsigned long key2len, Boolean* equiv, int32_t* order); 48 - 49 - OSStatus UCCompareText(CollatorRef collator, const UniChar* text1, unsigned long text1len, const UniChar* text2, unsigned long text2len, Boolean* equiv, int32_t* order); 50 - 51 - OSStatus UCDisposeCollator(CollatorRef* collator); 52 - 53 - OSStatus UCCompareTextDefault(uint32_t options, const UniChar* text1, unsigned long text1len, const UniChar* text2, unsigned long text2len, Boolean* equiv, int32_t* order); 54 - 55 - OSStatus UCCompareTextNoLocale(uint32_t options, const UniChar* text1, unsigned long text1len, const UniChar* text2, unsigned long text2len, Boolean* equiv, int32_t* order); 56 - 57 - #ifdef __cplusplus 58 - } 59 - #endif 60 - 61 - #endif 1 + include/CoreServices/UnicodeUtilities.h
-1
src/CoreServices/include/Components.h
··· 1 - .././Components.h
-1
src/CoreServices/include/ComponentsInternal.h
··· 1 - .././ComponentsInternal.h
-1
src/CoreServices/include/CoreEndian.h
··· 1 - .././CoreEndian.h
-1
src/CoreServices/include/CoreServices.h
··· 1 - .././CoreServices.h
+44
src/CoreServices/include/CoreServices/Components.h
··· 1 + #ifndef COMPONENTS_H 2 + #define COMPONENTS_H 3 + #include <MacTypes.h> 4 + 5 + #ifdef __cplusplus 6 + class CarbonComponent; 7 + #else 8 + struct __CarbonComponent; 9 + typedef struct __CarbonComponent CarbonComponent; 10 + #endif 11 + struct ComponentDescription; 12 + typedef struct ComponentDescription ComponentDescription; 13 + 14 + typedef CarbonComponent* ComponentInstance; 15 + typedef void* Component; 16 + 17 + #ifdef __cplusplus 18 + extern "C" { 19 + #endif 20 + 21 + Component FindNextComponent(Component prev, ComponentDescription* desc); 22 + long CountComponents(ComponentDescription* desc); 23 + 24 + OSErr OpenAComponent(Component comp, ComponentInstance* out); 25 + ComponentInstance OpenComponent(Component comp); 26 + OSErr CloseComponent(ComponentInstance inst); 27 + 28 + #ifdef __cplusplus 29 + } 30 + #endif 31 + 32 + struct ComponentDescription 33 + { 34 + OSType componentType, componentSubType, componentManufacturer; 35 + UInt32 componentFlags, componentFlagsMask; 36 + }; 37 + 38 + enum 39 + { 40 + kAppleManufacturer = 'appl' 41 + }; 42 + 43 + #endif 44 +
+35
src/CoreServices/include/CoreServices/ComponentsInternal.h
··· 1 + #ifndef COMPONENTSINTERNAL_H 2 + #define COMPONENTSINTERNAL_H 3 + 4 + class CarbonComponent 5 + { 6 + public: 7 + virtual ~CarbonComponent() {} 8 + }; 9 + 10 + inline static UInt32 GetComponentType(Component comp) 11 + { 12 + long l = long(comp); 13 + return l & 0xffff0000; 14 + } 15 + 16 + inline static UInt32 GetComponentIndex(Component comp) 17 + { 18 + long l = long(comp); 19 + return l & 0xffff; 20 + } 21 + 22 + inline static Component CreateComponent(UInt32 type, UInt32 index) 23 + { 24 + long l = type & 0xffff0000; 25 + l |= (index & 0xffff); 26 + return (void*) l; 27 + } 28 + 29 + enum 30 + { 31 + kComponentTypeAudioUnit = 'au\0\0' 32 + }; 33 + 34 + #endif 35 +
+85
src/CoreServices/include/CoreServices/CoreEndian.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2013 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #ifndef COREENDIAN_H 21 + #define COREENDIAN_H 22 + #include <MacTypes.h> 23 + #include <stdint.h> 24 + 25 + #ifdef __cplusplus 26 + extern "C" { 27 + #endif 28 + 29 + UInt16 Endian16_Swap(UInt16 value); 30 + UInt32 Endian32_Swap(UInt32 value); 31 + UInt64 Endian64_Swap(UInt64 value); 32 + 33 + SInt16 EndianS16_BtoL(SInt16 value); 34 + SInt16 EndianS16_BtoN(SInt16 value); 35 + SInt16 EndianS16_LtoB(SInt16 value); 36 + SInt16 EndianS16_LtoN(SInt16 value); 37 + SInt16 EndianS16_NtoB(SInt16 value); 38 + SInt16 EndianS16_NtoL(SInt16 value); 39 + 40 + SInt32 EndianS32_BtoL(SInt32 value); 41 + SInt32 EndianS32_BtoN(SInt32 value); 42 + SInt32 EndianS32_LtoB(SInt32 value); 43 + SInt32 EndianS32_LtoN(SInt32 value); 44 + SInt32 EndianS32_NtoB(SInt32 value); 45 + SInt32 EndianS32_NtoL(SInt32 value); 46 + 47 + SInt64 EndianS64_BtoL(SInt64 value); 48 + SInt64 EndianS64_BtoN(SInt64 value); 49 + SInt64 EndianS64_LtoB(SInt64 value); 50 + SInt64 EndianS64_LtoN(SInt64 value); 51 + SInt64 EndianS64_NtoB(SInt64 value); 52 + SInt64 EndianS64_NtoL(SInt64 value); 53 + 54 + UInt16 EndianU16_BtoL(UInt16 value); 55 + UInt16 EndianU16_BtoN(UInt16 value); 56 + UInt16 EndianU16_LtoB(UInt16 value); 57 + UInt16 EndianU16_LtoN(UInt16 value); 58 + UInt16 EndianU16_NtoB(UInt16 value); 59 + UInt16 EndianU16_NtoL(UInt16 value); 60 + 61 + UInt32 EndianU32_BtoL(UInt32 value); 62 + UInt32 EndianU32_BtoN(UInt32 value); 63 + UInt32 EndianU32_LtoB(UInt32 value); 64 + UInt32 EndianU32_LtoN(UInt32 value); 65 + UInt32 EndianU32_NtoB(UInt32 value); 66 + UInt32 EndianU32_NtoL(UInt32 value); 67 + 68 + UInt64 EndianU64_BtoL(UInt64 value); 69 + UInt64 EndianU64_BtoN(UInt64 value); 70 + UInt64 EndianU64_LtoB(UInt64 value); 71 + UInt64 EndianU64_LtoN(UInt64 value); 72 + UInt64 EndianU64_NtoB(UInt64 value); 73 + UInt64 EndianU64_NtoL(UInt64 value); 74 + 75 + typedef OSStatus (*CEFlipper)(uint32_t dataDomain, uint32_t dataType, int16_t id, void* data, unsigned long length, Boolean isNative, void* opaque); 76 + 77 + OSStatus CoreEndianFlipData(uint32_t dataDomain, uint32_t dataType, int16_t id, void* data, unsigned long length, Boolean isNative); 78 + OSStatus CoreEndianInstallFlipper(uint32_t dataDomain, uint32_t dataType, CEFlipper flipper, void* opaque); 79 + OSStatus CoreEndianGetFlipper(uint32_t dataDomain, uint32_t dataType, CEFlipper* flipper, void** opaque); 80 + 81 + #ifdef __cplusplus 82 + } 83 + #endif 84 + 85 + #endif
+31
src/CoreServices/include/CoreServices/CoreServices.h
··· 1 + #ifndef _CORESERVICES_CORESERVICES_H_ 2 + #define _CORESERVICES_CORESERVICES_H_ 3 + 4 + #include <CoreServices/Components.h> 5 + #include <CoreServices/CoreEndian.h> 6 + #include <CoreServices/DateTimeUtils.h> 7 + #include <CoreServices/DriverServices.h> 8 + #include <CoreServices/DriverSynchronization.h> 9 + #include <CoreServices/FileManager.h> 10 + #include <CoreServices/FixMath.h> 11 + #include <CoreServices/Gestalt.h> 12 + #include <CoreServices/MacErrors.h> 13 + #include <CoreServices/MacMemory.h> 14 + #include <MacTypes.h> 15 + #include <CoreServices/Math64.h> 16 + #include <CoreServices/Multiprocessing.h> 17 + #include <CoreServices/OpenTransport.h> 18 + #include <CoreServices/Processes.h> 19 + #include <CoreServices/ScriptManager.h> 20 + #include <CoreServices/TextUtils.h> 21 + #include <CoreServices/Timer.h> 22 + #include <CoreServices/ToolUtils.h> 23 + #include <CoreServices/UniChar.h> 24 + #include <CoreServices/UnicodeUtilities.h> 25 + #include <CoreServices/TextCommon.h> 26 + #include <CoreServices/TextEncodingConverter.h> 27 + 28 + #include <LaunchServices/LaunchServices.h> 29 + 30 + #endif 31 +
+26
src/CoreServices/include/CoreServices/CoreServicesPriv.h
··· 1 + #ifndef CORESERVICESPRIV_H_ 2 + #define CORESERVICESPRIV_H_ 3 + 4 + #include <CoreFoundation/CFString.h> 5 + #include <CoreFoundation/CFURLPriv.h> 6 + 7 + #include <CoreServices/CoreServices.h> 8 + 9 + CF_EXTERN_C_BEGIN 10 + 11 + Boolean _CSCheckFix(CFStringRef str); 12 + 13 + // Assumed 14 + #define kLSDownloadRiskCategoryKey CFSTR("LSDownloadRiskCategory") 15 + 16 + #define kLSRiskCategorySafe "LSRiskCategorySafe" 17 + #define kLSRiskCategoryNeutral "LSRiskCategoryNeutral" 18 + #define kLSRiskCategoryUnknown "LSRiskCategoryUnknown" 19 + #define kLSRiskCategoryMayContainUnsafeExecutable "LSRiskCategoryMayContainUnsafeExecutable" 20 + 21 + // Also assumed 22 + #define QTN_FLAG_ASSESSMENT_OK 1 23 + 24 + CF_EXTERN_C_END 25 + 26 + #endif
+71
src/CoreServices/include/CoreServices/DateTimeUtils.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2012-2013 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + 21 + #ifndef UTCUTILS_H 22 + #define UTCUTILS_H 23 + #include <stdint.h> 24 + #include <time.h> 25 + #include <CoreFoundation/CFDate.h> 26 + #include "MacErrors.h" 27 + 28 + #define UNIX_OFFSET 2082844800ll // 1970 - 1904 29 + #define CF_OFFSET 3061152000ll // 2001 - 1904: "Seconds" is since 2001+ 30 + 31 + #pragma pack(2) 32 + struct UTCDateTime 33 + { 34 + uint16_t highSeconds; 35 + uint32_t lowSeconds; 36 + uint16_t fraction; 37 + }; 38 + #pragma pack() 39 + 40 + typedef struct UTCDateTime LocalDateTime; 41 + typedef struct UTCDateTime* UTCDateTimePtr; 42 + typedef struct UTCDateTime** UTCDateTimeHandle; 43 + typedef LocalDateTime* LocalDateTimePtr; 44 + typedef LocalDateTime** LocalDateTimeHandle; 45 + 46 + #ifdef __cplusplus 47 + extern "C" { 48 + #endif 49 + 50 + OSErr UCConvertUTCDateTimeToCFAbsoluteTime(const UTCDateTimePtr in, CFAbsoluteTime* out); 51 + OSErr UCConvertSecondsToCFAbsoluteTime(uint32_t seconds, CFAbsoluteTime* out); 52 + OSErr UCConvertLongDateTimeToCFAbsoluteTime(int64_t seconds, CFAbsoluteTime* out); 53 + OSErr UCConvertCFAbsoluteTimeToUTCDateTime(CFAbsoluteTime in, UTCDateTimePtr out); 54 + OSErr UCConvertCFAbsoluteTimeToSeconds(CFAbsoluteTime in, uint32_t* out); 55 + OSErr UCConvertCFAbsoluteTimeToLongDateTime(CFAbsoluteTime in, int64_t* out); 56 + 57 + // Seconds since 1.1.1904 58 + void GetDateTime(unsigned long* secs); 59 + 60 + #ifdef __cplusplus 61 + } 62 + 63 + namespace Darling 64 + { 65 + UTCDateTime time_tToUTC(time_t t); 66 + } 67 + 68 + #endif 69 + 70 + #endif 71 +
+78
src/CoreServices/include/CoreServices/DriverServices.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2013 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #ifndef DRIVERSERVICES_H 21 + #define DRIVERSERVICES_H 22 + #include <MacTypes.h> 23 + #include <limits.h> 24 + 25 + #ifdef __cplusplus 26 + extern "C" { 27 + #endif 28 + 29 + typedef UnsignedWide Nanoseconds; 30 + 31 + enum 32 + { 33 + durationMicrosecond = -1L, 34 + durationMillisecond = 1, 35 + durationSecond = 1000, 36 + durationMinute = 60*1000, 37 + durationHour = 60*60*1000, 38 + durationDay = 60*60*1000*24, 39 + durationNoWait = 0, 40 + durationForever = INT_MAX 41 + }; 42 + 43 + AbsoluteTime UpTime(); 44 + 45 + Nanoseconds AbsoluteToNanoseconds(AbsoluteTime absTime); 46 + 47 + Duration AbsoluteToDuration(AbsoluteTime absTime); 48 + 49 + AbsoluteTime NanosecondsToAbsolute(Nanoseconds ns); 50 + 51 + AbsoluteTime DurationToAbsolute(Duration duration); 52 + 53 + AbsoluteTime AddAbsoluteToAbsolute(AbsoluteTime time1, AbsoluteTime time2); 54 + 55 + AbsoluteTime SubAbsoluteFromAbsolute(AbsoluteTime time1, AbsoluteTime time2); 56 + 57 + AbsoluteTime AddNanosecondsToAbsolute(Nanoseconds ns, AbsoluteTime absTime); 58 + 59 + AbsoluteTime AddDurationToAbsolute(Duration duration, AbsoluteTime absTime); 60 + 61 + AbsoluteTime SubNanosecondsFromAbsolute(Nanoseconds ns, AbsoluteTime absTime); 62 + 63 + AbsoluteTime SubDurationFromAbsolute(Duration duration, AbsoluteTime absTime); 64 + 65 + Nanoseconds AbsoluteDeltaToNanoseconds(AbsoluteTime time1, AbsoluteTime time2); 66 + 67 + Duration AbsoluteDeltaToDuration(AbsoluteTime time1, AbsoluteTime time2); 68 + 69 + Nanoseconds DurationToNanoseconds(Duration duration); 70 + 71 + Duration NanosecondsToDuration(Nanoseconds ns); 72 + 73 + #ifdef __cplusplus 74 + } 75 + #endif 76 + 77 + #endif 78 +
+76
src/CoreServices/include/CoreServices/DriverSynchronization.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2013 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #ifndef DRIVERSYNCHRONIZATION_H 21 + #define DRIVERSYNCHRONIZATION_H 22 + 23 + #include "MacTypes.h" 24 + 25 + #ifdef __cplusplus 26 + extern "C" { 27 + #endif 28 + 29 + Boolean CompareAndSwap(UInt32 old, UInt32 _new, UInt32* ptr); 30 + 31 + Boolean TestAndClear(UInt32 bit, UInt8* ptr); 32 + 33 + Boolean TestAndSet(UInt32 bit, UInt8* ptr) ; 34 + 35 + SInt8 IncrementAtomic8(SInt8* ptr); 36 + 37 + SInt8 DecrementAtomic8(SInt8* ptr); 38 + 39 + SInt8 AddAtomic8(SInt32 val, SInt8* ptr); 40 + 41 + UInt8 BitAndAtomic8(UInt32 val, UInt8* ptr); 42 + 43 + UInt8 BitOrAtomic8(UInt32 val, UInt8* ptr); 44 + 45 + UInt8 BitXorAtomic8(UInt32 val, UInt8* ptr); 46 + 47 + SInt16 IncrementAtomic16(SInt16* ptr); 48 + 49 + SInt16 DecrementAtomic16(SInt16* ptr); 50 + 51 + SInt16 AddAtomic16(SInt32 val, SInt16* ptr); 52 + 53 + UInt16 BitAndAtomic16(UInt32 val, UInt16* ptr); 54 + 55 + UInt16 BitOrAtomic16(UInt32 val, UInt16* ptr); 56 + 57 + UInt16 BitXorAtomic16(UInt32 val, UInt16* ptr); 58 + 59 + SInt32 IncrementAtomic(SInt32* ptr); 60 + 61 + SInt32 DecrementAtomic(SInt32* ptr); 62 + 63 + SInt32 AddAtomic(SInt32 val, SInt32* ptr); 64 + 65 + UInt32 BitAndAtomic(UInt32 val, UInt32* ptr); 66 + 67 + UInt32 BitOrAtomic(UInt32 val, UInt32* ptr); 68 + 69 + UInt32 BitXorAtomic(UInt32 val, UInt32* ptr); 70 + 71 + #ifdef __cplusplus 72 + } 73 + #endif 74 + 75 + #endif 76 +
+245
src/CoreServices/include/CoreServices/FileManager.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2012-2013 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + 21 + #ifndef FILEMANAGER_H 22 + #define FILEMANAGER_H 23 + #include <stdint.h> 24 + #include <dirent.h> 25 + #include "MacErrors.h" 26 + #include "DateTimeUtils.h" 27 + #include "MacTypes.h" 28 + #include <CoreFoundation/CFURL.h> 29 + 30 + #ifdef __cplusplus 31 + extern "C" { 32 + #endif 33 + 34 + #define FSRef_MAX_DEPTH (80 / sizeof(ino_t)) 35 + 36 + struct FSRef 37 + { 38 + union 39 + { 40 + uint8_t hidden[80]; 41 + 42 + // Inode numbers leading to the file in the directory structure 43 + // 44 + // EXAMPLES: 45 + // All zeroes: / 46 + // sequence 1,2,0: [dir with inode 1]/[dir or file with inode 2] 47 + ino_t inodes[FSRef_MAX_DEPTH]; 48 + }; 49 + }; 50 + typedef struct FSRef* FSRefPtr; 51 + typedef struct FSRef FSRef; 52 + 53 + struct HFSUniStr255 54 + { 55 + uint16_t length; 56 + uint16_t unicode[255]; 57 + }; 58 + struct FSSpec; 59 + 60 + typedef struct FSSpec* FSSpecPtr; 61 + 62 + struct FSPermissionInfo 63 + { 64 + uint32_t userID, groupID; // uid, gid 65 + uint8_t reserved1; 66 + uint8_t userAccess; // mode for the current user 67 + uint16_t mode; // mode 68 + uint32_t reserved2; 69 + }; 70 + 71 + struct FSCatalogInfo 72 + { 73 + uint16_t nodeFlags; 74 + int16_t volume; 75 + uint32_t parentDirID; 76 + uint32_t nodeID; 77 + uint8_t sharingFlags; 78 + uint8_t userPrivileges; 79 + uint8_t reserved1; 80 + uint8_t reserved2; 81 + struct UTCDateTime createDate; 82 + struct UTCDateTime contentModDate; 83 + struct UTCDateTime attributeModDate; 84 + struct UTCDateTime accessDate; 85 + struct UTCDateTime backupDate; 86 + 87 + union 88 + { 89 + uint32_t permissions[4]; 90 + struct FSPermissionInfo fsPermissionInfo; 91 + }; 92 + 93 + uint8_t finderInfo[16]; 94 + uint8_t extFinderInfo[16]; 95 + uint64_t dataLogicalSize; 96 + uint64_t dataPhysicalSize; 97 + uint64_t rsrcLogicalSize; 98 + uint64_t rsrcPhysicalSize; 99 + uint32_t valence; // file count within a directory 100 + uint32_t textEncodingHint; 101 + }; 102 + 103 + typedef void* IOCompletionUPP; 104 + typedef void* QElemPtr; 105 + typedef uint16_t FSAllocationFlags; 106 + typedef uint32_t FSCatalogInfoBitmap; 107 + typedef unsigned long UniCharCount; 108 + typedef UInt32 TextEncoding; 109 + 110 + struct FSRefParam 111 + { 112 + QElemPtr qLink; 113 + short qType; 114 + short ioTrap; 115 + Ptr ioCmdAddr; 116 + IOCompletionUPP ioCompletion; 117 + volatile OSErr ioResult; 118 + const Str255* ioNamePtr; 119 + short ioVRefNum; 120 + SInt16 reserved1; 121 + UInt8 reserved2; 122 + UInt8 reserved3; 123 + const FSRefPtr ref; 124 + FSCatalogInfoBitmap whichInfo; 125 + struct FSCatalogInfo* catInfo; 126 + UniCharCount nameLength; 127 + const UniChar* name; 128 + long ioDirID; 129 + FSSpecPtr spec; 130 + FSRefPtr parentRef; 131 + FSRefPtr newRef; 132 + TextEncoding textEncodingHint; 133 + struct HFSUniStr255* outName; 134 + }; 135 + 136 + struct CatPositionRec 137 + { 138 + long initialize; 139 + short priv[6]; 140 + }; 141 + 142 + struct FSForkIOParam 143 + { 144 + QElemPtr qLink; 145 + short qType; 146 + short ioTrap; 147 + Ptr ioCmdAddr; 148 + IOCompletionUPP ioCompletion; 149 + volatile OSErr ioResult; 150 + void * reserved1; 151 + SInt16 reserved2; 152 + SInt16 forkRefNum; 153 + UInt8 reserved3; 154 + SInt8 permissions; 155 + const FSRefPtr ref; 156 + Ptr buffer; 157 + UInt32 requestCount; 158 + UInt32 actualCount; 159 + UInt16 positionMode; 160 + SInt64 positionOffset; 161 + FSAllocationFlags allocationFlags; 162 + UInt64 allocationAmount; 163 + UniCharCount forkNameLength; 164 + const UniChar * forkName; 165 + struct CatPositionRec forkIterator; 166 + struct HFSUniStr255* outForkName; 167 + }; 168 + 169 + enum 170 + { 171 + kFSPathMakeRefDefaultOptions = 0, 172 + kFSPathMakeRefDoNotFollowLeafSymlink = 1 173 + }; 174 + 175 + enum 176 + { 177 + kFSCatInfoNone = 0x0, 178 + kFSCatInfoTextEncoding = 0x1, 179 + kFSCatInfoNodeFlags = 0x2, 180 + kFSCatInfoVolume = 0x4, 181 + kFSCatInfoParentDirID = 0x8, 182 + kFSCatInfoNodeID = 0x10, 183 + kFSCatInfoCreateDate = 0x20, 184 + kFSCatInfoContentMod = 0x40, 185 + kFSCatInfoAttrMod = 0x80, 186 + kFSCatInfoAccessDate = 0x100, 187 + kFSCatInfoBackupDate = 0x200, 188 + kFSCatInfoPermissions = 0x400, 189 + kFSCatInfoFinderInfo = 0x800, 190 + kFSCatInfoFinderXInfo = 0x1000, 191 + kFSCatInfoValence = 0x2000, 192 + kFSCatInfoDataSizes = 0x4000, 193 + kFSCatInfoRsrcSizes = 0x8000, 194 + kFSCatInfoSharingFlags = 0x10000, 195 + kFSCatInfoUserPrivs = 0x20000, 196 + kFSCatInfoUserAccess = 0x80000, 197 + kFSCatInfoSetOwnership = 0x100000 198 + }; 199 + 200 + enum 201 + { 202 + kSystemFolderType = 'macs', 203 + kDesktopFolderType = 'desk', 204 + kSystemDesktopFolderType = 'sdsk', 205 + kTrashFolderType = 'trsh', 206 + kSystemTrashFolderType = 'strs', 207 + kWhereToEmptyTrashFolderType = 'empt', 208 + kPrintMonitorDocsFolderType = 'prnt', 209 + kStartupFolderType = 'strt', 210 + kShutdownFolderType = 'shdf', 211 + kAppleMenuFolderType = 'amnu', 212 + kControlPanelFolderType = 'ctrl', 213 + kSystemControlPanelFolderType = 'sctl', 214 + kExtensionFolderType = 'extn', 215 + kFontsFolderType = 'font', 216 + kPreferencesFolderType = 'pref', 217 + kSystemPreferencesFolderType = 'sprf', 218 + kTemporaryFolderType = 'temp' 219 + }; 220 + 221 + OSStatus FSPathMakeRef(const uint8_t* path, struct FSRef* fsref, Boolean* isDirectory); 222 + OSStatus FSPathMakeRefWithOptions(const uint8_t* path, long options, struct FSRef* fsref, Boolean* isDirectory); 223 + OSStatus FSRefMakePath(const struct FSRef* fsref, uint8_t* path, uint32_t maxSize); 224 + Boolean CFURLGetFSRef(CFURLRef urlref, struct FSRef* fsref); // in CF 225 + CFURLRef CFURLCreateFromFSRef(CFAllocatorRef alloc, struct FSRef* location); // --> in CF 226 + OSStatus FSFindFolder(long vRefNum, OSType folderType, Boolean createFolder, struct FSRef* location); 227 + 228 + OSStatus FSGetCatalogInfo(const FSRefPtr ref, uint32_t infoBits, struct FSCatalogInfo* infoOut, struct HFSUniStr255* nameOut, FSSpecPtr fsspec, FSRefPtr parentDir); 229 + 230 + OSErr PBCreateDirectoryUnicodeSync(struct FSRefParam* paramBlock); 231 + OSErr PBCreateFileUnicodeSync(struct FSRefParam* paramBlock); 232 + OSErr PBGetCatalogInfoSync(struct FSRefParam *paramBlock); 233 + OSErr PBMakeFSRefUnicodeSync(struct FSRefParam *paramBlock); 234 + OSErr PBOpenForkSync(struct FSForkIOParam *paramBlock); 235 + OSErr PBReadForkSync(struct FSForkIOParam *paramBlock); 236 + OSErr PBWriteForkSync(struct FSForkIOParam *paramBlock); 237 + OSErr PBIterateForksSync(struct FSForkIOParam *paramBlock); 238 + OSErr PBCloseForkSync(struct FSForkIOParam *paramBlock); 239 + 240 + #ifdef __cplusplus 241 + } 242 + #endif 243 + 244 + #endif 245 +
+74
src/CoreServices/include/CoreServices/FixMath.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2012-2013 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #ifndef FIXMATH_H 21 + #define FIXMATH_H 22 + #include "MacTypes.h" 23 + #include <stdint.h> 24 + 25 + #ifdef __cplusplus 26 + extern "C" { 27 + #endif 28 + 29 + float FixedToFloat(Fixed f); 30 + Fixed FloatToFixed(float f); 31 + 32 + Fract FloatToFract(float f); 33 + float FractToFloat(Fract f); 34 + 35 + Fixed FixRatio(short n, short denominator); 36 + Fixed FixMul(Fixed a, Fixed b); 37 + short FixRound(Fixed f); 38 + Fract Fix2Frac(Fixed f); 39 + int32_t Fix2Long(Fixed f); 40 + Fixed Long2Fix(int32_t v); 41 + Fixed Frac2Fix(Fract f); 42 + 43 + Fract FracMul(Fract x, Fract y); 44 + Fixed FixDiv(Fixed x, Fixed y); 45 + Fract FracDiv(Fract x, Fract y); 46 + Fract FracSqrt(Fract x); 47 + Fract FracSin(Fixed x); 48 + Fract FracCos(Fixed x); 49 + Fixed FixATan2(int32_t x, int32_t y); 50 + 51 + double Frac2X(Fract f); 52 + double Fix2X(Fract f); 53 + Fixed X2Fix(double d); 54 + Fract X2Frac(double d); 55 + 56 + short WideCompare(const wide* a, const wide* b); 57 + wide* WideAdd(wide* dst, const wide* val); 58 + wide* WideSubtract(wide* dst, const wide* val); 59 + wide* WideNegate(wide* val); 60 + wide* WideShift(wide* dst, int32_t shift); // rounds upwards 61 + uint32_t WideSquareRoot(const wide* val); 62 + wide* WideMultiply(int32_t a, int32_t b, wide* dst); 63 + int32_t WideDivide(const wide* divd, int32_t divs, int32_t* remainder); 64 + wide* WideWideDivide(wide* divd, int32_t divs, int32_t* remainder); 65 + wide* WideBitShift(wide* dst, int32_t shift); 66 + 67 + UnsignedFixed UnsignedFixedMulDiv(UnsignedFixed a, UnsignedFixed mul, UnsignedFixed div); 68 + 69 + #ifdef __cplusplus 70 + } 71 + #endif 72 + 73 + #endif 74 +
+43
src/CoreServices/include/CoreServices/Gestalt.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2012-2013 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #ifndef GESTALT_H 21 + #define GESTALT_H 22 + 23 + #define gestaltSystemVersion 'sysv' 24 + #define gestaltSystemVersionMajor 'sys1' 25 + #define gestaltSystemVersionMinor 'sys2' 26 + #define gestaltSystemVersionPatch 'sys3' 27 + 28 + #define gestaltSysArchitecture 'sysa' 29 + #define gestaltPowerPC 2 30 + #define gestaltIntel 10 31 + 32 + #ifdef __cplusplus 33 + extern "C" { 34 + #endif 35 + 36 + OSStatus Gestalt(uint32_t type, int* value); 37 + 38 + #ifdef __cplusplus 39 + } 40 + #endif 41 + 42 + #endif 43 +
+42
src/CoreServices/include/CoreServices/MacErrors.h
··· 1 + #ifndef MACERRORS_H 2 + #define MACERRORS_H 3 + #include <CoreFoundation/CFBase.h> 4 + #include <MacTypes.h> 5 + 6 + inline OSStatus makeOSStatus(int errNo) { return 100000 + errNo; } 7 + 8 + #define memFullErr -108 9 + #define internalComponentErr -2070 10 + //#define noErr 0 11 + #define unimpErr -4 12 + #define fnfErr -43 // file not found 13 + #define paramErr -50 14 + #define handlerNotFoundErr -1856 15 + #define kLocalesBufferTooSmallErr -30001 16 + #define kUCOutputBufferTooSmall -25340 17 + 18 + #define kAudioUnitErr_InvalidProperty -10879 19 + #define kAudioUnitErr_InvalidParameter -10878 20 + #define kAudioUnitErr_InvalidElement -10877 21 + #define kAudioUnitErr_NoConnection -10876 22 + #define kAudioUnitErr_FailedInitialization -10875 23 + #define kAudioUnitErr_TooManyFramesToProcess -10874 24 + #define kAudioUnitErr_IllegalInstrument -10873 25 + #define kAudioUnitErr_InstrumentTypeNotFound -10872 26 + #define kAudioUnitErr_InvalidFile -10871 27 + #define kAudioUnitErr_UnknownFileType -10870 28 + #define kAudioUnitErr_FileNotSpecified -10869 29 + #define kAudioUnitErr_FormatNotSupported -10868 30 + #define kAudioUnitErr_Uninitialized -10867 31 + #define kAudioUnitErr_InvalidScope -10866 32 + #define kAudioUnitErr_PropertyNotWritable -10865 33 + #define kAudioUnitErr_CannotDoInCurrentContext -10863 34 + #define kAudioUnitErr_InvalidPropertyValue -10851 35 + #define kAudioUnitErr_PropertyNotInUse -10850 36 + #define kAudioUnitErr_Initialized -10849 37 + #define kAudioUnitErr_InvalidOfflineRender -10848 38 + #define kAudioUnitErr_Unauthorized -10847 39 + 40 + #define kMPTimeoutErr -29296 41 + 42 + #endif
+78
src/CoreServices/include/CoreServices/MacLocales.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2012-2013 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #ifndef MACLOCALES_H 21 + #define MACLOCALES_H 22 + #include "MacErrors.h" 23 + #include <stdint.h> 24 + 25 + typedef int16_t RegionCode; 26 + typedef int16_t LangCode; 27 + typedef int16_t Utf16Char; 28 + 29 + typedef int LocaleRef; 30 + typedef uint32_t LocaleOperationClass; 31 + typedef uint32_t LocaleOperationVariant; 32 + 33 + struct LocaleAndVariant 34 + { 35 + LocaleRef ref; 36 + LocaleOperationVariant variant; 37 + }; 38 + 39 + #define kLocaleLanguageMask 0x1 40 + #define kLocaleLanguageVariantMask 0x2 41 + #define kLocaleScriptMask 0x4 42 + #define kLocaleScriptVariantMask 0x8 43 + #define kLocaleRegionMask 0x10 44 + #define kLocaleRegionVariantMask 0x20 45 + #define kLocaleAllPartsMask 0x3f 46 + 47 + #define kLocaleNameMask 0x1 48 + #define kLocaleOperationVariantNameMask 0x2 49 + #define kLocaleAndVariantNameMask (kLocaleNameMask|kLocaleOperationVariantNameMask) 50 + 51 + #define kTextLanguageDontCare -128 52 + #define kTextScriptDontCare -128 53 + #define kTextRegionDontCare -128 54 + 55 + #ifdef __cplusplus 56 + extern "C" { 57 + #endif 58 + 59 + OSStatus LocaleRefFromLangOrRegionCode(LangCode langCode, RegionCode regionCode, LocaleRef* refOut); 60 + OSStatus LocaleRefFromLocaleString(const char* str, LocaleRef* refOut); 61 + OSStatus LocaleRefGetPartString(LocaleRef ref, uint32_t partMask, unsigned long maxStringLen, char* stringOut); 62 + OSStatus LocaleStringToLangAndRegionCodes(const char* name, LangCode* langCode, RegionCode* regionCode); 63 + OSStatus LocaleOperationCountLocales(LocaleOperationClass cls, unsigned long* count); 64 + OSStatus LocaleOperationGetLocales(LocaleOperationClass cls, unsigned long max, unsigned long* countOut, struct LocaleAndVariant* out); 65 + OSStatus LocaleGetName(LocaleRef ref, LocaleOperationVariant variant, uint32_t nameMask, LocaleRef refDisplay, unsigned long maxLen, unsigned long* lenOut, Utf16Char* displayName); 66 + OSStatus LocaleCountNames(LocaleRef ref, LocaleOperationVariant variant, uint32_t nameMask, unsigned long* countOut); 67 + OSStatus LocaleGetIndName(LocaleRef ref, LocaleOperationVariant variant, uint32_t nameMask, unsigned long index, unsigned long maxLen, unsigned long* lenOut, Utf16Char* displayName, LocaleRef* displayLocale); 68 + OSStatus LocaleGetRegionLanguageName(RegionCode regionCode, char name[256]); 69 + OSStatus LocaleOperationGetName(LocaleOperationClass cls, LocaleRef ref, unsigned long maxLen, unsigned long* lenOut, Utf16Char* displayName); 70 + OSStatus LocaleOperationCountNames(LocaleOperationClass cls, unsigned long* count); 71 + OSStatus LocaleOperationGetIndName(LocaleOperationClass cls, unsigned long index, unsigned long maxLen, unsigned long* lenOut, Utf16Char* displayName, LocaleRef* displayLocale); 72 + 73 + #ifdef __cplusplus 74 + } 75 + #endif 76 + 77 + #endif 78 +
+27
src/CoreServices/include/CoreServices/MacMemory.h
··· 1 + #ifndef MACMEMORY_H 2 + #define MACMEMORY_H 3 + #include <stddef.h> 4 + #include "MacTypes.h" 5 + 6 + #ifdef __cplusplus 7 + extern "C" { 8 + #endif 9 + 10 + void BlockMove(const void* src, void* dst, size_t count); 11 + void BlockMoveData(const void* src, void* dst, size_t count); 12 + void BlockMoveUncached(const void* src, void* dst, size_t count); 13 + void BlockMoveDataUncached(const void* src, void* dst, size_t count); 14 + void BlockZero(void* dst, size_t count); 15 + void BlockZeroUncached(void* dst, size_t count); 16 + 17 + Ptr NewPtr(long len); 18 + Ptr NewPtrClear(long len); 19 + void DiposePtr(Ptr p); 20 + void DisposeHandle(Handle handle); 21 + // and other crap with relocatable memory blocks etc. 22 + 23 + #ifdef __cplusplus 24 + } 25 + #endif 26 + 27 + #endif
+1
src/CoreServices/include/CoreServices/MacTypes.h
··· 1 + ../../../../platform-include/MacTypes.h
+89
src/CoreServices/include/CoreServices/Math64.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2012-2013 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #ifndef MATH64_H 21 + #define MATH64_H 22 + 23 + #include <MacTypes.h> 24 + #include <stdint.h> 25 + 26 + #ifdef __cplusplus 27 + extern "C" { 28 + #endif 29 + 30 + int64_t S64Max(); 31 + int64_t S64Min(); 32 + 33 + int64_t S64Add(int64_t v1, int64_t v2); 34 + int64_t S64Subtract(int64_t v1, int64_t v2); 35 + int64_t S64Negate(int64_t v); 36 + int64_t S64Absolute(int64_t v); 37 + int64_t S64Multiply(int64_t v1, int64_t v2); 38 + int64_t S64Mod(int64_t divd, int64_t divs); 39 + int64_t S64Divide(int64_t divd, int64_t divs, int64_t* rem); 40 + int64_t S64Div(int64_t divd, int64_t divs); 41 + int64_t S64Set(int32_t v); 42 + int64_t S64SetU(uint32_t v); 43 + int32_t S32Set(int64_t v); 44 + int S64And(int64_t v1, int64_t v2); 45 + int S64Or(int64_t v1, int64_t v2); 46 + int S64Eor(int64_t v1, int64_t v2); 47 + int S64Not(int64_t v); 48 + int32_t S64Compare(int64_t l, int64_t r); 49 + int64_t S64BitwiseAnd(int64_t v1, int64_t v2); 50 + int64_t S64BitwiseOr(int64_t v1, int64_t v2); 51 + int64_t S64BitwiseEor(int64_t v1, int64_t v2); 52 + int64_t S64BitwiseNor(int64_t v1); 53 + int64_t S64ShiftRight(int64_t v, uint32_t shift); 54 + int64_t S64ShiftLeft(int64_t v, uint32_t shift); 55 + long double S64ToLongDouble(int64_t v); 56 + int64_t LongDoubleToSInt64(long double v); 57 + 58 + uint64_t U64Max(); 59 + uint64_t U64Add(uint64_t v1, uint64_t v2); 60 + uint64_t U64Subtract(uint64_t v1, uint64_t v2); 61 + uint64_t U64Multiply(uint64_t v1, uint64_t v2); 62 + uint64_t U64Mod(uint64_t divd, uint64_t divs); 63 + uint64_t U64Divide(uint64_t divd, uint64_t divs, uint64_t* rem); 64 + uint64_t U64Div(uint64_t divd, uint64_t divs); 65 + uint64_t U64Set(int32_t v); 66 + uint64_t U64SetU(uint32_t v); 67 + int U64And(uint64_t v1, uint64_t v2); 68 + int U64Or(uint64_t v1, uint64_t v2); 69 + int U64Eor(uint64_t v1, uint64_t v2); 70 + int U64Not(uint64_t v); 71 + int32_t U64Compare(uint64_t l, uint64_t r); 72 + uint64_t U64BitwiseAnd(uint64_t v1, uint64_t v2); 73 + uint64_t U64BitwiseOr(uint64_t v1, uint64_t v2); 74 + uint64_t U64BitwiseEor(uint64_t v1, uint64_t v2); 75 + uint64_t U64BitwiseNor(uint64_t v1); 76 + uint64_t U64ShiftRight(uint64_t v, uint32_t shift); 77 + uint64_t U64ShiftLeft(uint64_t v, uint32_t shift); 78 + long double U64ToLongDouble(uint64_t v); 79 + uint64_t LongDoubleToUInt64(long double v); 80 + 81 + int64_t UInt64ToSInt64(uint64_t v); 82 + uint64_t SInt64ToUInt64(int64_t v); 83 + 84 + #ifdef __cplusplus 85 + } 86 + #endif 87 + 88 + #endif 89 +
+33
src/CoreServices/include/CoreServices/Multiprocessing.h
··· 1 + #ifndef MULTIPROCESSING_H 2 + #define MULTIPROCESSING_H 3 + #include "MacTypes.h" 4 + 5 + #ifdef __cplusplus 6 + extern "C" { 7 + #endif 8 + 9 + enum { 10 + kDurationImmediate = 0, 11 + kDurationForever = 0x7FFFFFFF, 12 + kDurationMillisecond = 1, 13 + kDurationMicrosecond = -1 14 + }; 15 + 16 + typedef void* MPCriticalRegionID; 17 + 18 + Boolean _MPIsFullyInitialized(); 19 + OSStatus MPDelayUntil(AbsoluteTime* time); 20 + unsigned long MPProcessors(); 21 + 22 + OSStatus MPCreateCriticalRegion(MPCriticalRegionID* criticalRegion); 23 + OSStatus MPDeleteCriticalRegion(MPCriticalRegionID criticalRegion); 24 + OSStatus MPEnterCriticalRegion(MPCriticalRegionID criticalRegion, Duration timeout); 25 + OSStatus MPExitCriticalRegion(MPCriticalRegionID criticalRegion); 26 + 27 + // other functions are missing... 28 + 29 + #ifdef __cplusplus 30 + } 31 + #endif 32 + 33 + #endif
+35
src/CoreServices/include/CoreServices/OpenTransport.h
··· 1 + #ifndef OPENTRANSPORT_H 2 + #define OPENTRANSPORT_H 3 + #include <MacTypes.h> 4 + #include <stdint.h> 5 + 6 + #ifdef __cplusplus 7 + extern "C" { 8 + #endif 9 + 10 + typedef unsigned int OTByteCount; 11 + typedef unsigned int OTItemCount; 12 + typedef int32_t OTInt32; 13 + typedef uint32_t OTUInt32; 14 + 15 + 16 + #if defined(__i386__) || defined(__ppc__) // This is deprecated stuff for Carbon apps 17 + 18 + Boolean OTAtomicSetBit(UInt8* bytePtr, OTByteCount bitNumber); 19 + Boolean OTAtomicClearBit(UInt8* bytePtr, OTByteCount bitNumber); 20 + Boolean OTAtomicTestBit(UInt8* bytePtr, OTByteCount bitNumber); 21 + Boolean OTCompareAndSwapPtr(void* oldValue, void* newValue, void** dest); 22 + Boolean OTCompareAndSwap32(UInt32 oldValue, UInt32 newValue, UInt32* dest); 23 + Boolean OTCompareAndSwap16(UInt32 oldValue, UInt32 newValue, UInt16* dest); 24 + Boolean OTCompareAndSwap8(UInt32 oldValue, UInt32 newValue, UInt8* dest); 25 + SInt32 OTAtomicAdd32(SInt32 toAdd, SInt32* dest); 26 + SInt16 OTAtomicAdd16(SInt32 toAdd, SInt16* dest); 27 + SInt8 OTAtomicAdd8(SInt32 toAdd, SInt8* dest); 28 + 29 + #endif 30 + 31 + #ifdef __cplusplus 32 + } 33 + #endif 34 + 35 + #endif
+55
src/CoreServices/include/CoreServices/Processes.h
··· 1 + #ifndef PROCESSES_H 2 + #define PROCESSES_H 3 + #include "MacTypes.h" 4 + #include "FileManager.h" 5 + #include <CoreFoundation/CFString.h> 6 + #include <CoreFoundation/CFDictionary.h> 7 + #include <sys/types.h> 8 + 9 + struct ProcessInfoRec 10 + { 11 + unsigned long processInfoLength; 12 + // fields omitted 13 + }; 14 + 15 + struct LaunchParamBlockRec 16 + { 17 + // fields omitted 18 + }; 19 + 20 + enum { kNoProcess = 0, kSystemProcess = 1, kCurrentProcess = 2 }; 21 + enum { procNotFound = -600 }; 22 + 23 + #ifdef __cplusplus 24 + extern "C" { 25 + #endif 26 + 27 + OSStatus CopyProcessName(const ProcessSerialNumber* psn, CFStringRef* name); 28 + void ExitToShell(); 29 + OSErr GetCurrentProcess(ProcessSerialNumber* psn); 30 + OSErr GetFrontProcess(ProcessSerialNumber* psn); 31 + OSErr GetNextProcess(ProcessSerialNumber* psn); 32 + OSStatus GetProcessBundleLocation(const ProcessSerialNumber* psn, FSRef* location); 33 + OSStatus GetProcessForPID(pid_t pid, ProcessSerialNumber* psn); 34 + OSErr GetProcessInformation(const ProcessSerialNumber* psn, struct ProcessInfoRec* pi); 35 + OSStatus GetProcessPID(const ProcessSerialNumber* psn, pid_t* pid); 36 + Boolean IsProcessVisible(const ProcessSerialNumber* psn); 37 + OSErr KillProcess(const ProcessSerialNumber* psn); 38 + OSErr LaunchApplication(struct LaunchParamBlockRec* launch); 39 + CFDictionaryRef ProcessInformationCopyDictionary(const ProcessSerialNumber *PSN, UInt32 infoToReturn); 40 + OSErr SameProcess(const ProcessSerialNumber* psn1, const ProcessSerialNumber* psn2, Boolean* result); 41 + OSErr SetFrontProcess(const ProcessSerialNumber* psn); 42 + OSErr SetFrontProcessWithOptions(const ProcessSerialNumber* psn, OptionBits opts); 43 + OSErr ShowHideProcess(const ProcessSerialNumber* psn, Boolean visible); 44 + OSStatus TransformProcessType(const ProcessSerialNumber* psn, UInt32 type); 45 + OSErr WakeUpProcess(const ProcessSerialNumber* psn); 46 + 47 + // extern CFStringRef kCFBundleExecutableKey; 48 + // extern CFStringRef kCFBundleNameKey; 49 + // extern CFStringRef kCFBundleIdentifierKey; 50 + 51 + #ifdef __cplusplus 52 + } 53 + #endif 54 + 55 + #endif
src/CoreServices/include/CoreServices/ScriptManager.h

This is a binary file and will not be displayed.

+75
src/CoreServices/include/CoreServices/TextCommon.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2017 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #ifndef _TEXTCOMMON_H 21 + #define _TEXTCOMMON_H 22 + #include <MacTypes.h> 23 + 24 + #ifdef __cplusplus 25 + extern "C" { 26 + #endif 27 + 28 + typedef UInt8* TextPtr; 29 + typedef const UInt8* ConstTextPtr; 30 + 31 + enum { 32 + kTextEncodingUnicodeDefault = 0x100 33 + }; 34 + 35 + enum { 36 + kTextEncodingDefaultVariant = 0 37 + }; 38 + 39 + enum { 40 + kTextEncodingDefaultFormat = 0, 41 + kUnicodeUTF16Format = 0, 42 + kUnicodeUTF7Format = 1, 43 + kUnicodeUTF8Format = 2, 44 + kUnicodeUTF32Format = 3, 45 + kUnicodeUTF16BEFormat = 4, 46 + kUnicodeUTF16LEFormat = 5, 47 + kUnicodeUTF32BEFormat = 6, 48 + kUnicodeUTF32LEFormat = 7, 49 + kUnicodeSCSUFormat = 8, 50 + kUnicode16BitFormat = 0, 51 + kUnicode32BitFormat = 3, 52 + }; 53 + 54 + enum { 55 + kUnicodeNoSubset = 0, 56 + kUnicodeNormalizationFormD = 5, 57 + kUnicodeNormalizationFormC = 3, 58 + kUnicodeCanonicalCompVariant = kUnicodeNormalizationFormC, 59 + kUnicodeHFSPlusDecompVariant = 8, 60 + kUnicodeHFSPlusCompVariant = 9, 61 + }; 62 + 63 + typedef UInt32 TextEncoding; 64 + typedef UInt32 TextEncodingBase; 65 + typedef UInt32 TextEncodingFormat; 66 + typedef UInt32 TextEncodingVariant; 67 + 68 + TextEncoding CreateTextEncoding(TextEncodingBase encodingBase, TextEncodingVariant encodingVariant, TextEncodingFormat encodingFormat); 69 + 70 + #ifdef __cplusplus 71 + } 72 + #endif 73 + 74 + #endif 75 +
+44
src/CoreServices/include/CoreServices/TextEncodingConverter.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2017 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #ifndef _TEXTENCODINGCONVERTER_H 21 + #define _TEXTENCODINGCONVERTER_H 22 + #include <MacTypes.h> 23 + #include "TextCommon.h" 24 + 25 + #ifdef __cplusplus 26 + extern "C" { 27 + #endif 28 + 29 + typedef struct OpaqueTECObjectRef* TECObjectRef; 30 + 31 + OSStatus TECCreateConverter(TECObjectRef *newEncodingConverter, TextEncoding inputEncoding, TextEncoding outputEncoding); 32 + 33 + OSStatus TECConvertText(TECObjectRef encodingConverter, ConstTextPtr inputBuffer, ByteCount inputBufferLength, ByteCount *actualInputLength, TextPtr outputBuffer, ByteCount outputBufferLength, ByteCount *actualOutputLength); 34 + 35 + OSStatus TECFlushText(TECObjectRef encodingConverter, TextPtr outputBuffer, ByteCount outputBufferLength, ByteCount *actualOutputLength); 36 + 37 + OSStatus TECDisposeConverter(TECObjectRef newEncodingConverter); 38 + 39 + #ifdef __cplusplus 40 + } 41 + #endif 42 + 43 + #endif 44 +
+31
src/CoreServices/include/CoreServices/TextUtils.h
··· 1 + #ifndef TEXTUTILS_H 2 + #define TEXTUTILS_H 3 + #include "MacTypes.h" 4 + 5 + #ifdef __cplusplus 6 + extern "C" { 7 + #endif 8 + 9 + // There are many functions missing, but will be added as-needed. 10 + // There is no point in spending time implementing all this ancient stuff. 11 + 12 + StringHandle NewString(const Str255 str); 13 + void SetString(StringHandle handle, const Str255 str); 14 + 15 + void UpperString(Str255 str, Boolean diac); 16 + void upperstring(char* str, Boolean diac); 17 + 18 + void c2pstrcpy(Str255 dst, const char* src); 19 + void p2cstrcpy(char* dst, const Str255 src); 20 + void CopyPascalStringToC(const Str255 src, char* dst); 21 + void CopyCStringToPascal(const char* src, Str255 dst); 22 + StringPtr c2pstr(char* str); 23 + StringPtr C2PStr(Ptr str); 24 + char* p2cstr(StringPtr str); 25 + Ptr P2CStr(StringPtr str); 26 + 27 + #ifdef __cplusplus 28 + } 29 + #endif 30 + 31 + #endif
+17
src/CoreServices/include/CoreServices/Timer.h
··· 1 + #ifndef TIMER_H_ 2 + #define TIMER_H_ 3 + #include "MacTypes.h" 4 + 5 + #ifdef __cplusplus 6 + extern "C" { 7 + #endif 8 + 9 + void Microseconds(UnsignedWide* tickCount); 10 + 11 + #ifdef __cplusplus 12 + } 13 + #endif 14 + 15 + #endif 16 + 17 +
+40
src/CoreServices/include/CoreServices/ToolUtils.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2012-2013 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #ifndef TOOLUTILS_H 21 + #define TOOLUTILS_H 22 + 23 + #ifdef __cplusplus 24 + extern "C" { 25 + #endif 26 + 27 + int BitTst(const void* bytePtr, long bitNum); 28 + void BitSet(void* bytePtr, long bitNum); 29 + void BitClr(void* bytePtr, long bitNum); 30 + long BitAnd(long v1, long v2); 31 + long BitXor(long v1, long v2); 32 + long BitNot(long v1); 33 + long BitShift(long value, short count); 34 + 35 + #ifdef __cplusplus 36 + } 37 + #endif 38 + 39 + #endif 40 +
+16
src/CoreServices/include/CoreServices/UniChar.h
··· 1 + #ifndef UNICHAR_H 2 + #define UNICHAR_H 3 + #include "MacTypes.h" 4 + #include <TargetConditionals.h> 5 + 6 + // UniChar uses platform endianness, whereas ICU expects BE by default 7 + #if TARGET_RT_BIG_ENDIAN 8 + # define UNICHAR_ENCODING "UTF-16BE" 9 + #elif TARGET_RT_LITTLE_ENDIAN 10 + # define UNICHAR_ENCODING "UTF-16LE" 11 + #else 12 + # error Cannot determine endianness! 13 + #endif 14 + 15 + #endif 16 +
+61
src/CoreServices/include/CoreServices/UnicodeUtilities.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2013 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #ifndef UNICODEUTILITIES_H 21 + #define UNICODEUTILITIES_H 22 + #include "MacTypes.h" 23 + #include "MacLocales.h" 24 + #include <stdint.h> 25 + 26 + #ifdef __cplusplus 27 + extern "C" { 28 + #endif 29 + 30 + typedef void* CollatorRef; 31 + enum //: uint32_t 32 + { 33 + kUCCollateComposeInsensitiveMask = 0x2, 34 + kUCCollateWidthInsensitiveMask = 0x4, 35 + kUCCollateCaseInsensitiveMask = 0x8, 36 + kUCCollateDiacritInsensitiveMask = 0x10, 37 + kUCCollatePunctuationSignificantMask = 0x8000, 38 + kUCCollateDigitsOverrideMask = 0x10000, 39 + kUCCollateDigitsAsNumberMask = 0x20000 40 + }; 41 + 42 + 43 + OSStatus UCCreateCollator(LocaleRef locale, LocaleOperationVariant opVariant, uint32_t options, CollatorRef* collator); 44 + 45 + OSStatus UCGetCollationKey(CollatorRef collator, const UniChar * text, unsigned long textlen, unsigned long maxKeySize, unsigned long* actualKeySize, uint32_t* collationKey); 46 + 47 + OSStatus UCCompareCollationKeys(const uint32_t* key1, unsigned long key1len, const uint32_t* key2, unsigned long key2len, Boolean* equiv, int32_t* order); 48 + 49 + OSStatus UCCompareText(CollatorRef collator, const UniChar* text1, unsigned long text1len, const UniChar* text2, unsigned long text2len, Boolean* equiv, int32_t* order); 50 + 51 + OSStatus UCDisposeCollator(CollatorRef* collator); 52 + 53 + OSStatus UCCompareTextDefault(uint32_t options, const UniChar* text1, unsigned long text1len, const UniChar* text2, unsigned long text2len, Boolean* equiv, int32_t* order); 54 + 55 + OSStatus UCCompareTextNoLocale(uint32_t options, const UniChar* text1, unsigned long text1len, const UniChar* text2, unsigned long text2len, Boolean* equiv, int32_t* order); 56 + 57 + #ifdef __cplusplus 58 + } 59 + #endif 60 + 61 + #endif
-1
src/CoreServices/include/CoreServicesPriv.h
··· 1 - .././CoreServicesPriv.h
-1
src/CoreServices/include/DateTimeUtils.h
··· 1 - .././DateTimeUtils.h
-1
src/CoreServices/include/DriverServices.h
··· 1 - .././DriverServices.h
-1
src/CoreServices/include/DriverSynchronization.h
··· 1 - .././DriverSynchronization.h
-1
src/CoreServices/include/FileManager.h
··· 1 - .././FileManager.h
-1
src/CoreServices/include/FixMath.h
··· 1 - .././FixMath.h
+1 -1
src/CoreServices/include/Frameworks/CarbonCore.framework/Headers/MacErrors.h
··· 1 - ../../../MacErrors.h 1 + ../../../CoreServices/MacErrors.h
-1
src/CoreServices/include/Gestalt.h
··· 1 - .././Gestalt.h
-1
src/CoreServices/include/LaunchServices.h
··· 1 - .././LaunchServices.h
-1
src/CoreServices/include/MacErrors.h
··· 1 - .././MacErrors.h
-1
src/CoreServices/include/MacLocales.h
··· 1 - .././MacLocales.h
-1
src/CoreServices/include/MacMemory.h
··· 1 - .././MacMemory.h
-1
src/CoreServices/include/Math64.h
··· 1 - .././Math64.h
-1
src/CoreServices/include/Multiprocessing.h
··· 1 - .././Multiprocessing.h
-1
src/CoreServices/include/OpenTransport.h
··· 1 - .././OpenTransport.h
-1
src/CoreServices/include/Processes.h
··· 1 - .././Processes.h
-1
src/CoreServices/include/ScriptManager.h
··· 1 - .././ScriptManager.h
-1
src/CoreServices/include/TextUtils.h
··· 1 - .././TextUtils.h
-1
src/CoreServices/include/Timer.h
··· 1 - .././Timer.h
-1
src/CoreServices/include/ToolUtils.h
··· 1 - .././ToolUtils.h
-1
src/CoreServices/include/UniChar.h
··· 1 - .././UniChar.h
-1
src/CoreServices/include/UnicodeUtilities.h
··· 1 - .././UnicodeUtilities.h
-8
src/DiskArbitration/CMakeLists.txt
··· 2 2 3 3 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdinc") 4 4 5 - include_directories( 6 - ${CMAKE_SOURCE_DIR}/src/external/corefoundation 7 - ${CMAKE_SOURCE_DIR}/src/external/libclosure 8 - ${CMAKE_SOURCE_DIR}/src/external/foundation/Headers 9 - ${CMAKE_SOURCE_DIR}/src/libc/include/FreeBSD 10 - ${CMAKE_SOURCE_DIR}/src/launchd/liblaunch 11 - ) 12 - 13 5 set(da_SRCS 14 6 DADisk.c 15 7 DADissenter.c
+4 -3
src/DiskArbitration/DADisk.c
··· 1 - #include "DADisk.h" 1 + #include <DiskArbitration/DiskArbitration.h> 2 2 #include <stddef.h> 3 3 #include <string.h> 4 4 #include <CoreFoundation/CFRuntime.h> 5 5 #include <CoreFoundation/CFBase.h> 6 6 #include <CoreFoundation/CFURL.h> 7 7 #include <CoreFoundation/CFDictionary.h> 8 + #include <CoreFoundation/CoreFoundation.h> 8 9 9 10 #define CONST_STRING_DECL(name, value) const CFStringRef name = CFSTR(value); 10 11 ··· 46 47 CONST_STRING_DECL(kDADiskDescriptionBusNameKey, "kDADiskDescriptionBusNameKey"); 47 48 CONST_STRING_DECL(kDADiskDescriptionBusPathKey, "kDADiskDescriptionBusPathKey"); 48 49 49 - struct _DADisk 50 + struct __DADisk 50 51 { 51 52 CFRuntimeBase _parent; 52 53 DASessionRef session; ··· 78 79 _kDADiskTypeID = _CFRuntimeRegisterClass (&DADiskClass); 79 80 } 80 81 81 - #define DADISK_SIZE sizeof(struct _DADisk) - sizeof(CFRuntimeBase) 82 + #define DADISK_SIZE sizeof(struct __DADisk) - sizeof(CFRuntimeBase) 82 83 83 84 static void 84 85 DADiskFinalize (CFTypeRef cf)
+1 -68
src/DiskArbitration/DADisk.h
··· 1 - #ifndef _DADISK_H_ 2 - #define _DADISK_H_ 3 - 4 - #include <CoreFoundation/CoreFoundation.h> 5 - #include "DASession.h" 6 - 7 - #ifdef __cplusplus 8 - extern "C" { 9 - #endif /* __cplusplus */ 10 - 11 - extern const CFStringRef kDADiskDescriptionVolumeKindKey; 12 - extern const CFStringRef kDADiskDescriptionVolumeMountableKey; 13 - extern const CFStringRef kDADiskDescriptionVolumeNameKey; 14 - extern const CFStringRef kDADiskDescriptionVolumeNetworkKey; 15 - extern const CFStringRef kDADiskDescriptionVolumePathKey; 16 - extern const CFStringRef kDADiskDescriptionVolumeUUIDKey; 17 - 18 - extern const CFStringRef kDADiskDescriptionMediaBlockSizeKey; 19 - extern const CFStringRef kDADiskDescriptionMediaBSDMajorKey; 20 - extern const CFStringRef kDADiskDescriptionMediaBSDMinorKey; 21 - extern const CFStringRef kDADiskDescriptionMediaBSDNameKey; 22 - extern const CFStringRef kDADiskDescriptionMediaBSDUnitKey; 23 - extern const CFStringRef kDADiskDescriptionMediaContentKey; 24 - extern const CFStringRef kDADiskDescriptionMediaEjectableKey; 25 - extern const CFStringRef kDADiskDescriptionMediaIconKey; 26 - extern const CFStringRef kDADiskDescriptionMediaKindKey; 27 - extern const CFStringRef kDADiskDescriptionMediaLeafKey; 28 - extern const CFStringRef kDADiskDescriptionMediaNameKey; 29 - extern const CFStringRef kDADiskDescriptionMediaPathKey; 30 - extern const CFStringRef kDADiskDescriptionMediaRemovableKey; 31 - extern const CFStringRef kDADiskDescriptionMediaSizeKey; 32 - extern const CFStringRef kDADiskDescriptionMediaTypeKey; 33 - extern const CFStringRef kDADiskDescriptionMediaUUIDKey; 34 - extern const CFStringRef kDADiskDescriptionMediaWholeKey; 35 - extern const CFStringRef kDADiskDescriptionMediaWritableKey; 36 - 37 - extern const CFStringRef kDADiskDescriptionDeviceGUIDKey; 38 - extern const CFStringRef kDADiskDescriptionDeviceInternalKey; 39 - extern const CFStringRef kDADiskDescriptionDeviceModelKey; 40 - extern const CFStringRef kDADiskDescriptionDevicePathKey; 41 - extern const CFStringRef kDADiskDescriptionDeviceProtocolKey; 42 - extern const CFStringRef kDADiskDescriptionDeviceRevisionKey; 43 - extern const CFStringRef kDADiskDescriptionDeviceUnitKey; 44 - extern const CFStringRef kDADiskDescriptionDeviceVendorKey; 45 - 46 - extern const CFStringRef kDADiskDescriptionBusNameKey; 47 - extern const CFStringRef kDADiskDescriptionBusPathKey; 48 - 49 - struct _DADisk; 50 - typedef struct _DADisk* DADiskRef; 51 - 52 - typedef int io_service_t; // hack 53 - 54 - CFTypeID DADiskGetTypeID(void); 55 - 56 - DADiskRef DADiskCreateFromBSDName(CFAllocatorRef allocator, DASessionRef session, const char* name); 57 - DADiskRef DADiskCreateFromIOMedia(CFAllocatorRef allocator, DASessionRef session, io_service_t media); 58 - DADiskRef DADiskCreateFromVolumePath(CFAllocatorRef allocator, DASessionRef session, CFURLRef path); 59 - const char* DADiskGetBSDName(DADiskRef disk); 60 - io_service_t DADiskCopyIOMedia(DADiskRef disk); 61 - CFDictionaryRef DADiskCopyDescription(DADiskRef disk); 62 - DADiskRef DADiskCopyWholeDisk(DADiskRef disk); 63 - 64 - #ifdef __cplusplus 65 - } 66 - #endif /* __cplusplus */ 67 - 68 - #endif 1 + include/DiskArbitration/DADisk.h
+1 -22
src/DiskArbitration/DADissenter.h
··· 1 - #ifndef DADISSENTER_H 2 - #define DADISSENTER_H 3 - #include <CoreFoundation/CoreFoundation.h> 4 - 5 - #ifdef __cplusplus 6 - extern "C" { 7 - #endif 8 - 9 - typedef int DAReturn; 10 - 11 - typedef struct _DADissenter* DADissenterRef; 12 - 13 - DADissenterRef DADissenterCreate(CFAllocatorRef allocator, DAReturn status, CFStringRef string); 14 - DAReturn DADissenterGetStatus(DADissenterRef dissenter); 15 - CFStringRef DADissenterGetStatusString(DADissenterRef dissenter); 16 - 17 - #ifdef __cplusplus 18 - } 19 - #endif 20 - 21 - #endif /* DADISSENTER_H */ 22 - 1 + include/DiskArbitration/DADissenter.h
+1 -32
src/DiskArbitration/DASession.h
··· 1 - #ifndef DASESSION_H 2 - #define DASESSION_H 3 - #include <CoreFoundation/CoreFoundation.h> 4 - #include <dispatch/dispatch.h> 5 - 6 - #ifdef __cplusplus 7 - extern "C" { 8 - #endif 9 - 10 - typedef struct _DASession * DASessionRef; 11 - 12 - //typedef void* dispatch_queue_t; // hack 13 - 14 - CFTypeID DASessionGetTypeID(void); 15 - DASessionRef DASessionCreate(CFAllocatorRef allocator); 16 - void DASessionScheduleWithRunLoop(DASessionRef session, CFRunLoopRef runLoop, CFStringRef runLoopMode); 17 - void DASessionUnscheduleFromRunLoop(DASessionRef session, CFRunLoopRef runLoop, CFStringRef runLoopMode); 18 - void DASessionSetDispatchQueue(DASessionRef session, dispatch_queue_t queue); 19 - 20 - typedef struct _DAApprovalSession * DAApprovalSessionRef; 21 - 22 - CFTypeID DAApprovalSessionGetTypeID(void); 23 - DAApprovalSessionRef DAApprovalSessionCreate(CFAllocatorRef allocator); 24 - void DAApprovalSessionScheduleWithRunLoop(DAApprovalSessionRef session, CFRunLoopRef runLoop, CFStringRef runLoopMode); 25 - void DAApprovalSessionUnscheduleFromRunLoop(DAApprovalSessionRef session, CFRunLoopRef runLoop, CFStringRef runLoopMode); 26 - 27 - #ifdef __cplusplus 28 - } 29 - #endif 30 - 31 - #endif /* DASESSION_H */ 32 - 1 + include/DiskArbitration/DASession.h
+203
src/DiskArbitration/include/DiskArbitration/DADisk.h
··· 1 + /* 2 + * Copyright (c) 1998-2015 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. Please obtain a copy of the License at 10 + * http://www.opensource.apple.com/apsl/ and read it before using this 11 + * file. 12 + * 13 + * The Original Code and all software distributed under the License are 14 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 + * Please see the License for the specific language governing rights and 19 + * limitations under the License. 20 + * 21 + * @APPLE_LICENSE_HEADER_END@ 22 + */ 23 + 24 + #ifndef __DISKARBITRATION_DADISK__ 25 + #define __DISKARBITRATION_DADISK__ 26 + 27 + #include <CoreFoundation/CoreFoundation.h> 28 + #include <IOKit/IOKitLib.h> 29 + 30 + #include <DiskArbitration/DASession.h> 31 + 32 + #ifdef __cplusplus 33 + extern "C" { 34 + #endif /* __cplusplus */ 35 + 36 + CF_ASSUME_NONNULL_BEGIN 37 + CF_IMPLICIT_BRIDGING_ENABLED 38 + 39 + extern const CFStringRef kDADiskDescriptionVolumeKindKey; /* ( CFString ) */ 40 + extern const CFStringRef kDADiskDescriptionVolumeMountableKey; /* ( CFBoolean ) */ 41 + extern const CFStringRef kDADiskDescriptionVolumeNameKey; /* ( CFString ) */ 42 + extern const CFStringRef kDADiskDescriptionVolumeNetworkKey; /* ( CFBoolean ) */ 43 + extern const CFStringRef kDADiskDescriptionVolumePathKey; /* ( CFURL ) */ 44 + extern const CFStringRef kDADiskDescriptionVolumeTypeKey; /* ( CFString ) */ 45 + extern const CFStringRef kDADiskDescriptionVolumeUUIDKey; /* ( CFUUID ) */ 46 + 47 + extern const CFStringRef kDADiskDescriptionMediaBlockSizeKey; /* ( CFNumber ) */ 48 + extern const CFStringRef kDADiskDescriptionMediaBSDMajorKey; /* ( CFNumber ) */ 49 + extern const CFStringRef kDADiskDescriptionMediaBSDMinorKey; /* ( CFNumber ) */ 50 + extern const CFStringRef kDADiskDescriptionMediaBSDNameKey; /* ( CFString ) */ 51 + extern const CFStringRef kDADiskDescriptionMediaBSDUnitKey; /* ( CFNumber ) */ 52 + extern const CFStringRef kDADiskDescriptionMediaContentKey; /* ( CFString ) */ 53 + extern const CFStringRef kDADiskDescriptionMediaEjectableKey; /* ( CFBoolean ) */ 54 + extern const CFStringRef kDADiskDescriptionMediaIconKey; /* ( CFDictionary ) */ 55 + extern const CFStringRef kDADiskDescriptionMediaKindKey; /* ( CFString ) */ 56 + extern const CFStringRef kDADiskDescriptionMediaLeafKey; /* ( CFBoolean ) */ 57 + extern const CFStringRef kDADiskDescriptionMediaNameKey; /* ( CFString ) */ 58 + extern const CFStringRef kDADiskDescriptionMediaPathKey; /* ( CFString ) */ 59 + extern const CFStringRef kDADiskDescriptionMediaRemovableKey; /* ( CFBoolean ) */ 60 + extern const CFStringRef kDADiskDescriptionMediaSizeKey; /* ( CFNumber ) */ 61 + extern const CFStringRef kDADiskDescriptionMediaTypeKey; /* ( CFString ) */ 62 + extern const CFStringRef kDADiskDescriptionMediaUUIDKey; /* ( CFUUID ) */ 63 + extern const CFStringRef kDADiskDescriptionMediaWholeKey; /* ( CFBoolean ) */ 64 + extern const CFStringRef kDADiskDescriptionMediaWritableKey; /* ( CFBoolean ) */ 65 + 66 + extern const CFStringRef kDADiskDescriptionDeviceGUIDKey; /* ( CFData ) */ 67 + extern const CFStringRef kDADiskDescriptionDeviceInternalKey; /* ( CFBoolean ) */ 68 + extern const CFStringRef kDADiskDescriptionDeviceModelKey; /* ( CFString ) */ 69 + extern const CFStringRef kDADiskDescriptionDevicePathKey; /* ( CFString ) */ 70 + extern const CFStringRef kDADiskDescriptionDeviceProtocolKey; /* ( CFString ) */ 71 + extern const CFStringRef kDADiskDescriptionDeviceRevisionKey; /* ( CFString ) */ 72 + extern const CFStringRef kDADiskDescriptionDeviceUnitKey; /* ( CFNumber ) */ 73 + extern const CFStringRef kDADiskDescriptionDeviceVendorKey; /* ( CFString ) */ 74 + 75 + extern const CFStringRef kDADiskDescriptionBusNameKey; /* ( CFString ) */ 76 + extern const CFStringRef kDADiskDescriptionBusPathKey; /* ( CFString ) */ 77 + 78 + #ifndef __DISKARBITRATIOND__ 79 + 80 + /*! 81 + * @typedef DADiskRef 82 + * Type of a reference to DADisk instances. 83 + */ 84 + 85 + typedef struct CF_BRIDGED_TYPE( id ) __DADisk * DADiskRef; 86 + 87 + /*! 88 + * @function DADiskGetTypeID 89 + * @abstract Returns the type identifier of all DADisk instances. 90 + */ 91 + 92 + extern CFTypeID DADiskGetTypeID( void ); 93 + 94 + /*! 95 + * @function DADiskCreateFromBSDName 96 + * @abstract Creates a new disk object. 97 + * @param allocator The allocator object to be used to allocate memory. 98 + * @param session The DASession in which to contact Disk Arbitration. 99 + * @param name The BSD device name. 100 + * @result A reference to a new DADisk. 101 + * @discussion 102 + * The caller of this function receives a reference to the returned object. The 103 + * caller also implicitly retains the object and is responsible for releasing it 104 + * with CFRelease(). 105 + */ 106 + 107 + extern DADiskRef __nullable DADiskCreateFromBSDName( CFAllocatorRef __nullable allocator, DASessionRef session, const char * name ); 108 + 109 + /*! 110 + * @function DADiskCreateFromIOMedia 111 + * @abstract Creates a new disk object. 112 + * @param allocator The allocator object to be used to allocate memory. 113 + * @param session The DASession in which to contact Disk Arbitration. 114 + * @param media The I/O Kit media object. 115 + * @result A reference to a new DADisk. 116 + * @discussion 117 + * The caller of this function receives a reference to the returned object. The 118 + * caller also implicitly retains the object and is responsible for releasing it 119 + * with CFRelease(). 120 + */ 121 + 122 + extern DADiskRef __nullable DADiskCreateFromIOMedia( CFAllocatorRef __nullable allocator, DASessionRef session, io_service_t media ); 123 + 124 + /*! 125 + * @function DADiskCreateFromVolumePath 126 + * @abstract Creates a new disk object. 127 + * @param allocator The allocator object to be used to allocate memory. 128 + * @param session The DASession in which to contact Disk Arbitration. 129 + * @param path The BSD mount point. 130 + * @result A reference to a new DADisk. 131 + * @discussion 132 + * The caller of this function receives a reference to the returned object. The 133 + * caller also implicitly retains the object and is responsible for releasing it 134 + * with CFRelease(). 135 + */ 136 + 137 + extern DADiskRef __nullable DADiskCreateFromVolumePath( CFAllocatorRef __nullable allocator, DASessionRef session, CFURLRef path ); 138 + 139 + /*! 140 + * @function DADiskGetBSDName 141 + * @abstract Obtains the BSD device name for the specified disk. 142 + * @param disk The DADisk for which to obtain the BSD device name. 143 + * @result The disk's BSD device name. 144 + * @discussion 145 + * The BSD device name can be used with opendev() to open the BSD device. 146 + */ 147 + 148 + extern const char * __nullable DADiskGetBSDName( DADiskRef disk ); 149 + 150 + /*! 151 + * @function DADiskCopyIOMedia 152 + * @abstract Obtains the I/O Kit media object for the specified disk. 153 + * @param disk The DADisk for which to obtain the I/O Kit media object. 154 + * @result The disk's I/O Kit media object. 155 + * @discussion 156 + * The caller of this function receives a reference to the returned object. The 157 + * caller also implicitly retains the object and is responsible for releasing it 158 + * with IOObjectRelease(). 159 + */ 160 + 161 + extern io_service_t DADiskCopyIOMedia( DADiskRef disk ); 162 + 163 + /*! 164 + * @function DADiskCopyDescription 165 + * @abstract Obtains the Disk Arbitration description of the specified disk. 166 + * @param disk The DADisk for which to obtain the Disk Arbitration description. 167 + * @result The disk's Disk Arbitration description. 168 + * @discussion 169 + * This function will contact Disk Arbitration to acquire the latest description 170 + * of the specified disk, unless this function is called on a disk object passed 171 + * within the context of a registered callback, in which case the description is 172 + * current as of that callback event. 173 + * 174 + * The caller of this function receives a reference to the returned object. The 175 + * caller also implicitly retains the object and is responsible for releasing it 176 + * with CFRelease(). 177 + */ 178 + 179 + extern CFDictionaryRef __nullable DADiskCopyDescription( DADiskRef disk ); 180 + 181 + /*! 182 + * @function DADiskCopyWholeDisk 183 + * @abstract Obtain the associated whole disk object for the specified disk. 184 + * @param disk The disk object. 185 + * @result The disk's associated whole disk object. 186 + * @discussion 187 + * The caller of this function receives a reference to the returned object. The 188 + * caller also implicitly retains the object and is responsible for releasing it 189 + * with CFRelease(). 190 + */ 191 + 192 + extern DADiskRef __nullable DADiskCopyWholeDisk( DADiskRef disk ); 193 + 194 + #endif /* !__DISKARBITRATIOND__ */ 195 + 196 + CF_IMPLICIT_BRIDGING_DISABLED 197 + CF_ASSUME_NONNULL_END 198 + 199 + #ifdef __cplusplus 200 + } 201 + #endif /* __cplusplus */ 202 + 203 + #endif /* !__DISKARBITRATION_DADISK__ */
+110
src/DiskArbitration/include/DiskArbitration/DADissenter.h
··· 1 + /* 2 + * Copyright (c) 1998-2015 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. Please obtain a copy of the License at 10 + * http://www.opensource.apple.com/apsl/ and read it before using this 11 + * file. 12 + * 13 + * The Original Code and all software distributed under the License are 14 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 + * Please see the License for the specific language governing rights and 19 + * limitations under the License. 20 + * 21 + * @APPLE_LICENSE_HEADER_END@ 22 + */ 23 + 24 + #ifndef __DISKARBITRATION_DADISSENTER__ 25 + #define __DISKARBITRATION_DADISSENTER__ 26 + 27 + #include <mach/error.h> 28 + #include <CoreFoundation/CoreFoundation.h> 29 + 30 + #ifdef __cplusplus 31 + extern "C" { 32 + #endif /* __cplusplus */ 33 + 34 + CF_ASSUME_NONNULL_BEGIN 35 + CF_IMPLICIT_BRIDGING_ENABLED 36 + 37 + #define err_local_diskarbitration err_sub( 0x368 ) 38 + 39 + /*! 40 + * @enum DAReturn 41 + * @abstract A return code. 42 + */ 43 + 44 + enum 45 + { 46 + kDAReturnSuccess = 0, 47 + kDAReturnError = err_local | err_local_diskarbitration | 0x01, /* ( 0xF8DA0001 ) */ 48 + kDAReturnBusy = err_local | err_local_diskarbitration | 0x02, /* ( 0xF8DA0002 ) */ 49 + kDAReturnBadArgument = err_local | err_local_diskarbitration | 0x03, /* ( 0xF8DA0003 ) */ 50 + kDAReturnExclusiveAccess = err_local | err_local_diskarbitration | 0x04, /* ( 0xF8DA0004 ) */ 51 + kDAReturnNoResources = err_local | err_local_diskarbitration | 0x05, /* ( 0xF8DA0005 ) */ 52 + kDAReturnNotFound = err_local | err_local_diskarbitration | 0x06, /* ( 0xF8DA0006 ) */ 53 + kDAReturnNotMounted = err_local | err_local_diskarbitration | 0x07, /* ( 0xF8DA0007 ) */ 54 + kDAReturnNotPermitted = err_local | err_local_diskarbitration | 0x08, /* ( 0xF8DA0008 ) */ 55 + kDAReturnNotPrivileged = err_local | err_local_diskarbitration | 0x09, /* ( 0xF8DA0009 ) */ 56 + kDAReturnNotReady = err_local | err_local_diskarbitration | 0x0A, /* ( 0xF8DA000A ) */ 57 + kDAReturnNotWritable = err_local | err_local_diskarbitration | 0x0B, /* ( 0xF8DA000B ) */ 58 + kDAReturnUnsupported = err_local | err_local_diskarbitration | 0x0C /* ( 0xF8DA000C ) */ 59 + }; 60 + 61 + typedef mach_error_t DAReturn; 62 + 63 + #ifndef __DISKARBITRATIOND__ 64 + 65 + /*! 66 + * @typedef DADissenterRef 67 + * Type of a reference to DADissenter instances. 68 + */ 69 + 70 + typedef const struct CF_BRIDGED_TYPE( id ) __DADissenter * DADissenterRef; 71 + 72 + /*! 73 + * @function DADissenterCreate 74 + * @abstract Creates a new dissenter object. 75 + * @param allocator The allocator object to be used to allocate memory. 76 + * @param status The return code. 77 + * @param string The return code string. Pass NULL for no reason. 78 + * @result A reference to a new DADissenter. 79 + */ 80 + 81 + extern DADissenterRef DADissenterCreate( CFAllocatorRef __nullable allocator, DAReturn status, CFStringRef __nullable string ); 82 + 83 + /*! 84 + * @function DADissenterGetStatus 85 + * @abstract Obtains the return code. 86 + * @param dissenter The DADissenter for which to obtain the return code. 87 + * @result The return code. A BSD return code, if applicable, is encoded with unix_err(). 88 + */ 89 + 90 + extern DAReturn DADissenterGetStatus( DADissenterRef dissenter ); 91 + 92 + /*! 93 + * @function DADissenterGetStatusString 94 + * @abstract Obtains the return code string. 95 + * @param dissenter The DADissenter for which to obtain the return code string. 96 + * @result The return code string. 97 + */ 98 + 99 + extern CFStringRef __nullable DADissenterGetStatusString( DADissenterRef dissenter ); 100 + 101 + #endif /* !__DISKARBITRATIOND__ */ 102 + 103 + CF_IMPLICIT_BRIDGING_DISABLED 104 + CF_ASSUME_NONNULL_END 105 + 106 + #ifdef __cplusplus 107 + } 108 + #endif /* __cplusplus */ 109 + 110 + #endif /* !__DISKARBITRATION_DADISSENTER__ */
+146
src/DiskArbitration/include/DiskArbitration/DASession.h
··· 1 + /* 2 + * Copyright (c) 1998-2015 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. Please obtain a copy of the License at 10 + * http://www.opensource.apple.com/apsl/ and read it before using this 11 + * file. 12 + * 13 + * The Original Code and all software distributed under the License are 14 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 + * Please see the License for the specific language governing rights and 19 + * limitations under the License. 20 + * 21 + * @APPLE_LICENSE_HEADER_END@ 22 + */ 23 + 24 + #ifndef __DISKARBITRATION_DASESSION__ 25 + #define __DISKARBITRATION_DASESSION__ 26 + 27 + #include <CoreFoundation/CoreFoundation.h> 28 + 29 + #ifdef __cplusplus 30 + extern "C" { 31 + #endif /* __cplusplus */ 32 + 33 + CF_ASSUME_NONNULL_BEGIN 34 + CF_IMPLICIT_BRIDGING_ENABLED 35 + 36 + #ifndef __DISKARBITRATIOND__ 37 + 38 + /*! 39 + * @typedef DASessionRef 40 + * Type of a reference to DASession instances. 41 + */ 42 + 43 + typedef struct CF_BRIDGED_TYPE( id ) __DASession * DASessionRef; 44 + 45 + /*! 46 + * @function DASessionGetTypeID 47 + * @abstract Returns the type identifier of all DASession instances. 48 + */ 49 + 50 + extern CFTypeID DASessionGetTypeID( void ); 51 + 52 + /*! 53 + * @function DASessionCreate 54 + * @abstract Creates a new session. 55 + * @result A reference to a new DASession. 56 + * @discussion 57 + * The caller of this function receives a reference to the returned object. The 58 + * caller also implicitly retains the object and is responsible for releasing it. 59 + */ 60 + 61 + extern DASessionRef __nullable DASessionCreate( CFAllocatorRef __nullable allocator ); 62 + 63 + /*! 64 + * @function DASessionScheduleWithRunLoop 65 + * @abstract Schedules the session on a run loop. 66 + * @param session The session which is being scheduled. 67 + * @param runLoop The run loop on which the session should be scheduled. 68 + * @param runLoopMode The run loop mode in which the session should be scheduled. 69 + */ 70 + 71 + extern void DASessionScheduleWithRunLoop( DASessionRef session, CFRunLoopRef runLoop, CFStringRef runLoopMode ); 72 + 73 + /*! 74 + * @function DASessionUnscheduleFromRunLoop 75 + * @abstract Unschedules the session from a run loop. 76 + * @param session The session which is being unscheduled. 77 + * @param runLoop The run loop on which the session is scheduled. 78 + * @param runLoopMode The run loop mode in which the session is scheduled. 79 + */ 80 + 81 + extern void DASessionUnscheduleFromRunLoop( DASessionRef session, CFRunLoopRef runLoop, CFStringRef runLoopMode ); 82 + 83 + /*! 84 + * @function DASessionSetDispatchQueue 85 + * @abstract Schedules the session on a dispatch queue. 86 + * @param session The session which is being scheduled. 87 + * @param queue The dispatch queue on which the session should be scheduled. Pass NULL to unschedule. 88 + */ 89 + 90 + extern void DASessionSetDispatchQueue( DASessionRef session, dispatch_queue_t __nullable queue ); 91 + 92 + /* 93 + * @typedef DAApprovalSessionRef 94 + * Type of a reference to DAApprovalSession instances. 95 + */ 96 + 97 + typedef struct CF_BRIDGED_TYPE( id ) __DASession * DAApprovalSessionRef CF_SWIFT_UNAVAILABLE( "Use DASessionRef instead" ); 98 + 99 + /* 100 + * @function DAApprovalSessionGetTypeID 101 + * @abstract Returns the type identifier of all DAApprovalSession instances. 102 + */ 103 + 104 + extern CFTypeID DAApprovalSessionGetTypeID( void ) CF_SWIFT_UNAVAILABLE( "Use DASessionGetTypeID instead" ); 105 + 106 + /* 107 + * @function DAApprovalSessionCreate 108 + * @abstract Creates a new approval session. 109 + * @result A reference to a new DAApprovalSession. 110 + * @discussion 111 + * The caller of this function receives a reference to the returned object. The 112 + * caller also implicitly retains the object and is responsible for releasing it. 113 + */ 114 + 115 + extern DAApprovalSessionRef __nullable DAApprovalSessionCreate( CFAllocatorRef __nullable allocator ) CF_SWIFT_UNAVAILABLE( "Use DASessionCreate instead" ); 116 + 117 + /* 118 + * @function DAApprovalSessionScheduleWithRunLoop 119 + * @abstract Schedules the approval session on a run loop. 120 + * @param session The approval session which is being scheduled. 121 + * @param runLoop The run loop on which the approval session should be scheduled. 122 + * @param runLoopMode The run loop mode in which the approval session should be scheduled. 123 + */ 124 + 125 + extern void DAApprovalSessionScheduleWithRunLoop( DAApprovalSessionRef session, CFRunLoopRef runLoop, CFStringRef runLoopMode ) CF_SWIFT_UNAVAILABLE( "Use DASessionSetDispatchQueue instead" ); 126 + 127 + /* 128 + * @function DAApprovalSessionUnscheduleFromRunLoop 129 + * @abstract Unschedules the approval session from a run loop. 130 + * @param session The approval session which is being unscheduled. 131 + * @param runLoop The run loop on which the approval session is scheduled. 132 + * @param runLoopMode The run loop mode in which the approval session is scheduled. 133 + */ 134 + 135 + extern void DAApprovalSessionUnscheduleFromRunLoop( DAApprovalSessionRef session, CFRunLoopRef runLoop, CFStringRef runLoopMode ) CF_SWIFT_UNAVAILABLE( "Use DASessionSetDispatchQueue instead" ); 136 + 137 + #endif /* !__DISKARBITRATIOND__ */ 138 + 139 + CF_IMPLICIT_BRIDGING_DISABLED 140 + CF_ASSUME_NONNULL_END 141 + 142 + #ifdef __cplusplus 143 + } 144 + #endif /* __cplusplus */ 145 + 146 + #endif /* !__DISKARBITRATION_DASESSION__ */
+578
src/DiskArbitration/include/DiskArbitration/DiskArbitration.h
··· 1 + /* 2 + * Copyright (c) 1998-2015 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. Please obtain a copy of the License at 10 + * http://www.opensource.apple.com/apsl/ and read it before using this 11 + * file. 12 + * 13 + * The Original Code and all software distributed under the License are 14 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 + * Please see the License for the specific language governing rights and 19 + * limitations under the License. 20 + * 21 + * @APPLE_LICENSE_HEADER_END@ 22 + */ 23 + 24 + #ifndef __DISKARBITRATION_DISKARBITRATION__ 25 + #define __DISKARBITRATION_DISKARBITRATION__ 26 + 27 + #include <CoreFoundation/CoreFoundation.h> 28 + 29 + #include <DiskArbitration/DADisk.h> 30 + #include <DiskArbitration/DADissenter.h> 31 + #include <DiskArbitration/DASession.h> 32 + 33 + #ifdef __cplusplus 34 + extern "C" { 35 + #endif /* __cplusplus */ 36 + 37 + CF_ASSUME_NONNULL_BEGIN 38 + CF_IMPLICIT_BRIDGING_ENABLED 39 + 40 + /*! 41 + * @enum DADiskMountOptions 42 + * @abstract Options for DADiskMount(). 43 + * @constant kDADiskMountOptionWhole Mount the volumes tied to the whole disk object. 44 + */ 45 + 46 + enum 47 + { 48 + kDADiskMountOptionDefault = 0x00000000, 49 + kDADiskMountOptionWhole = 0x00000001 50 + }; 51 + 52 + typedef UInt32 DADiskMountOptions; 53 + 54 + /*! 55 + * @enum DADiskRenameOptions 56 + * @abstract Options for DADiskRename(). 57 + */ 58 + 59 + enum 60 + { 61 + kDADiskRenameOptionDefault = 0x00000000 62 + }; 63 + 64 + typedef UInt32 DADiskRenameOptions; 65 + 66 + /*! 67 + * @enum DADiskUnmountOptions 68 + * @abstract Options for DADiskUnmount(). 69 + * @constant kDADiskUnmountOptionForce Unmount the volume even if files are still active. 70 + * @constant kDADiskUnmountOptionWhole Unmount the volumes tied to the whole disk object. 71 + */ 72 + 73 + enum 74 + { 75 + kDADiskUnmountOptionDefault = 0x00000000, 76 + kDADiskUnmountOptionForce = 0x00080000, 77 + kDADiskUnmountOptionWhole = 0x00000001 78 + }; 79 + 80 + typedef UInt32 DADiskUnmountOptions; 81 + 82 + /*! 83 + * @enum DADiskEjectOptions 84 + * @abstract Options for DADiskEject(). 85 + */ 86 + 87 + enum 88 + { 89 + kDADiskEjectOptionDefault = 0x00000000 90 + }; 91 + 92 + typedef UInt32 DADiskEjectOptions; 93 + 94 + /*! 95 + * @enum DADiskClaimOptions 96 + * @abstract Options for DADiskClaim(). 97 + */ 98 + 99 + enum 100 + { 101 + kDADiskClaimOptionDefault = 0x00000000 102 + }; 103 + 104 + typedef UInt32 DADiskClaimOptions; 105 + 106 + /*! 107 + * @enum DADiskOptions 108 + * @abstract Options for DADiskGetOptions() and DADiskSetOptions(). 109 + */ 110 + 111 + enum 112 + { 113 + kDADiskOptionDefault = 0x00000000 114 + }; 115 + 116 + typedef UInt32 DADiskOptions; 117 + 118 + /*! 119 + * @constant kDADiskDescriptionMatchMediaUnformatted 120 + * Predefined CFDictionary object containing a set of disk description keys and values 121 + * appropriate for matching unformatted media using DARegister*Callback(). 122 + */ 123 + 124 + extern CFDictionaryRef kDADiskDescriptionMatchMediaUnformatted; 125 + 126 + /*! 127 + * @constant kDADiskDescriptionMatchMediaWhole 128 + * Predefined CFDictionary object containing a set of disk description keys and values 129 + * appropriate for matching whole media using DARegister*Callback(). 130 + */ 131 + 132 + extern CFDictionaryRef kDADiskDescriptionMatchMediaWhole; 133 + 134 + /*! 135 + * @constant kDADiskDescriptionMatchVolumeMountable 136 + * Predefined CFDictionary object containing a set of disk description keys and values 137 + * appropriate for matching mountable volumes using DARegister*Callback(). 138 + */ 139 + 140 + extern CFDictionaryRef kDADiskDescriptionMatchVolumeMountable; 141 + 142 + /*! 143 + * @constant kDADiskDescriptionMatchVolumeUnrecognized 144 + * Predefined CFDictionary object containing a set of disk description keys and values 145 + * appropriate for matching unrecognized volumes using DARegister*Callback(). 146 + */ 147 + 148 + extern CFDictionaryRef kDADiskDescriptionMatchVolumeUnrecognized; 149 + 150 + /*! 151 + * @constant kDADiskDescriptionWatchVolumeName 152 + * Predefined CFArray object containing a set of disk description keys appropriate for 153 + * watching volume name changes using DARegisterDiskDescriptionChangedCallback(). 154 + */ 155 + 156 + extern CFArrayRef kDADiskDescriptionWatchVolumeName; 157 + 158 + /*! 159 + * @constant kDADiskDescriptionWatchVolumePath 160 + * Predefined CFArray object containing a set of disk description keys appropriate for 161 + * watching volume mount changes using DARegisterDiskDescriptionChangedCallback(). 162 + */ 163 + 164 + extern CFArrayRef kDADiskDescriptionWatchVolumePath; 165 + 166 + #ifndef __DISKARBITRATIOND__ 167 + 168 + /*! 169 + * @typedef DADiskAppearedCallback 170 + * @abstract Type of the callback function used by DARegisterDiskAppearedCallback(). 171 + * @param disk A disk object. 172 + * @param context The user-defined context parameter given to the registration function. 173 + */ 174 + 175 + typedef void ( *DADiskAppearedCallback )( DADiskRef disk, void * __nullable context ); 176 + 177 + /*! 178 + * @function DARegisterDiskAppearedCallback 179 + * @abstract Registers a callback function to be called whenever a disk has appeared. 180 + * @param session The session object. 181 + * @param match The disk description keys to match. Pass NULL for all disk objects. 182 + * @param callback The callback function to call when a disk has appeared. 183 + * @param context The user-defined context parameter to pass to the callback function. 184 + */ 185 + 186 + extern void DARegisterDiskAppearedCallback( DASessionRef session, 187 + CFDictionaryRef __nullable match, 188 + DADiskAppearedCallback callback, 189 + void * __nullable context ); 190 + 191 + /*! 192 + * @typedef DADiskDescriptionChangedCallback 193 + * @abstract Type of the callback function used by DARegisterDiskDescriptionChangedCallback(). 194 + * @param disk A disk object. 195 + * @param keys A list of changed keys. 196 + * @param context The user-defined context parameter given to the registration function. 197 + */ 198 + 199 + typedef void ( *DADiskDescriptionChangedCallback )( DADiskRef disk, CFArrayRef keys, void * __nullable context ); 200 + 201 + /*! 202 + * @function DARegisterDiskDescriptionChangedCallback 203 + * @abstract Registers a callback function to be called whenever a disk description has changed. 204 + * @param session The session object. 205 + * @param match The disk description keys to match. Pass NULL for all disk objects. 206 + * @param watch The disk description keys to watch. Pass NULL for all keys. 207 + * @param callback The callback function to call when a watched key changes. 208 + * @param context The user-defined context parameter to pass to the callback function. 209 + */ 210 + 211 + extern void DARegisterDiskDescriptionChangedCallback( DASessionRef session, 212 + CFDictionaryRef __nullable match, 213 + CFArrayRef __nullable watch, 214 + DADiskDescriptionChangedCallback callback, 215 + void * __nullable context ); 216 + 217 + /*! 218 + * @typedef DADiskDisappearedCallback 219 + * @abstract Type of the callback function used by DARegisterDiskDisappearedCallback(). 220 + * @param disk A disk object. 221 + * @param context The user-defined context parameter given to the registration function. 222 + */ 223 + 224 + typedef void ( *DADiskDisappearedCallback )( DADiskRef disk, void * __nullable context ); 225 + 226 + /*! 227 + * @function DARegisterDiskDisappearedCallback 228 + * @abstract Registers a callback function to be called whenever a disk has disappeared. 229 + * @param session The session object. 230 + * @param match The disk description keys to match. Pass NULL for all disk objects. 231 + * @param callback The callback function to call when a disk has disappeared. 232 + * @param context The user-defined context parameter to pass to the callback function. 233 + */ 234 + 235 + extern void DARegisterDiskDisappearedCallback( DASessionRef session, 236 + CFDictionaryRef __nullable match, 237 + DADiskDisappearedCallback callback, 238 + void * __nullable context ); 239 + 240 + /*! 241 + * @typedef DADiskMountCallback 242 + * @abstract Type of the callback function used by DADiskMount(). 243 + * @param disk The disk object. 244 + * @param dissenter A dissenter object on failure or NULL on success. 245 + * @param context The user-defined context parameter given to the mount function. 246 + */ 247 + 248 + typedef void ( *DADiskMountCallback )( DADiskRef disk, DADissenterRef __nullable dissenter, void * __nullable context ); 249 + 250 + /*! 251 + * @function DADiskMount 252 + * @abstract Mounts the volume at the specified disk object. 253 + * @param disk The disk object. 254 + * @param path The mount path. Pass NULL for a "standard" mount path. 255 + * @param options The mount options. 256 + * @param callback The callback function to call once the mount completes. 257 + * @param context The user-defined context parameter to pass to the callback function. 258 + */ 259 + 260 + extern void DADiskMount( DADiskRef disk, 261 + CFURLRef __nullable path, 262 + DADiskMountOptions options, 263 + DADiskMountCallback __nullable callback, 264 + void * __nullable context ); 265 + 266 + /*! 267 + * @function DADiskMountWithArguments 268 + * @abstract Mounts the volume at the specified disk object, with the specified mount options. 269 + * @param disk The disk object. 270 + * @param path The mount path. Pass NULL for a "standard" mount path. 271 + * @param options The mount options. 272 + * @param callback The callback function to call once the mount completes. 273 + * @param context The user-defined context parameter to pass to the callback function. 274 + * @param arguments The null-terminated list of mount options to pass to /sbin/mount -o. 275 + */ 276 + 277 + extern void DADiskMountWithArguments( DADiskRef disk, 278 + CFURLRef __nullable path, 279 + DADiskMountOptions options, 280 + DADiskMountCallback __nullable callback, 281 + void * __nullable context, 282 + CFStringRef arguments[] ); 283 + 284 + /*! 285 + * @typedef DADiskMountApprovalCallback 286 + * @abstract Type of the callback function used by DARegisterDiskMountApprovalCallback(). 287 + * @param disk A disk object. 288 + * @param context The user-defined context parameter given to the registration function. 289 + * @result A dissenter reference. Pass NULL to approve. 290 + * @discussion 291 + * The caller of this callback receives a reference to the returned object. The 292 + * caller also implicitly retains the object and is responsible for releasing it 293 + * with CFRelease(). 294 + */ 295 + 296 + typedef DADissenterRef __nullable ( *DADiskMountApprovalCallback )( DADiskRef disk, void * __nullable context ); 297 + 298 + /*! 299 + * @function DARegisterDiskMountApprovalCallback 300 + * @abstract Registers a callback function to be called whenever a volume is to be mounted. 301 + * @param session The session object. 302 + * @param match The disk description keys to match. Pass NULL for all disk objects. 303 + * @param callback The callback function to call when a volume is to be mounted. 304 + * @param context The user-defined context parameter to pass to the callback function. 305 + */ 306 + 307 + extern void DARegisterDiskMountApprovalCallback( DASessionRef session, 308 + CFDictionaryRef __nullable match, 309 + DADiskMountApprovalCallback callback, 310 + void * __nullable context ); 311 + 312 + /*! 313 + * @typedef DADiskRenameCallback 314 + * @abstract Type of the callback function used by DADiskRename(). 315 + * @param disk The disk object. 316 + * @param dissenter A dissenter object on failure or NULL on success. 317 + * @param context The user-defined context parameter given to the rename function. 318 + */ 319 + 320 + typedef void ( *DADiskRenameCallback )( DADiskRef disk, DADissenterRef __nullable dissenter, void * __nullable context ); 321 + 322 + /*! 323 + * @function DADiskRename 324 + * @abstract Renames the volume at the specified disk object. 325 + * @param disk The disk object. 326 + * @param options The rename options. 327 + * @param callback The callback function to call once the rename completes. 328 + * @param context The user-defined context parameter to pass to the callback function. 329 + */ 330 + 331 + extern void DADiskRename( DADiskRef disk, 332 + CFStringRef name, 333 + DADiskRenameOptions options, 334 + DADiskRenameCallback __nullable callback, 335 + void * __nullable context ); 336 + 337 + /*! 338 + * @typedef DADiskUnmountCallback 339 + * @abstract Type of the callback function used by DADiskUnmount(). 340 + * @param disk The disk object. 341 + * @param dissenter A dissenter object on failure or NULL on success. 342 + * @param context The user-defined context parameter given to the unmount function. 343 + */ 344 + 345 + typedef void ( *DADiskUnmountCallback )( DADiskRef disk, DADissenterRef __nullable dissenter, void * __nullable context ); 346 + 347 + /*! 348 + * @function DADiskUnmount 349 + * @abstract Unmounts the volume at the specified disk object. 350 + * @param disk The disk object. 351 + * @param options The unmount options. 352 + * @param callback The callback function to call once the unmount completes. 353 + * @param context The user-defined context parameter to pass to the callback function. 354 + */ 355 + 356 + extern void DADiskUnmount( DADiskRef disk, 357 + DADiskUnmountOptions options, 358 + DADiskUnmountCallback __nullable callback, 359 + void * __nullable context ); 360 + 361 + /*! 362 + * @typedef DADiskUnmountApprovalCallback 363 + * @abstract Type of the callback function used by DARegisterDiskUnmountApprovalCallback(). 364 + * @param disk A disk object. 365 + * @param context The user-defined context parameter given to the registration function. 366 + * @result A dissenter reference. Pass NULL to approve. 367 + * @discussion 368 + * The caller of this callback receives a reference to the returned object. The 369 + * caller also implicitly retains the object and is responsible for releasing it 370 + * with CFRelease(). 371 + */ 372 + 373 + typedef DADissenterRef __nullable ( *DADiskUnmountApprovalCallback )( DADiskRef disk, void * __nullable context ); 374 + 375 + /*! 376 + * @function DARegisterDiskUnmountApprovalCallback 377 + * @abstract Registers a callback function to be called whenever a volume is to be unmounted. 378 + * @param session The session object. 379 + * @param match The disk description keys to match. Pass NULL for all disk objects. 380 + * @param callback The callback function to call when a volume is to be unmounted. 381 + * @param context The user-defined context parameter to pass to the callback function. 382 + */ 383 + 384 + extern void DARegisterDiskUnmountApprovalCallback( DASessionRef session, 385 + CFDictionaryRef __nullable match, 386 + DADiskUnmountApprovalCallback callback, 387 + void * __nullable context ); 388 + 389 + /*! 390 + * @typedef DADiskEjectCallback 391 + * @abstract Type of the callback function used by DADiskEject(). 392 + * @param disk The disk object. 393 + * @param dissenter A dissenter object on failure or NULL on success. 394 + * @param context The user-defined context parameter given to the eject function. 395 + */ 396 + 397 + typedef void ( *DADiskEjectCallback )( DADiskRef disk, DADissenterRef __nullable dissenter, void * __nullable context ); 398 + 399 + /*! 400 + * @function DADiskEject 401 + * @abstract Ejects the specified disk object. 402 + * @param disk The disk object. 403 + * @param options The eject options. 404 + * @param callback The callback function to call once the ejection completes. 405 + * @param context The user-defined context parameter to pass to the callback function. 406 + */ 407 + 408 + extern void DADiskEject( DADiskRef disk, 409 + DADiskEjectOptions options, 410 + DADiskEjectCallback __nullable callback, 411 + void * __nullable context ); 412 + 413 + /*! 414 + * @typedef DADiskEjectApprovalCallback 415 + * @abstract Type of the callback function used by DARegisterDiskEjectApprovalCallback(). 416 + * @param disk A disk object. 417 + * @param context The user-defined context parameter given to the registration function. 418 + * @result A dissenter reference. Pass NULL to approve. 419 + * @discussion 420 + * The caller of this callback receives a reference to the returned object. The 421 + * caller also implicitly retains the object and is responsible for releasing it 422 + * with CFRelease(). 423 + */ 424 + 425 + typedef DADissenterRef __nullable ( *DADiskEjectApprovalCallback )( DADiskRef disk, void * __nullable context ); 426 + 427 + /*! 428 + * @function DARegisterDiskEjectApprovalCallback 429 + * @abstract Registers a callback function to be called whenever a volume is to be ejected. 430 + * @param session The session object. 431 + * @param match The disk description keys to match. Pass NULL for all disk objects. 432 + * @param callback The callback function to call when a volume is to be ejected. 433 + * @param context The user-defined context parameter to pass to the callback function. 434 + */ 435 + 436 + extern void DARegisterDiskEjectApprovalCallback( DASessionRef session, 437 + CFDictionaryRef __nullable match, 438 + DADiskEjectApprovalCallback callback, 439 + void * __nullable context ); 440 + 441 + /*! 442 + * @typedef DADiskClaimCallback 443 + * @abstract Type of the callback function used by DADiskClaim(). 444 + * @param disk The disk object. 445 + * @param dissenter A dissenter object on failure or NULL on success. 446 + * @param context The user-defined context parameter given to the claim function. 447 + */ 448 + 449 + typedef void ( *DADiskClaimCallback )( DADiskRef disk, DADissenterRef __nullable dissenter, void * __nullable context ); 450 + 451 + /*! 452 + * @typedef DADiskClaimReleaseCallback 453 + * @abstract Type of the callback function used by DADiskClaim(). 454 + * @param disk The disk object. 455 + * @param context The user-defined context parameter given to the claim function. 456 + * @result A dissenter reference. Pass NULL to release claim. 457 + * @discussion 458 + * The caller of this callback receives a reference to the returned object. The 459 + * caller also implicitly retains the object and is responsible for releasing it 460 + * with CFRelease(). 461 + */ 462 + 463 + typedef DADissenterRef __nullable ( *DADiskClaimReleaseCallback )( DADiskRef disk, void * __nullable context ); 464 + 465 + /*! 466 + * @function DADiskClaim 467 + * @abstract Claims the specified disk object for exclusive use. 468 + * @param disk The disk object. 469 + * @param options The claim options. 470 + * @param release The callback function to call when the claim is to be released. 471 + * @param releaseContext The user-defined context parameter to pass to the callback function. 472 + * @param callback The callback function to call once the claim completes. 473 + * @param callbackContext The user-defined context parameter to pass to the callback function. 474 + */ 475 + 476 + extern void DADiskClaim( DADiskRef disk, 477 + DADiskClaimOptions options, 478 + DADiskClaimReleaseCallback __nullable release, 479 + void * __nullable releaseContext, 480 + DADiskClaimCallback __nullable callback, 481 + void * __nullable callbackContext ); 482 + 483 + /*! 484 + * @function DADiskIsClaimed 485 + * @abstract Reports whether or not the disk is claimed. 486 + * @param disk The disk object. 487 + * @result TRUE if the disk is claimed, otherwise FALSE. 488 + */ 489 + 490 + extern Boolean DADiskIsClaimed( DADiskRef disk ); 491 + 492 + /*! 493 + * @function DADiskUnclaim 494 + * @abstract Unclaims the specified disk object. 495 + * @param disk The disk object. 496 + */ 497 + 498 + extern void DADiskUnclaim( DADiskRef disk ); 499 + 500 + /*! 501 + * @typedef DADiskPeekCallback 502 + * @abstract Type of the callback function used by DARegisterDiskPeekCallback(). 503 + * @param disk A disk object. 504 + * @param context The user-defined context parameter given to the registration function. 505 + * @discussion 506 + * The peek callback functions are called in a specific order, from lowest order to highest 507 + * order. DADiskClaim() could be used here to claim the disk object and DADiskSetOptions() 508 + * could be used here to set up options on the disk object. 509 + */ 510 + 511 + typedef void ( *DADiskPeekCallback )( DADiskRef disk, void * __nullable context ); 512 + 513 + /*! 514 + * @function DARegisterDiskPeekCallback 515 + * @abstract Registers a callback function to be called whenever a disk has been probed. 516 + * @param session The session object. 517 + * @param match The disk description keys to match. Pass NULL for all disk objects. 518 + * @param order The callback order, from lowest to highest. Pass 0 for the default. 519 + * @param callback The callback function to call when a disk has been probed. 520 + * @param context The user-defined context parameter to pass to the callback function. 521 + */ 522 + 523 + extern void DARegisterDiskPeekCallback( DASessionRef session, 524 + CFDictionaryRef __nullable match, 525 + CFIndex order, 526 + DADiskPeekCallback callback, 527 + void * __nullable context ); 528 + 529 + /*! 530 + * @function DADiskGetOptions 531 + * @abstract Obtains the options for the specified disk. 532 + * @param disk The disk object for which to obtain the options. 533 + * @result The options. 534 + */ 535 + 536 + extern DADiskOptions DADiskGetOptions( DADiskRef disk ); 537 + 538 + /*! 539 + * @function DADiskSetOptions 540 + * @abstract Sets the options for the specified disk. 541 + * @param disk The disk object for which to set the options. 542 + * @param options The options to set or clear. 543 + * @param value Pass TRUE to set options; otherwise pass FALSE to clear options. 544 + * @result A result code. 545 + */ 546 + 547 + extern DAReturn DADiskSetOptions( DADiskRef disk, DADiskOptions options, Boolean value ); 548 + 549 + /*! 550 + * @function DAUnregisterCallback 551 + * @abstract Unregisters a registered callback function. 552 + * @param session The session object. 553 + * @param callback The registered callback function. 554 + * @param context The user-defined context parameter. 555 + */ 556 + 557 + extern void DAUnregisterCallback( DASessionRef session, void * callback, void * __nullable context ); 558 + 559 + /* 560 + * @function DAUnregisterApprovalCallback 561 + * @abstract Unregisters a registered callback function. 562 + * @param session The session object. 563 + * @param callback The registered callback function. 564 + * @param context The user-defined context parameter. 565 + */ 566 + 567 + extern void DAUnregisterApprovalCallback( DASessionRef session, void * callback, void * __nullable context ) CF_SWIFT_UNAVAILABLE( "Use DAUnregisterCallback instead" ); 568 + 569 + #endif /* !__DISKARBITRATIOND__ */ 570 + 571 + CF_IMPLICIT_BRIDGING_DISABLED 572 + CF_ASSUME_NONNULL_END 573 + 574 + #ifdef __cplusplus 575 + } 576 + #endif /* __cplusplus */ 577 + 578 + #endif /* !__DISKARBITRATION_DISKARBITRATION__ */
src/darling-config.h.in src/include/darling-config.h.in
+1
src/libc/include/get_compat.h
··· 1 + ../gen/get_compat.h
+1
src/libunwind/include/System
··· 1 + ../System/
+8
src/quarantine/include/quarantine.h
··· 27 27 #define QTN_FLAG_SANDBOX 1 28 28 #define QTN_FLAG_HARD 2 29 29 30 + #define QTN_FLAG_USER_APPROVED 0x01 << 0 31 + #define QTN_FLAG_TRANSLOCATE 0x01 << 1 32 + #define QTN_FLAG_DO_NOT_TRANSLOCATE 0x01 << 2 33 + 30 34 typedef struct _qtn_file_s *qtn_file_t; 31 35 32 36 extern qtn_file_t _qtn_file_alloc(); ··· 59 63 void qtn_proc_set_flags(qtn_proc_t proc, unsigned int flags); 60 64 void qtn_proc_apply_to_self(qtn_proc_t proc); 61 65 void qtn_proc_free(qtn_proc_t proc); 66 + 67 + extern int qtn_file_init_with_mount_point(qtn_file_t a, char b[1024]); 68 + 69 + extern int qtn_file_apply_to_mount_point(qtn_file_t a, const char *b); 62 70 63 71 #define QTN_SERIALIZED_DATA_MAX 4096 64 72