1
0

WMInformation.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #ifndef NULLSOFT_WMINFORMATIONH
  2. #define NULLSOFT_WMINFORMATIONH
  3. #include <wmsdk.h>
  4. #include "WMCallback.h"
  5. class WMInformation : public WMHandler
  6. {
  7. public:
  8. WMInformation(const wchar_t *fileName, bool noBlock=false);
  9. WMInformation(IWMReader *reader);
  10. //WMInformation(IWMSyncReader *reader);
  11. WMInformation(IWMMetadataEditor *_editor);
  12. //WMInformation();
  13. bool ErrorOpening()
  14. {
  15. return openError;
  16. } // TODO: benski> this is only valid for WMInformation(const wchar_t *fileName, bool noBlock=false)!!!
  17. virtual ~WMInformation();
  18. bool MakeWritable(const wchar_t *fileName);
  19. bool NonWritable();
  20. bool MakeReadOnly(const wchar_t *fileName);
  21. bool Flush();
  22. bool IsSeekable();
  23. long GetLengthMilliseconds();
  24. long GetBitrate();
  25. WORD GetNumberAttributes();
  26. void ClearAllAttributes();
  27. bool IsAttribute(const wchar_t attrName[]); // false might mean "attribute not found", see IsNotAttribute
  28. bool IsNotAttribute(const wchar_t attrName[]); // false might mean "attribute not found", see IsAttribute
  29. void GetAttribute(WORD index, wchar_t *attrName, size_t attrLen, wchar_t *valueStr, size_t valueStrLen);
  30. void GetAttribute(const wchar_t attrName[], wchar_t *valueStr, size_t len);
  31. void SetAttribute(const wchar_t *attrName, wchar_t *value, WMT_ATTR_DATATYPE defaultType = WMT_TYPE_STRING);
  32. void DeleteAttribute(const wchar_t *attrName);
  33. bool GetAttributeSize(const wchar_t *attrName, size_t &size);
  34. void LicenseRequired()
  35. {
  36. First().OpenFailed();
  37. }
  38. void SetAttribute_BinString(const wchar_t *attrName, wchar_t *value);
  39. void GetAttribute_BinString(const wchar_t attrName[], wchar_t *valueStr, size_t len);
  40. void DeleteUserText(const wchar_t *description);
  41. void SetUserText(const wchar_t *description, const wchar_t *valueStr);
  42. bool GetCodecName(wchar_t *storage, size_t len);
  43. bool GetPicture(void **data, size_t *len, wchar_t **mimeType, int type);
  44. bool SetPicture(void *data, size_t len, const wchar_t *mimeType, int type);
  45. bool DeletePicture(int type);
  46. bool HasPicture(int type);
  47. private:
  48. bool GetDataType(const wchar_t *name, WMT_ATTR_DATATYPE &type);
  49. long GetLongAttr(const wchar_t name[]);
  50. bool GetBoolAttr(const wchar_t name[]);
  51. DWORD GetDWORDAttr(const wchar_t name[]);
  52. struct IWMMetadataEditor *editor;
  53. struct IWMMetadataEditor2 *editor2;
  54. struct IWMHeaderInfo *header;
  55. struct IWMHeaderInfo2 *header2;
  56. struct IWMHeaderInfo3 *header3;
  57. struct IWMReader *reader;
  58. WMCallback callback;
  59. HANDLE hEvent;
  60. bool openError;
  61. void NeedsIndividualization()
  62. {
  63. First().OpenFailed();
  64. }
  65. void Opened()
  66. {
  67. openError=false;
  68. SetEvent(hEvent);
  69. }
  70. void OpenFailed()
  71. {
  72. openError=true;
  73. SetEvent(hEvent);
  74. }
  75. void Error()
  76. {
  77. openError=true;
  78. SetEvent(hEvent);
  79. }
  80. };
  81. #endif