patterns: Added Ogg pattern

This commit is contained in:
WerWolv
2022-08-29 15:02:08 +02:00
committed by GitHub
parent 4d97e79097
commit 7ee489237d
2 changed files with 30 additions and 0 deletions

View File

@@ -35,6 +35,7 @@ Hex patterns, include patterns and magic files for the use with the ImHex Hex Ed
| File System | | `patterns/fs.hexpat` | Drive File System |
| Bencode | `application/x-bittorrent` | `patterns/bencode.hexpat` | Bencode encoding, used by Torrent files |
| Protobuf | | `patterns/protobuf.hexpat` | Google Protobuf encoding |
| Ogg | | `patterns/ogg.hexpat` | Ogg Audio format |
### Scripts

29
patterns/ogg.hexpat Normal file
View File

@@ -0,0 +1,29 @@
#pragma MIME audio/ogg
#include <std/core.pat>
#include <std/mem.pat>
bitfield HeaderType {
Continuation : 1;
BeginOfStream : 1;
EndOfStream : 1;
};
struct SegmentData {
u8 data[parent.segmentTable[std::core::array_index()]];
};
struct Ogg {
char capturePattern[4];
u8 version;
HeaderType headerType;
u64 granulePosition;
u32 bitstreamSerialNumber;
u32 pageSequenceNumber;
u32 checksum;
u8 pageSegments;
u8 segmentTable[pageSegments];
SegmentData data[pageSegments];
};
Ogg ogg[while(!std::mem::eof())] @ 0x00;