summaryrefslogtreecommitdiff
path: root/src/demuxers/id3.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/id3.h')
-rw-r--r--src/demuxers/id3.h40
1 files changed, 34 insertions, 6 deletions
diff --git a/src/demuxers/id3.h b/src/demuxers/id3.h
index 9d08f6817..b8f0984b1 100644
--- a/src/demuxers/id3.h
+++ b/src/demuxers/id3.h
@@ -170,6 +170,10 @@ int id3v2_parse_tag(input_plugin_t *input,
xine_stream_t *stream,
int8_t *mp3_frame_header);
+/**
+ * @brief Checks if the given buffer is an ID3 tag preamble
+ * @param ptr Pointer to the first 10 bytes of the ID3 tag
+ */
static inline int id3v2_istag(uint8_t *ptr) {
return
(ptr[0] == 'I') &&
@@ -177,12 +181,36 @@ static inline int id3v2_istag(uint8_t *ptr) {
(ptr[2] == '3');
}
-static inline uint32_t id3v2_tagsize(uint8_t *ptr) {
- return
- ((uint32_t)ptr[0] << 21) +
- ((uint32_t)ptr[1] << 14) +
- ((uint32_t)ptr[2] << 7) +
- (uint32_t)ptr[3];
+#if 0
+/* parse an unsynchronized 16bits integer */
+static inline uint16_t BE_16_synchsafe(uint8_t buf[2]) {
+ return ((uint16_t)(buf[0] & 0x7F) << 7) |
+ (uint16_t)(buf[1] & 0x7F);
+}
+#endif
+
+/* parse an unsynchronized 24bits integer */
+static inline uint32_t BE_24_synchsafe(uint8_t buf[3]) {
+ return ((uint32_t)(buf[0] & 0x7F) << 14) |
+ ((uint32_t)(buf[1] & 0x7F) << 7) |
+ (uint32_t)(buf[2] & 0x7F);
+}
+
+/* parse an unsynchronized 32bits integer */
+static inline uint32_t BE_32_synchsafe(uint8_t buf[4]) {
+ return ((uint32_t)(buf[0] & 0x7F) << 21) |
+ ((uint32_t)(buf[1] & 0x7F) << 14) |
+ ((uint32_t)(buf[2] & 0x7F) << 7) |
+ (uint32_t)(buf[3] & 0x7F);
+}
+
+/* parse an unsynchronized 35bits integer */
+static inline uint32_t BE_35_synchsafe(uint8_t buf[5]) {
+ return ((uint32_t)(buf[0] & 0x07) << 28) |
+ ((uint32_t)(buf[1] & 0x7F) << 21) |
+ ((uint32_t)(buf[2] & 0x7F) << 14) |
+ ((uint32_t)(buf[3] & 0x7F) << 7) |
+ (uint32_t)(buf[4] & 0x7F);
}
#endif /* ID3_H */