15#include <CoreAudio/AudioServerPlugIn.h>
76 explicit Driver(std::shared_ptr<Context> context = {},
77 std::shared_ptr<Plugin> plugin = {},
78 std::shared_ptr<Storage> storage = {});
127 const AudioServerPlugInClientInfo* clientInfo,
128 AudioObjectID* outDeviceObjectID);
136 static HRESULT QueryInterface(
void* driverRef, REFIID iid, LPVOID* outInterface);
138 static ULONG AddRef(
void* driverRef);
139 static ULONG Release(
void* driverRef);
142 static OSStatus InitializeJumper(AudioServerPlugInDriverRef driverRef,
143 AudioServerPlugInHostRef hostRef);
145 static OSStatus CreateDeviceJumper(AudioServerPlugInDriverRef driverRef,
146 CFDictionaryRef description,
147 const AudioServerPlugInClientInfo* clientInfo,
148 AudioObjectID* outDeviceObjectID);
150 static OSStatus DestroyDeviceJumper(AudioServerPlugInDriverRef driverRef,
151 AudioObjectID objectID);
153 const std::shared_ptr<Context> context_;
154 const std::shared_ptr<Plugin> plugin_;
155 const std::shared_ptr<Storage> storage_;
163 AudioServerPlugInDriverInterface driverInterface_;
164 AudioServerPlugInDriverInterface* driverInterfacePointer_;
167 std::atomic<ULONG> refCounter_ = 0;
Handler for HAL requests to driver.
Plugin persistent storage.
Doubly-buffered value with non-blocking read and blocking write.
virtual OSStatus DestroyDevice(AudioObjectID objectID)
Destroy device. Default implementation returns kAudioHardwareUnsupportedOperationError.
virtual OSStatus CreateDevice(CFDictionaryRef description, const AudioServerPlugInClientInfo *clientInfo, AudioObjectID *outDeviceObjectID)
Create device. Default implementation returns kAudioHardwareUnsupportedOperationError.
virtual OSStatus Initialize()
Initialize driver. Default implementation invokes DriverRequestHandler::OnInitialize().
Driver(std::shared_ptr< Context > context={}, std::shared_ptr< Plugin > plugin={}, std::shared_ptr< Storage > storage={})
Construct driver. If context, plugin, or storage is not set, it is created automatically.
void SetDriverHandler(std::shared_ptr< DriverRequestHandler > handler)
Set handler for HAL requests to driver. Optional. Use when you need to do custom handling.
std::shared_ptr< Plugin > GetPlugin() const
Get plugin. Plugin is the root of driver's object tree.
AudioServerPlugInDriverRef GetReference()
Get driver reference. This is what should be returned from plugin entry point.
void SetDriverHandler(DriverRequestHandler *handler)
Set handler for HAL requests to driver (raw pointer overload). This overload uses raw pointer instead...
std::shared_ptr< const Context > GetContext() const
Get context. Context contains data shared among all driver objects.
std::shared_ptr< Storage > GetStorage() const
Get storage. Storage provides API for persistent key-value database.
static Driver * GetDriver(AudioServerPlugInDriverRef driverRef)
Cast driver reference back to driver.
const AudioServerPlugInDriverInterface & GetPluginInterface() const
Get plugin interface. Plugin interface is a table with function pointers which implement various plug...
Handler for HAL requests to driver.