wa5_gif.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #include "api__gif.h"
  2. #include "wa5_gif.h"
  3. #include <bfc/platform/export.h>
  4. #include "MyFactory.h"
  5. #include "GIFLoader.h"
  6. #include "GIFWriter.h"
  7. WA5_GIF wa5_gif;
  8. // {1ED6714D-2478-45dd-A803-A193EE20B75D}
  9. static const GUID gifWriterGUID =
  10. { 0x1ed6714d, 0x2478, 0x45dd, { 0xa8, 0x3, 0xa1, 0x93, 0xee, 0x20, 0xb7, 0x5d } };
  11. // {4D724110-1E35-406f-8976-C1E9873E0C15}
  12. static const GUID gifLoaderGUID =
  13. { 0x4d724110, 0x1e35, 0x406f, { 0x89, 0x76, 0xc1, 0xe9, 0x87, 0x3e, 0xc, 0x15 } };
  14. MyFactory<GIFWriter, svc_imageWriter> gifWriteFactory(gifWriterGUID);
  15. MyFactory<GIFLoader, svc_imageLoader> gifLoadFactory(gifLoaderGUID);
  16. api_service *serviceManager=0;
  17. api_memmgr *memoryManager=0;
  18. void WA5_GIF::RegisterServices(api_service *service)
  19. {
  20. WASABI_API_SVC = service;
  21. // get memory manager
  22. waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(memMgrApiServiceGuid);
  23. if (sf) memoryManager = reinterpret_cast<api_memmgr *>(sf->getInterface());
  24. WASABI_API_SVC->service_register(&gifLoadFactory);
  25. WASABI_API_SVC->service_register(&gifWriteFactory);
  26. }
  27. int WA5_GIF::RegisterServicesSafeModeOk()
  28. {
  29. return 1;
  30. }
  31. void WA5_GIF::DeregisterServices(api_service *service)
  32. {
  33. service->service_deregister(&gifWriteFactory);
  34. service->service_deregister(&gifLoadFactory);
  35. waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(memMgrApiServiceGuid);
  36. if (sf) sf->releaseInterface(memoryManager);
  37. }
  38. extern "C" DLLEXPORT ifc_wa5component *GetWinamp5SystemComponent()
  39. {
  40. return &wa5_gif;
  41. }
  42. #define CBCLASS WA5_GIF
  43. START_DISPATCH;
  44. VCB(API_WA5COMPONENT_REGISTERSERVICES, RegisterServices)
  45. CB(15, RegisterServicesSafeModeOk)
  46. VCB(API_WA5COMPONENT_DEREEGISTERSERVICES, DeregisterServices)
  47. END_DISPATCH;
  48. #undef CBCLASS