SimpleHandlerFactory.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "SimpleHandlerFactory.h"
  2. #include "SimpleHandler.h"
  3. /*
  4. This is the GUID for our service factory
  5. don't re-use this.
  6. make your own guid with guidgen.exe
  7. lives somewhere like C:\Program Files\Microsoft Visual Studio\2019\Professional\Common7\Tools
  8. */
  9. // {1CCF6445-A452-45e8-BE72-846991CBCAF6}
  10. static const GUID SimpleHandlerGUID =
  11. { 0x1ccf6445, 0xa452, 0x45e8, { 0xbe, 0x72, 0x84, 0x69, 0x91, 0xcb, 0xca, 0xf6 } };
  12. // our playlist handler.
  13. static Cef_Handler simpleHandler;
  14. FOURCC SimpleHandlerFactory::GetServiceType()
  15. {
  16. return svc_playlisthandler::getServiceType();
  17. }
  18. const char *SimpleHandlerFactory::GetServiceName()
  19. {
  20. return "Simple Playlist Loader";
  21. }
  22. GUID SimpleHandlerFactory::GetGuid()
  23. {
  24. return SimpleHandlerGUID;
  25. }
  26. void *SimpleHandlerFactory::GetInterface(int global_lock)
  27. {
  28. // simpleHandler is a singleton object, so we can just return a pointer to it
  29. // depending on what kind of service you are making, you might have to
  30. // 'new' an object and return that instead (and then free it in ReleaseInterface)
  31. return &simpleHandler;
  32. }
  33. int SimpleHandlerFactory::ReleaseInterface(void *ifc)
  34. {
  35. // no-op because we returned a singleton (see above)
  36. return 1;
  37. }
  38. // Define the dispatch table
  39. #define CBCLASS SimpleHandlerFactory
  40. START_DISPATCH;
  41. CB(WASERVICEFACTORY_GETSERVICETYPE, GetServiceType)
  42. CB(WASERVICEFACTORY_GETSERVICENAME, GetServiceName)
  43. CB(WASERVICEFACTORY_GETGUID, GetGuid)
  44. CB(WASERVICEFACTORY_GETINTERFACE, GetInterface)
  45. CB(WASERVICEFACTORY_RELEASEINTERFACE, ReleaseInterface)
  46. END_DISPATCH;
  47. #undef CBCLASS