api_gracenote.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #ifndef NULLSOFT_GRACENOTE_API_GRACENOTE_H
  2. #define NULLSOFT_GRACENOTE_API_GRACENOTE_H
  3. /* benski>
  4. * This API is facilitate initialization of Gracenote objects
  5. * as well as a few common functions
  6. *
  7. * It is _NOT_ meant to be a wrapper around the Gracenote API
  8. * It simply ensure that all plugins create objects with the same
  9. * configuration, which improves code maintainability and reduces
  10. * compiled file sizes.
  11. */
  12. #include <bfc/dispatch.h>
  13. #include "gracenote.h"
  14. class api_decodefile;
  15. class api_gracenote : public Dispatchable
  16. {
  17. protected:
  18. api_gracenote() {}
  19. ~api_gracenote() {}
  20. public:
  21. /* These return Gracenote COM objects. Since COM handles referencing counting,
  22. * you can simply call their Release() method when you are done.
  23. */
  24. ICDDBControl2 *GetCDDB();
  25. ICDDBMusicIDManager3 *GetMusicID(); // makes a new instance, always
  26. //ICddbPlaylist25Mgr *GetPlaylistManager(); // makes a new instance, always
  27. //int GetPlaylistManagerWithMLDBManager(ICddbPlaylist25Mgr **playlistMgr, ICddbMLDBManager **mldbMgr); // makes a new instance, always
  28. int GetPlaylistManager(ICddbPlaylist25Mgr **playlistMgr, ICddbMLDBManager **mldbMgr); // makes a new instance, always
  29. ICddbMLDBManager *GetMLDBManager();
  30. void ReleasePlaylistManager();
  31. /* Some utility functions */
  32. HRESULT CreateFingerprint(ICDDBMusicIDManager *musicID, api_decodefile *decodeApi, ICddbFileInfo *info, const wchar_t *filename, long *killswitch);
  33. DISPATCH_CODES
  34. {
  35. API_GRACENOTE_GETCDDB = 10,
  36. API_GRACENOTE_GETMUSICID=20,
  37. //API_GRACENOTE_GETPLAYLISTMGR=30, // Older codes can be removed
  38. //API_GRACENOTE_GETPLAYLISTMGRWITHMLDBMGR=40, // ""
  39. API_GRACENOTE_GETPLAYLISTMGR=40,
  40. API_GRACENOTE_GETMLDBMGR=50,
  41. API_GRACENOTE_CREATEFINGERPRINT=1000,
  42. };
  43. };
  44. inline ICDDBControl2 *api_gracenote::GetCDDB()
  45. {
  46. return _call(API_GRACENOTE_GETCDDB, (ICDDBControl2 *)0);
  47. }
  48. inline ICDDBMusicIDManager3 *api_gracenote::GetMusicID()
  49. {
  50. return _call(API_GRACENOTE_GETMUSICID, (ICDDBMusicIDManager3 *)0);
  51. }
  52. /*inline ICddbPlaylist25Mgr *api_gracenote::GetPlaylistManager()
  53. {
  54. return _call(API_GRACENOTE_GETPLAYLISTMGR, (ICddbPlaylist25Mgr *)0);
  55. }
  56. inline int api_gracenote::GetPlaylistManagerWithMLDBManager(ICddbPlaylist25Mgr **playlistMgr, ICddbMLDBManager **mldbMgr)
  57. {
  58. return _call(API_GRACENOTE_GETPLAYLISTMGRWITHMLDBMGR, 0, playlistMgr, mldbMgr);
  59. }*/
  60. inline int api_gracenote::GetPlaylistManager(ICddbPlaylist25Mgr **playlistMgr, ICddbMLDBManager **mldbMgr)
  61. {
  62. return _call(API_GRACENOTE_GETPLAYLISTMGR, 0, playlistMgr, mldbMgr);
  63. }
  64. inline ICddbMLDBManager *api_gracenote::GetMLDBManager()
  65. {
  66. return _call(API_GRACENOTE_GETMLDBMGR, (ICddbMLDBManager *)0);
  67. }
  68. inline HRESULT api_gracenote::CreateFingerprint(ICDDBMusicIDManager *musicID, api_decodefile *decodeApi, ICddbFileInfo *info, const wchar_t *filename, long *killswitch)
  69. {
  70. return _call(API_GRACENOTE_CREATEFINGERPRINT, E_FAIL, musicID, decodeApi, info, filename, killswitch);
  71. }
  72. // {877D90AB-FAC1-4366-B3B0-EB177F42CFCE}
  73. static const GUID gracenoteApiGUID =
  74. { 0x877d90ab, 0xfac1, 0x4366, { 0xb3, 0xb0, 0xeb, 0x17, 0x7f, 0x42, 0xcf, 0xce } };
  75. #endif