Metadata.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef NULLSOFT_IN_FLAC_METADATA_H
  2. #define NULLSOFT_IN_FLAC_METADATA_H
  3. #include <FLAC/all.h>
  4. class FLACMetadata
  5. {
  6. public:
  7. FLACMetadata();
  8. ~FLACMetadata();
  9. bool Open(const wchar_t *filename, bool optimize=false);
  10. void Reset();
  11. const char *GetMetadata(const char *tag);
  12. void SetMetadata(const char *tag, const char *value);
  13. void RemoveMetadata(const char *tag);
  14. void RemoveMetadata(int n);
  15. bool Save(const wchar_t *filename);
  16. const FLAC__StreamMetadata_StreamInfo *GetStreamInfo();
  17. __int64 GetFileSize() { return filesize; }
  18. bool GetLengthMilliseconds(unsigned __int64 *length);
  19. int GetNumMetadataItems();
  20. const char* EnumMetadata(int n, char *tag, int len);
  21. void SetTag(int n, const char *tag);
  22. bool GetPicture(FLAC__StreamMetadata_Picture_Type type, void **data, size_t *len, wchar_t **mimeType);
  23. bool GetIndexPicture(int index, FLAC__StreamMetadata_Picture_Type *type, void **data, size_t *len, wchar_t **mimeType);
  24. bool RemovePicture(FLAC__StreamMetadata_Picture_Type type);
  25. bool SetPicture(FLAC__StreamMetadata_Picture_Type type, void *data, size_t len, const wchar_t *mimeType, int width, int height);
  26. private:
  27. FLAC__Metadata_Chain *chain;
  28. FLAC__Metadata_Iterator *itr;
  29. FLAC__StreamMetadata *block;
  30. FLAC__StreamMetadata *streamInfo;
  31. __int64 filesize;
  32. };
  33. class Info
  34. {
  35. public:
  36. FLACMetadata metadata;
  37. const wchar_t *filename;
  38. };
  39. extern FLACMetadata *getMetadata;
  40. extern wchar_t *getFileInfoFn;
  41. extern Info *info;
  42. #endif