I was looking for an easy way to parse a binary file. I know what the file contains (it’s an MPEG2 transport stream) and know the bit-field layout. It’s just a pain to figure the bits out manually in a hex editor.
That’s when I came across the Data::ParseBinary perl module, which is a true relief to use. It supports pretty much every thing you need to parse a binary file:
- Signed and unsigned integers
- Big and little endian
- 8, 16, 32 and 64 bit integers
- Enum-types to specify your own names for values
- If-constructs: Fields are present or not depending on the value of another field
In short, an incredible tool!