diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2021-12-14 01:20:52 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2021-12-14 01:22:51 +0100 |
commit | 18f7607e1bb397f67c318b964fc8060072fc2cdb (patch) | |
tree | 02040f866a5b7cbf792656e6fb43944908475cd3 /tools/info.h | |
parent | 1478a9f83f2ccfcc58bb0bf0ce050bf4b40d1fb8 (diff) | |
download | fiv-18f7607e1bb397f67c318b964fc8060072fc2cdb.tar.gz fiv-18f7607e1bb397f67c318b964fc8060072fc2cdb.tar.xz fiv-18f7607e1bb397f67c318b964fc8060072fc2cdb.zip |
Add a most basic tool to inspect ISO BMFF files
This can be massively extended.
Diffstat (limited to 'tools/info.h')
-rw-r--r-- | tools/info.h | 19 |
1 files changed, 18 insertions, 1 deletions
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; |