diff options
Diffstat (limited to 'src/demuxers/id3.h')
-rw-r--r-- | src/demuxers/id3.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/demuxers/id3.h b/src/demuxers/id3.h index 9b86ec94e..b8f0984b1 100644 --- a/src/demuxers/id3.h +++ b/src/demuxers/id3.h @@ -181,4 +181,36 @@ static inline int id3v2_istag(uint8_t *ptr) { (ptr[2] == '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 */ |