api.cpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "main.h"
  2. #include "api.h"
  3. #include <windows.h>
  4. #include "../Winamp/wa_ipc.h"
  5. #include "FactoryHelper.h"
  6. #include "MetaTagFactory.h"
  7. #include "factory_Handler.h"
  8. #include "AlbumArt.h"
  9. #include "RawReader.h"
  10. #include "../nu/Singleton.h"
  11. MetaTagFactory metaTagFactory;
  12. api_service *serviceManager = 0;
  13. api_playlistmanager *playlistManager=0;
  14. api_config *AGAVE_API_CONFIG=0;
  15. api_application *applicationApi=0;
  16. // wasabi based services for localisation support
  17. api_language *WASABI_API_LNG = 0;
  18. HINSTANCE WASABI_API_LNG_HINST = 0, WASABI_API_ORIG_HINST = 0;
  19. api_memmgr *WASABI_API_MEMMGR = 0;
  20. WPLHandlerFactory wplHandlerFactory;
  21. ASXHandlerFactory asxHandlerFactory;
  22. AlbumArtFactory albumArtFactory;
  23. static RawMediaReaderService raw_media_reader_service;
  24. static SingletonServiceFactory<svc_raw_media_reader, RawMediaReaderService> raw_factory;
  25. int LoadWasabi()
  26. {
  27. ServiceBuild(AGAVE_API_CONFIG, AgaveConfigGUID);
  28. ServiceBuild(playlistManager, api_playlistmanagerGUID);
  29. ServiceBuild(WASABI_API_APP, applicationApiServiceGuid);
  30. ServiceBuild(WASABI_API_LNG, languageApiGUID);
  31. ServiceBuild(WASABI_API_MEMMGR, memMgrApiServiceGuid);
  32. plugin.service->service_register(&metaTagFactory);
  33. plugin.service->service_register(&wplHandlerFactory);
  34. plugin.service->service_register(&asxHandlerFactory);
  35. plugin.service->service_register(&albumArtFactory);
  36. raw_factory.Register(plugin.service, &raw_media_reader_service);
  37. return TRUE;
  38. }
  39. void UnloadWasabi()
  40. {
  41. plugin.service->service_deregister(&metaTagFactory);
  42. plugin.service->service_deregister(&wplHandlerFactory);
  43. plugin.service->service_deregister(&asxHandlerFactory);
  44. plugin.service->service_deregister(&albumArtFactory);
  45. plugin.service->service_deregister(&raw_factory);
  46. ServiceRelease(playlistManager, api_playlistmanagerGUID);
  47. ServiceRelease(AGAVE_API_CONFIG, AgaveConfigGUID);
  48. ServiceRelease(WASABI_API_APP, applicationApiServiceGuid);
  49. ServiceRelease(WASABI_API_LNG, languageApiGUID);
  50. ServiceRelease(WASABI_API_MEMMGR, memMgrApiServiceGuid);
  51. }