1
0

values.cpp 721 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include "values.h"
  2. uint8_t ID3v2::Values::ValidHeaderMask(uint8_t version, uint8_t revision)
  3. {
  4. switch(version)
  5. {
  6. case 2:
  7. if (revision == 1)
  8. return 0xE0;
  9. else
  10. return 0xC0;
  11. case 4:
  12. return 0xF0; /* 11110000 */
  13. case 3:
  14. return 0xE0; /* 11100000 */
  15. default:
  16. return 0;
  17. }
  18. }
  19. bool ID3v2::Values::KnownVersion(uint8_t version, uint8_t revision)
  20. {
  21. if (version > Values::MAX_VERSION)
  22. return false;
  23. if (version < Values::MIN_VERSION)
  24. return false;
  25. return true;
  26. }
  27. uint8_t ID3v2::Values::ExtendedHeaderFlag(uint8_t version, uint8_t revision)
  28. {
  29. switch(version)
  30. {
  31. case 2:
  32. if (revision == 1)
  33. return (1 << 6);
  34. else
  35. return 0;
  36. case 3:
  37. case 4:
  38. return (1 << 6);
  39. default:
  40. return 0;
  41. }
  42. }