From 18f7607e1bb397f67c318b964fc8060072fc2cdb Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Tue, 14 Dec 2021 01:20:52 +0100 Subject: Add a most basic tool to inspect ISO BMFF files This can be massively extended. --- tools/info.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'tools/info.h') diff --git a/tools/info.h b/tools/info.h index 4acef3c..ef58d7b 100644 --- a/tools/info.h +++ b/tools/info.h @@ -35,6 +35,14 @@ binhex(const uint8_t *data, size_t len) return buf; } +static uint64_t +u64be(const uint8_t *p) +{ + return (uint64_t) p[0] << 56 | (uint64_t) p[1] << 48 | + (uint64_t) p[2] << 40 | (uint64_t) p[3] << 32 | + (uint64_t) p[4] << 24 | p[5] << 16 | p[6] << 8 | p[7]; +} + static uint32_t u32be(const uint8_t *p) { @@ -47,6 +55,14 @@ u16be(const uint8_t *p) return (uint16_t) p[0] << 8 | p[1]; } +static uint64_t +u64le(const uint8_t *p) +{ + return (uint64_t) p[7] << 56 | (uint64_t) p[6] << 48 | + (uint64_t) p[5] << 40 | (uint64_t) p[4] << 32 | + (uint64_t) p[3] << 24 | p[2] << 16 | p[1] << 8 | p[0]; +} + static uint32_t u32le(const uint8_t *p) { @@ -97,9 +113,10 @@ u16le(const uint8_t *p) // ExifTool is too user-oriented. static struct un { + uint64_t (*u64) (const uint8_t *); uint32_t (*u32) (const uint8_t *); uint16_t (*u16) (const uint8_t *); -} unbe = {u32be, u16be}, unle = {u32le, u16le}; +} unbe = {u64be, u32be, u16be}, unle = {u64le, u32le, u16le}; struct tiffer { struct un *un; -- cgit v1.2.3-70-g09d2