1
0

WasabiMetadata.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #include "WasabiMetadata.h"
  2. #include <shlwapi.h>
  3. #include "../nu/AutoChar.h"
  4. const wchar_t *MP3StreamMetadata::GetName()
  5. {
  6. return L"MP3 Stream Metadata";
  7. }
  8. GUID MP3StreamMetadata::getGUID()
  9. {
  10. return MP3StreamMetadataGUID;
  11. }
  12. int MP3StreamMetadata::getFlags()
  13. {
  14. return METATAG_FILE_INFO;
  15. }
  16. int MP3StreamMetadata::isOurFile(const wchar_t *filename)
  17. {
  18. if (PathIsURL(filename) && !_wcsicmp(PathFindExtension(filename), L".mp3"))
  19. return 1;
  20. else
  21. return 0;
  22. }
  23. int MP3StreamMetadata::metaTag_open(const wchar_t *filename)
  24. {
  25. if (metadata.Open(filename) == METADATA_SUCCESS)
  26. return METATAG_SUCCESS;
  27. else
  28. return METATAG_FAILED;
  29. }
  30. void MP3StreamMetadata::metaTag_close()
  31. {
  32. delete this;
  33. }
  34. int MP3StreamMetadata::getMetaData(const wchar_t *tag, __int8 *buf, int buflenBytes, int datatype)
  35. {
  36. if (datatype == METATYPE_STRING)
  37. {
  38. if (metadata.GetExtendedData(AutoChar(tag), (wchar_t *)buf, buflenBytes/sizeof(wchar_t)))
  39. return METATAG_SUCCESS;
  40. else
  41. return METATAG_UNKNOWN_TAG;
  42. }
  43. else
  44. return METATAG_FAILED;
  45. }
  46. #define CBCLASS MP3StreamMetadata
  47. START_DISPATCH;
  48. CB(SVC_METATAG_GETNAME,getName)
  49. CB(SVC_METATAG_GETGUID,getGUID)
  50. CB(SVC_METATAG_GETFLAGS,getFlags)
  51. CB(SVC_METATAG_ISOURFILE,isOurFile)
  52. CB(SVC_METATAG_OPEN,metaTag_open)
  53. VCB(SVC_METATAG_CLOSE,metaTag_close)
  54. //CB(SVC_METATAG_ENUMTAGS,enumSupportedTag)
  55. //CB(SVC_METATAG_GETTAGSIZE,getTagSize)
  56. CB(SVC_METATAG_GETMETADATA,getMetaData)
  57. //CB(SVC_METATAG_SETMETADATA,setMetaData)
  58. END_DISPATCH;
  59. #undef CBCLASS