diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/devices/deviceManagerFactory.cpp | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/devices/deviceManagerFactory.cpp')
-rw-r--r-- | Src/devices/deviceManagerFactory.cpp | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/Src/devices/deviceManagerFactory.cpp b/Src/devices/deviceManagerFactory.cpp new file mode 100644 index 00000000..8ee804cd --- /dev/null +++ b/Src/devices/deviceManagerFactory.cpp @@ -0,0 +1,100 @@ +#include "main.h" +#include "./deviceManager.h" +#include "./deviceManagerFactory.h" + +DeviceManagerFactory::DeviceManagerFactory() + : object(NULL) +{ +} + +DeviceManagerFactory::~DeviceManagerFactory() +{ + if (NULL != object) + object->Release(); +} + +FOURCC DeviceManagerFactory::GetServiceType() +{ + return WaSvc::UNIQUE; +} + +const char *DeviceManagerFactory::GetServiceName() +{ + return "Device Manager Interface"; +} + +GUID DeviceManagerFactory::GetGUID() +{ + return DeviceManagerGUID; +} + +void *DeviceManagerFactory::GetInterface(int global_lock) +{ + if (NULL == object) + { + if (FAILED(DeviceManager::CreateInstance(&object))) + object = NULL; + + if (NULL == object) + return NULL; + } + + object->AddRef(); + return object; +} + +int DeviceManagerFactory::SupportNonLockingInterface() +{ + return 1; +} + +int DeviceManagerFactory::ReleaseInterface(void *ifc) +{ + DeviceManager *object = (DeviceManager*)ifc; + if (NULL != object) + object->Release(); + + return 1; +} + +const char *DeviceManagerFactory::GetTestString() +{ + return NULL; +} + +int DeviceManagerFactory::ServiceNotify(int msg, int param1, int param2) +{ + return 1; +} + +HRESULT DeviceManagerFactory::Register(api_service *service) +{ + if (NULL == service) + return E_INVALIDARG; + + service->service_register(this); + return S_OK; +} + +HRESULT DeviceManagerFactory::Unregister(api_service *service) +{ + if (NULL == service) + return E_INVALIDARG; + + service->service_deregister(this); + return S_OK; +} + +#define CBCLASS DeviceManagerFactory +START_DISPATCH; +CB( WASERVICEFACTORY_GETSERVICETYPE, GetServiceType ) +CB( WASERVICEFACTORY_GETSERVICENAME, GetServiceName ) +CB( WASERVICEFACTORY_GETGUID, GetGUID ) +CB( WASERVICEFACTORY_GETINTERFACE, GetInterface ) +CB( WASERVICEFACTORY_SUPPORTNONLOCKINGGETINTERFACE, SupportNonLockingInterface ) +CB( WASERVICEFACTORY_RELEASEINTERFACE, ReleaseInterface ) +CB( WASERVICEFACTORY_GETTESTSTRING, GetTestString ) +CB( WASERVICEFACTORY_SERVICENOTIFY, ServiceNotify ) +END_DISPATCH; + +#undef CBCLASS
\ No newline at end of file |