1
0

factory_Handler.cpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #include "api__playlist.h"
  2. #include "factory_Handler.h"
  3. #include "handler.h"
  4. #include "api/service/services.h"
  5. M3UHandler m3uHandler;
  6. PLSHandler plsHandler;
  7. B4SHandler b4sHandler;
  8. static const char m3uServiceName[] = "M3U Playlist Handler";
  9. static const char plsServiceName[] = "PLS Playlist Handler";
  10. #define DEFINE_HANDLER_FACTORY(CLASSNAME, className) const char *CLASSNAME ## HandlerFactory::GetServiceName() { return #CLASSNAME ## "Playlist Handler"; }\
  11. GUID CLASSNAME ## HandlerFactory::GetGUID(){ return className ## HandlerGUID;}\
  12. void *CLASSNAME ## HandlerFactory::GetInterface(int global_lock){ return &className ## Handler;}
  13. DEFINE_HANDLER_FACTORY(M3U, m3u);
  14. DEFINE_HANDLER_FACTORY(PLS, pls);
  15. DEFINE_HANDLER_FACTORY(B4S, b4s);
  16. /* --------------------------------------------------------------------- */
  17. FOURCC CommonHandlerFactory::GetServiceType()
  18. {
  19. return WaSvc::PLAYLISTHANDLER;
  20. }
  21. int CommonHandlerFactory::SupportNonLockingInterface()
  22. {
  23. return 1;
  24. }
  25. int CommonHandlerFactory::ReleaseInterface(void *ifc)
  26. {
  27. return 1;
  28. }
  29. const char *CommonHandlerFactory::GetTestString()
  30. {
  31. return NULL;
  32. }
  33. int CommonHandlerFactory::ServiceNotify(int msg, int param1, int param2)
  34. {
  35. return 1;
  36. }
  37. #ifdef CBCLASS
  38. #undef CBCLASS
  39. #endif
  40. #define CBCLASS M3UHandlerFactory
  41. START_DISPATCH;
  42. CB(WASERVICEFACTORY_GETSERVICENAME, GetServiceName)
  43. CB(WASERVICEFACTORY_GETGUID, GetGUID)
  44. CB(WASERVICEFACTORY_GETINTERFACE, GetInterface)
  45. #undef CBCLASS
  46. #define CBCLASS CommonHandlerFactory
  47. CB(WASERVICEFACTORY_GETSERVICETYPE, GetServiceType)
  48. CB(WASERVICEFACTORY_SUPPORTNONLOCKINGGETINTERFACE, SupportNonLockingInterface)
  49. CB(WASERVICEFACTORY_RELEASEINTERFACE, ReleaseInterface)
  50. CB(WASERVICEFACTORY_GETTESTSTRING, GetTestString)
  51. CB(WASERVICEFACTORY_SERVICENOTIFY, ServiceNotify)
  52. END_DISPATCH;
  53. #undef CBCLASS
  54. #define CBCLASS PLSHandlerFactory
  55. START_DISPATCH;
  56. CB(WASERVICEFACTORY_GETSERVICENAME, GetServiceName)
  57. CB(WASERVICEFACTORY_GETGUID, GetGUID)
  58. CB(WASERVICEFACTORY_GETINTERFACE, GetInterface)
  59. #undef CBCLASS
  60. #define CBCLASS CommonHandlerFactory
  61. CB(WASERVICEFACTORY_GETSERVICETYPE, GetServiceType)
  62. CB(WASERVICEFACTORY_SUPPORTNONLOCKINGGETINTERFACE, SupportNonLockingInterface)
  63. CB(WASERVICEFACTORY_RELEASEINTERFACE, ReleaseInterface)
  64. CB(WASERVICEFACTORY_GETTESTSTRING, GetTestString)
  65. CB(WASERVICEFACTORY_SERVICENOTIFY, ServiceNotify)
  66. END_DISPATCH;
  67. #undef CBCLASS
  68. #define CBCLASS B4SHandlerFactory
  69. START_DISPATCH;
  70. CB(WASERVICEFACTORY_GETSERVICENAME, GetServiceName)
  71. CB(WASERVICEFACTORY_GETGUID, GetGUID)
  72. CB(WASERVICEFACTORY_GETINTERFACE, GetInterface)
  73. #undef CBCLASS
  74. #define CBCLASS CommonHandlerFactory
  75. CB(WASERVICEFACTORY_GETSERVICETYPE, GetServiceType)
  76. CB(WASERVICEFACTORY_SUPPORTNONLOCKINGGETINTERFACE, SupportNonLockingInterface)
  77. CB(WASERVICEFACTORY_RELEASEINTERFACE, ReleaseInterface)
  78. CB(WASERVICEFACTORY_GETTESTSTRING, GetTestString)
  79. CB(WASERVICEFACTORY_SERVICENOTIFY, ServiceNotify)
  80. END_DISPATCH;