wa5_png.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include "api__png.h"
  2. #include "wa5_png.h"
  3. #include "factory_png.h"
  4. #include "factory_pngwrite.h"
  5. #include <bfc/platform/export.h>
  6. WA5_PNG wa5_png;
  7. PNGFactory pngFactory;
  8. PNGWriteFactory pngWriteFactory;
  9. api_service *serviceManager=0;
  10. api_memmgr *memoryManager=0;
  11. void WA5_PNG::RegisterServices(api_service *service)
  12. {
  13. WASABI_API_SVC = service;
  14. // get memory manager
  15. waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(memMgrApiServiceGuid);
  16. if (sf) memoryManager = reinterpret_cast<api_memmgr *>(sf->getInterface());
  17. WASABI_API_SVC->service_register(&pngFactory);
  18. WASABI_API_SVC->service_register(&pngWriteFactory);
  19. }
  20. int WA5_PNG::RegisterServicesSafeModeOk()
  21. {
  22. return 1;
  23. }
  24. void WA5_PNG::DeregisterServices(api_service *service)
  25. {
  26. service->service_deregister(&pngWriteFactory);
  27. service->service_deregister(&pngFactory);
  28. waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(memMgrApiServiceGuid);
  29. if (sf) sf->releaseInterface(memoryManager);
  30. }
  31. extern "C" DLLEXPORT ifc_wa5component *GetWinamp5SystemComponent()
  32. {
  33. return &wa5_png;
  34. }
  35. #ifdef CBCLASS
  36. #undef CBCLASS
  37. #endif
  38. #define CBCLASS WA5_PNG
  39. START_DISPATCH;
  40. VCB(API_WA5COMPONENT_REGISTERSERVICES, RegisterServices)
  41. CB(15, RegisterServicesSafeModeOk)
  42. VCB(API_WA5COMPONENT_DEREEGISTERSERVICES, DeregisterServices)
  43. END_DISPATCH;