The .loxi format
Starting with LiquidCD 2.0, a new disk image format has been introduced. Now there are a lot of disk image formats, and I really mean A LOT. You may have heard of the .iso, .dmg,... Well, none of those can store Audio data, some cannot even store more than one track.
So, why not using "cue/bin" or "toc/xa" ? Because if you lose the .cue or .toc, the binary file is useless. Two files for a disk image ? Personally, I don't think this is the right solution. Plus there aren't any official specs.
But there are other disk image formats that CAN store any kind of data. Like the .nrg or .cdi. Unfortunately, these are closed formats. So the decision has been made to create a new, open, format for disk images.
The loxi format has been designed to be ultra-easy to parse, so anyone can read it. "loxi" stands for "LiquidCD Open Xml Image format".
The specs are open, so anyone can freely read or write a disk image in the loxi format. But you CANNOT MAKE ANY CHANGE to the specs. Don't write custom tags, don't do anything crazy like that. If you need a new tag, just contact me and we will officially integrate it in the loxi specs.
The loxi format, as in its 1.0 version, does not support compression nor encryption.
Parsing the .loxi format
What you need to know:
- The header is actually a footer
- The file ends with the four chars 'LOXI' and has the ".loxi" extension in its name
- The length of the footer is stored in an unsigned, Big Endian, 32 bits integer. To get that number, read 4 bytes at offset (file length) - 8.
- The footer is clear text, utf8-encoded xml data. Do not use any other encoding.
- Sizes in xml are in bytes (not sectors). You should parse them as unsigned 64 bits integer.
- Offsets in xml are in bytes and are relative to the beginning of the file (offset 0).
- Indentation is not required. Feel free to remove any useless blank space.
The loxi version 1.0 format
The footer always starts with:
<?xml version="1.0" encoding="UTF-8"?><disc version="1.0" version-compatibility="1.0">
And ends with:
</disc>
The encoding is always UTF-8. The "version" is the version of the loxi format. The "version-compatibility" may be different than the version: let's say the version is 1.2. If the version-compatibility is 1.0, then your 1.0 parser can read the footer (even though some of the information will be lost). If you have written a loxi 1.0 parser and the version-compatibility is 1.1, don't make any attempt to read the file.
CDText information
The footer may optionally have CD-Text information. The block is in the "<cdtext> ... </cdtext>" tags. For example, the cdtext data may look like this:
<cdtext>
<cdtextblock encoding="ascii" language="eng">
<cdtexttrack title="Disc name"></cdtexttrack>
<cdtexttrack songwriter="Mr Foo" specialmessage="Bar" title="Baz"></cdtexttrack>
<cdtexttrack songwriter="Mr Bar"></cdtexttrack>
</cdtextblock>
</cdtext>
You should create a "cdtextblock" for each language. Supported languages are in the ISO 639 language code. It can also be an empty string (""). The encoding specifies what text encoding should be used when burning the disc. In the footer, the actual data is encoded as UTF-8. Always. Supported encodings for cdtext are : "ascii", "latin1", "8shiftjis" and "utf8".
The CD-Text information for each individual track is stored in the "cdtexttrack" tag. The first "cdtexttrack" stores information for the disc, the 2nd for the first audio track,...
There must always be as many "cdtexttrack" tags as audio tracks, plus one for the disc information. The "cdtexttrack" tag has the following properties:
- "title" : the song name
- "songwriter" : the autor
- "specialmessage" : anything else
All properties are optional. An empty <cdtexttrack></cdtexttrack> tag is allowed. Audio CDs that also have a data track should not have cdtext information.
The tracks
The loxi format can store multiple tracks, but also multiple sessions with multiple tracks.
A single-session, single-track disk would look like this:
<?xml version="1.0" encoding="UTF-8"?>
<disc version="1.0" version-compatibility="1.0">
(... optional CDText information ...)
<track type="audio" block-size="2352" start-offset="0" size="51863952" pregap-size="352800" ></track>
</disc>
The "pregap-size" property is optional and must be a multiple of block-size.
A multi-session disc would look like this:
<?xml version="1.0" encoding="UTF-8"?>
<disc version="1.0" version-compatibility="1.0">
<session>
<track type="mode1" block-size="2048" start-offset="0" size="307200"></track>
</session>
<session>
<track type="mode1" block-size="2048" start-offset="307200" size="309248"></track>
<track .....blabla..... ></track>
</session>
</disc>
The track types are:
- "audio" : an audio track
- "mode1" : a mode 1 track or a standard dvd track
- "mode2" : a mode 2 track
The "block-size" property is required. The size must be a multiple of "block-size".
Advanced options such as the ISRC code or 4 channels audio are not yet supported.