1
0

main.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #include "api__filereader.h"
  2. #include "WA5_FileReader.h"
  3. #ifdef _WIN32
  4. #include "ResourceReaderFactory.h"
  5. #endif
  6. #include "HTTPReaderFactory.h"
  7. #include <bfc/platform/export.h>
  8. #ifdef _WIN32
  9. ResourceReaderFactory resourceReaderFactory;
  10. #endif
  11. HTTPReaderFactory httpReaderFactory;
  12. WA5_FileReader wa5_FileReader;
  13. api_service *WASABI_API_SVC=0;
  14. api_application *WASABI_API_APP=0;
  15. api_config *AGAVE_API_CONFIG=0;
  16. void WA5_FileReader::RegisterServices(api_service *service)
  17. {
  18. WASABI_API_SVC = service;
  19. waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(applicationApiServiceGuid);
  20. if (sf)
  21. WASABI_API_APP = (api_application *)sf->getInterface();
  22. sf = WASABI_API_SVC->service_getServiceByGuid(AgaveConfigGUID);
  23. if (sf)
  24. AGAVE_API_CONFIG = (api_config *)sf->getInterface();
  25. if (WASABI_API_APP && AGAVE_API_CONFIG)
  26. WASABI_API_SVC->service_register(&httpReaderFactory);
  27. #ifdef _WIN32
  28. WASABI_API_SVC->service_register(&resourceReaderFactory);
  29. #endif
  30. }
  31. int WA5_FileReader::RegisterServicesSafeModeOk()
  32. {
  33. return 1;
  34. }
  35. void WA5_FileReader::DeregisterServices(api_service *service)
  36. {
  37. if (WASABI_API_APP && AGAVE_API_CONFIG)
  38. service->service_deregister(&httpReaderFactory);
  39. #ifdef _WIN32
  40. service->service_deregister(&resourceReaderFactory);
  41. #endif
  42. waServiceFactory *sf=0;
  43. if (WASABI_API_APP)
  44. {
  45. sf = WASABI_API_SVC->service_getServiceByGuid(applicationApiServiceGuid);
  46. if (sf)
  47. sf->releaseInterface(WASABI_API_APP);
  48. }
  49. if (AGAVE_API_CONFIG)
  50. {
  51. sf = WASABI_API_SVC->service_getServiceByGuid(AgaveConfigGUID);
  52. if (sf)
  53. sf->releaseInterface(AGAVE_API_CONFIG);
  54. }
  55. }
  56. extern "C" DLLEXPORT ifc_wa5component *GetWinamp5SystemComponent()
  57. {
  58. return &wa5_FileReader;
  59. }
  60. #define CBCLASS WA5_FileReader
  61. START_DISPATCH;
  62. VCB(API_WA5COMPONENT_REGISTERSERVICES, RegisterServices)
  63. CB(15, RegisterServicesSafeModeOk)
  64. VCB(API_WA5COMPONENT_DEREEGISTERSERVICES, DeregisterServices)
  65. END_DISPATCH;
  66. #undef CBCLASS