aboutsummaryrefslogtreecommitdiff
path: root/Src/replicant/nsid3v2/values.cpp
diff options
context:
space:
mode:
authorJean-Francois Mauguit <jfmauguit@mac.com>2024-09-24 09:03:25 -0400
committerGitHub <noreply@github.com>2024-09-24 09:03:25 -0400
commitbab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/replicant/nsid3v2/values.cpp
parent4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff)
parent20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff)
downloadwinamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/replicant/nsid3v2/values.cpp')
-rw-r--r--Src/replicant/nsid3v2/values.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/Src/replicant/nsid3v2/values.cpp b/Src/replicant/nsid3v2/values.cpp
new file mode 100644
index 00000000..843cec3f
--- /dev/null
+++ b/Src/replicant/nsid3v2/values.cpp
@@ -0,0 +1,49 @@
+#include "values.h"
+
+uint8_t ID3v2::Values::ValidHeaderMask(uint8_t version, uint8_t revision)
+{
+ switch(version)
+ {
+ case 2:
+ if (revision == 1)
+ return 0xE0;
+ else
+ return 0xC0;
+ case 4:
+ return 0xF0; /* 11110000 */
+ case 3:
+ return 0xE0; /* 11100000 */
+ default:
+ return 0;
+ }
+}
+
+bool ID3v2::Values::KnownVersion(uint8_t version, uint8_t revision)
+{
+ if (version > Values::MAX_VERSION)
+ return false;
+
+ if (version < Values::MIN_VERSION)
+ return false;
+
+ return true;
+}
+
+uint8_t ID3v2::Values::ExtendedHeaderFlag(uint8_t version, uint8_t revision)
+{
+ switch(version)
+ {
+ case 2:
+ if (revision == 1)
+ return (1 << 6);
+ else
+ return 0;
+
+ case 3:
+ case 4:
+ return (1 << 6);
+
+ default:
+ return 0;
+ }
+}