Idea for new JPC-RR dumpformat:
All numbers are big-endian.
BYTE is 1 byte, WORD is 2, DWORD is 4, QWORD is 8.
VARIABLE has bit 7 set for all but the last byte, and only 7 low bits in each
byte contribute.
Main file structure:
* Magic: FFFFh JPCRRMULTIDUMP
* Number of channels (WORD). Must be nonzero.
* Channels table (consists of channel elements)
* Data table (consists of data elements and special elements)
Channel element structure:
* Channel number (WORD, FFFFh is reserved an MUST NOT be used) All channel
numbers must be unique within segment, but there are no uniqueness requirements
between segments.
* Channel type (WORD):
** 0000h Video output channel
** 0001h PCM audio output channel
** 0002h FM audio output channel
** 0003h Dummy channel.
** All other values are reserved.
* Channel name length. WORD, 0 if channel has no name.
* Channel name (UTF-8, channel name length bytes).
Special element (time skip):
* Magic: FFFFFFFFFFFFh
Signals that no events occur in 2^32-1 ns. Last known timestamp is updated.
Special element (segment restart):
* Magic: FFFFh JPCRRMULTIDUMP
Signals that new segment begins from here. Channel tables are reset. Stream
base time will be time of last event in current segment.
Data element structure:
* Channel number. WORD, FFFFh MUST NOT be used.
* Time in nanoseconds (DWORD) relative to last known timestamp (will be
updated)
* Event subtype (BYTE)
* Event data size (VARIABLE, not including headers).
* Event data (format channel/subtype dependent)
Channel type 0 subtypes 0-2 (Frame)
* Frame width (WORD)
* Frame height (WORD)
* Frame data. What's exactly here depends on subtype:
** subtype 0: Raw RGBx video data.
** subtype 1: RGBx video data with zlib compression
** subtype 2: RGBx video data minus last frame data with zlib compression.
Note: Substraction is pixel by pixel, component by component. Pixels
outside image are treated as black.
Channel type 1 subtype 0 (PCM sample)
* Left sample (signed WORD)
* Right sample (signed WORD)
Channel type 2 subtype 0 (FM low write)
* Register to write (BYTE)
* Value to write (BYTE)
Channel type 2 subtype 1 (FM high write)
* Register to write minus 256 (BYTE).
* Value to write (BYTE).
Channel type 1 subtype 1 or channel type 2 subtype 2 (set volume)
* Left volume numerator (DWORD).
* Left volume denumerator (DWORD).
* Right volume numerator (DWORD).
* Right volume denumerator (DWORD).
Channel type 3 subtypes 0-255:
* Ignored
Channel type 0 subtype 3-255, channel type 1 subtype 2-255 and channel type
2 subtype 3-255 (reserved)
These are reserved.