1
0

header.h 917 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include "foundation/types.h"
  3. namespace ID3v2
  4. {
  5. class Header
  6. {
  7. public:
  8. Header();
  9. Header(uint8_t version, uint8_t revision);
  10. Header(const void *data);
  11. Header(const Header *copy, uint32_t new_size);
  12. void Parse(const void *data);
  13. int Serialize(void *data);
  14. int SerializeAsHeader(void *data);
  15. int SerializeAsFooter(void *data);
  16. /* Does this seem like a valid ID3v2 header? */
  17. bool Valid() const;
  18. bool FooterValid() const;
  19. /* how much space the tag occupies on disk */
  20. uint32_t TagSize() const;
  21. bool HasExtendedHeader() const;
  22. uint8_t GetVersion() const;
  23. uint8_t GetRevision() const;
  24. bool Unsynchronised() const;
  25. bool HasFooter() const;
  26. void SetFooter(bool footer);
  27. enum
  28. {
  29. SIZE=10,
  30. };
  31. void ClearExtendedHeader();
  32. void ClearUnsynchronized();
  33. private:
  34. uint8_t marker[3];
  35. uint8_t version;
  36. uint8_t revision;
  37. uint8_t flags;
  38. uint32_t size;
  39. };
  40. }