api__in_mkv.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "api__in_mkv.h"
  2. #include "main.h"
  3. #include <api/service/waservicefactory.h>
  4. api_config *AGAVE_API_CONFIG = 0;
  5. api_language *WASABI_API_LNG = 0;
  6. HINSTANCE WASABI_API_LNG_HINST = 0, WASABI_API_ORIG_HINST = 0;
  7. template <class api_T>
  8. void ServiceBuild(api_T *&api_t, GUID factoryGUID_t)
  9. {
  10. if (plugin.service)
  11. {
  12. waServiceFactory *factory = plugin.service->service_getServiceByGuid(factoryGUID_t);
  13. if (factory)
  14. api_t = reinterpret_cast<api_T *>( factory->getInterface() );
  15. }
  16. }
  17. template <class api_T>
  18. void ServiceRelease(api_T *api_t, GUID factoryGUID_t)
  19. {
  20. if (plugin.service && api_t)
  21. {
  22. waServiceFactory *factory = plugin.service->service_getServiceByGuid(factoryGUID_t);
  23. if (factory)
  24. factory->releaseInterface(api_t);
  25. }
  26. api_t = NULL;
  27. }
  28. void WasabiInit()
  29. {
  30. ServiceBuild(AGAVE_API_CONFIG, AgaveConfigGUID);
  31. ServiceBuild(WASABI_API_LNG, languageApiGUID);
  32. // need to have this initialised before we try to do anything with localisation features
  33. WASABI_API_START_LANG(plugin.hDllInstance,InMkvLangGUID);
  34. }
  35. void WasabiQuit()
  36. {
  37. ServiceRelease(AGAVE_API_CONFIG, AgaveConfigGUID);
  38. ServiceRelease(WASABI_API_LNG, languageApiGUID);
  39. }