main.cpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #include "api.h"
  2. #include "../nu/Singleton.h"
  3. #include "../nu/factoryt.h"
  4. #include "AVIAACDecoder.h"
  5. #include "FLVAACDecoder.h"
  6. #include "MKVAACDecoder.h"
  7. #include "MP4AACDecoder.h"
  8. #include "ADTSAACDecoder.h"
  9. #include "NSVAACDecoder.h"
  10. #include <bfc/platform/export.h>
  11. #include "../Agave/Component/ifc_wa5component.h"
  12. #include "../nu/ServiceBuilder.h"
  13. class AACDecoderComponent : public ifc_wa5component
  14. {
  15. public:
  16. void RegisterServices(api_service *service);
  17. int RegisterServicesSafeModeOk();
  18. void DeregisterServices(api_service *service);
  19. protected:
  20. RECVS_DISPATCH;
  21. };
  22. static SingletonServiceFactory<svc_avidecoder, AVIDecoder> avi_factory;
  23. static AVIDecoder avi_decoder;
  24. static SingletonServiceFactory<svc_mkvdecoder, MKVDecoder> mkv_factory;
  25. static MKVDecoder mkv_decoder;
  26. static SingletonServiceFactory<svc_flvdecoder, FLVDecoder> flv_factory;
  27. static FLVDecoder flv_decoder;
  28. static ServiceFactoryT<MP4AudioDecoder, MP4AACDecoder> mp4_factory;
  29. static ServiceFactoryT<adts, ADTSAACDecoder> adts_factory;
  30. static NSVDecoder nsv_decoder;
  31. static SingletonServiceFactory<svc_nsvFactory, NSVDecoder> nsv_factory;
  32. void AACDecoderComponent::RegisterServices(api_service *service)
  33. {
  34. WASABI_API_SVC = service;
  35. avi_factory.Register(WASABI_API_SVC, &avi_decoder);
  36. mkv_factory.Register(WASABI_API_SVC, &mkv_decoder);
  37. flv_factory.Register(WASABI_API_SVC, &flv_decoder);
  38. nsv_factory.Register(WASABI_API_SVC, &nsv_decoder);
  39. mp4_factory.Register(WASABI_API_SVC);
  40. adts_factory.Register(WASABI_API_SVC);
  41. ServiceBuild(WASABI_API_SVC, AGAVE_API_CONFIG, AgaveConfigGUID);
  42. ServiceBuild(WASABI_API_SVC, WASABI_API_MEMMGR, memMgrApiServiceGuid);
  43. }
  44. void AACDecoderComponent::DeregisterServices(api_service *service)
  45. {
  46. avi_factory.Deregister(WASABI_API_SVC);
  47. mkv_factory.Deregister(WASABI_API_SVC);
  48. mp4_factory.Deregister(WASABI_API_SVC);
  49. flv_factory.Deregister(WASABI_API_SVC);
  50. nsv_factory.Deregister(WASABI_API_SVC);
  51. adts_factory.Deregister(WASABI_API_SVC);
  52. ServiceRelease(WASABI_API_SVC, AGAVE_API_CONFIG, AgaveConfigGUID);
  53. ServiceRelease(WASABI_API_SVC, WASABI_API_MEMMGR, memMgrApiServiceGuid);
  54. }
  55. int AACDecoderComponent::RegisterServicesSafeModeOk()
  56. {
  57. return 1;
  58. }
  59. AACDecoderComponent aac_decoder_component;
  60. extern "C" DLLEXPORT ifc_wa5component *GetWinamp5SystemComponent()
  61. {
  62. return &aac_decoder_component;
  63. }
  64. #define CBCLASS AACDecoderComponent
  65. START_DISPATCH;
  66. VCB(API_WA5COMPONENT_REGISTERSERVICES, RegisterServices)
  67. CB(15, RegisterServicesSafeModeOk)
  68. VCB(API_WA5COMPONENT_DEREEGISTERSERVICES, DeregisterServices)
  69. END_DISPATCH;
  70. #undef CBCLASS