Leo Davidson
Joined: 19 Aug 2008 Posts: 9 Location: London, UK
|
Posted: Sat May 02, 2009 3:37 pm Post subject: FLAC |
|
|
This is a structure viewer definition for the FLAC format. (FLAC = Free Lossless Audio Codec.)
It only parses the metadata blocks at the start of the file. The audio frames are not parsed as I have no need to do so. If you need them this will make a good starting point, though.
What is parsed:
- METADATA_BLOCK_STREAMINFO (from which you can get the sample rate, duration, etc.)
- METADATA_BLOCK_PADDING (just zero padding between other data)
- METADATA_BLOCK_APPLICATION (application-specific; shown as just raw data)
- METADATA_BLOCK_SEEKTABLE (allows FLAC players to jump around in the audio stream)
- METADATA_BLOCK_VORBIS_COMMENT (the main metadata strings/tags)
- METADATA_BLOCK_CUESHEET (cue-sheet data for when entire CDs are archived into a single FLAC file)
- METADATA_BLOCK_PICTURE (album cover art, band photos, etc.; if it's a PNG image then that will be parsed as well, using the PNG sample that comes with Hex Editor Neo)
Something that may be of use to other people, even if they don't care about FLAC, is the 24-bit (three-byte) number type this uses. This is a Big Endian version but it should be obvious how to make a LE version if you need it:
| Code: | struct UInt24
{
hidden:
BYTE Raw[3];
const Value = (Raw[0]<<16) + (Raw[1]<<8) + Raw[2];
$print("(Value)", Value + " decimal");
};
struct Example
{
BYTE b;
UInt24 Length;
BYTE Buffer[Length.Value];
}; |
Hope it's useful to someone!
Download: flac.zip (3KB)
 |
|