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/theora/main.cpp | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/theora/main.cpp')
-rw-r--r-- | Src/theora/main.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/Src/theora/main.cpp b/Src/theora/main.cpp new file mode 100644 index 00000000..9fb00b65 --- /dev/null +++ b/Src/theora/main.cpp @@ -0,0 +1,79 @@ +#define WIN32_LEAN_AND_MEAN +#include "api.h" +#include <bfc/platform/export.h> +#include "../Agave/Component/ifc_wa5component.h" +#include "../nu/Singleton.h" +//#include "ogg_theora_decoder.h" +#include "mkv_theora_decoder.h" + +api_service *WASABI_API_SVC=0; +class TheoraComponent : public ifc_wa5component +{ +public: + void RegisterServices(api_service *service); + int RegisterServicesSafeModeOk(); + void DeregisterServices(api_service *service); +protected: + RECVS_DISPATCH; +}; + +template <class api_T> +void ServiceBuild(api_T *&api_t, GUID factoryGUID_t) +{ + if (WASABI_API_SVC) + { + waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid(factoryGUID_t); + if (factory) + api_t = reinterpret_cast<api_T *>( factory->getInterface() ); + } +} + +template <class api_T> +void ServiceRelease(api_T *api_t, GUID factoryGUID_t) +{ + if (WASABI_API_SVC && api_t) + { + waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid(factoryGUID_t); + if (factory) + factory->releaseInterface(api_t); + } + api_t = NULL; +} + +//OggDecoderFactory ogg_decoder; +//static SingletonServiceFactory<svc_oggdecoder, OggDecoderFactory> ogg_factory; + +MKVDecoder mkv_decoder; +static SingletonServiceFactory<svc_mkvdecoder, MKVDecoder> mkv_factory; + +void TheoraComponent::RegisterServices(api_service *service) +{ + WASABI_API_SVC = service; + //ogg_factory.Register(WASABI_API_SVC, &ogg_decoder); + mkv_factory.Register(WASABI_API_SVC, &mkv_decoder); +} + +int TheoraComponent::RegisterServicesSafeModeOk() +{ + return 1; +} + +void TheoraComponent::DeregisterServices(api_service *service) +{ + //ogg_factory.Deregister(WASABI_API_SVC); + mkv_factory.Deregister(WASABI_API_SVC); +} + +static TheoraComponent component; +extern "C" DLLEXPORT ifc_wa5component *GetWinamp5SystemComponent() +{ + return &component; +} + +#define CBCLASS TheoraComponent +START_DISPATCH; +VCB(API_WA5COMPONENT_REGISTERSERVICES, RegisterServices) +CB(15, RegisterServicesSafeModeOk) +VCB(API_WA5COMPONENT_DEREEGISTERSERVICES, DeregisterServices) +END_DISPATCH; +#undef CBCLASS |