From eee74e4672a78a54e95417cfdd8a09b693292b53 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Mon, 13 Sep 2010 04:48:40 +0300 Subject: [PATCH] Re-write the dumpformat specs The new specs are hopefully bit easier to understand... --- streamtools/new-jpcrr-dumpformat | 437 +++++++++++---------------------------- 1 file changed, 116 insertions(+), 321 deletions(-) rewrite streamtools/new-jpcrr-dumpformat (96%) diff --git a/streamtools/new-jpcrr-dumpformat b/streamtools/new-jpcrr-dumpformat dissimilarity index 96% index 5bbc8dc..446d77c 100644 --- a/streamtools/new-jpcrr-dumpformat +++ b/streamtools/new-jpcrr-dumpformat @@ -1,321 +1,116 @@ -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. -** 0004h Subtitle channel. -** 0005h Runinfo 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-1 (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 - -Channel type 1 subtype 1 (PCM sample) - -* Left sample (signed WORD) -* Right sample (signed WORD) - -Channel type 2 subtype 1 (FM low write) - -* Register to write (BYTE) -* Value to write (BYTE) - -Channel type 2 subtype 2 (FM high write) - -* Register to write minus 256 (BYTE). -* Value to write (BYTE). - -Channel type 2 subtype 3 (FM Reset) - -* No data. - -Channel type 1 subtype 0 or channel type 2 subtype 0 (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 4 subtype 0 (Subtitle) - -* Length of subtitle display (QWORD) -* UTF-8 encoded text to use as subtitle. - -Channel type 5 subtype 71 (Game name) - -* UTF-8 encoded game name. - -Channel type 5 subtype 76 (Length) - -* Length of run in nanoseconds (QWORD). - -Channel type 5 subtype 82 (Rerecords) - -* Number of rerecords (QWORD). - -Channel type 0 subtype 3-255, channel type 1 subtype 2-255, channel type -2 subtype 4-255, channel type 4 subtypes 1-255 (reserved) and other -channel type 5 subtypes are reserved. - - - -These are reserved. - -Picturestodump options: ------------------------ -Syntax: picturestodump.exe ... - -The image input is PxM P1-P6 files. The specified images are converted into -video dump stream. - -Valid are: ---fps= - Assume framerate of . Default 60. - -Tip: Static 2s image can be created with: - -picturestodump.exe --fps=0.5 image.ppm static.dump - -Audiotodump options: --------------------- -Syntax: audiotodump - -The input is RAW audio data. It is converted into audio dump stream with -specified channel of PCM type. - -Valid are: ---rate= - Assume input rate of . Default 44100. ---8bit - Assume 8bit input. ---16bit ---16bit-little-endian - Assume 16bit little-endian input. Default. ---16bit-big-endian - Assume 16bit big-endian input. ---stereo - Assume stereo input. Default. ---stereo-swapped - Assume swapped-channel stereo input. ---mono - Assume mono input. ---signed - Assume signed input. Default. ---unsigned - Assume unsigned input. ---volume=, - Write initial volume change with left volume and right volume . ---volume= - Write initial volume change with left volume and right volume . - -mknulldump options: -------------------- -Syntax: mknulldump.exe - -Makes null dump of seconds and writes it into - -Demuxdump options: ------------------- -Syntax: demuxdump.exe - -Writes data for channel from into . - -Muxdump options: ----------------- -Syntax: muxdump.exe ... - -Reads files and muxes the channels, writing result to . - -Cutdump options: ----------------- -Syntax: cutdump.exe - -Cuts range - from and writes it to . - -Fmtopcm options: ----------------- -Syntax: fmtopcm.exe - -Decodes channel from as FM and and writes PCM version of -it (at specified rate ) together with other channels into . - -Dumpconvert options: --------------------- -Input options: ---input= - Read input from . If multiple files are specified, they are treated as concatenation. - -Output options: ---output-rawaudio= - Dump the processed audio to in raw format. ---output-wav= - Dump the processed audio to in wav format. ---audio-rate= - Specify the rate to sample audio at. Default is 44100. Can be specified at most once. ---output-rawrgbx= - Dump the raw RGBx video data to ---output-timecodev2= - Dump the timecode data in v2 format to ---output-srt= - Dump the subtitlte data in srt format to . ---audio-delay= - Delay the audio by specified amount of seconds. Can be negative. ---subtitle-delay= - Adjust the subtitle timing by seconds. - - -Video scaling options: ---video-width= - Rescale the video width to . ---video-height= - Rescale the video height to . ---video-scale-algo= - Set the rescale algo. ---video-framerate= - Output video at specified framerate . Default is 60. Exclusive with - --video-max-dedup. ---video-framerate=auto - Enables variable-fps mode (useful to enable it without turning on dedupping). ---video-max-dedup= - Number of consequtive frames that can be elided by dedupping. Setting this to 0 - disables dedupping entierely. Setting this to nonzero enables variable-fps mode. - Default 0. - -Audio processing options: -If is specified, the processing occurs on specified channel before mixing. Otherwise it occurs after -mixing. The filtering on individual channels and in output occurs in order filters are specified in command -line. - ---audio-mixer-filter=[:],,... ---audio-mixer-filter=[:],,...;,,... - Perform FIR filitering (y0 = a0*x0 + a1*x1 + ... + an*xn). - Perform IIR filitering (b0*y0 + b1*y1 + ... bm*ym = a0*x0 + a1*x1 + ... + an*xn). ---audio-mixer-attenuate=[:] - Attenuate sound by decibels. ---audio-mixer-gain=[:] - Amplify sound by decibels. ---audio-mixer-silence= ---audio-mixer-silence=: - Silence the sound. - -Video processing options: ---video-hardsub-font= - Use the specified font for hardsubs. ---video-hardsub-size= - Set the font point size for hardsubs. Default is 16. ---video-hardsub-xpos= - Place the left edge of hardsubs at this x-coordinate. ---video-hardsub-xpos=left - Place the left edge of hardsubs at display left edge. ---video-hardsub-xpos=center - Place the left edge of hardsubs so that subs are centered. Default. ---video-hardsub-xpos=right - Place the left edge of hardsubs so that sub right edge is at display right edge. ---video-hardsub-ypos= - Place the top edge of hardsubs at this y-coordinate. ---video-hardsub-ypos=top - Place the top edge of hardsubs at display top edge. ---video-hardsub-ypos=center - Place the top edge of hardsubs so that subs are centered. ---video-hardsub-ypos=bottom - Place the top edge of hardsubs so that sub bottom edge is at display bottom edge. Default. ---video-hardsub-duration= - Set the display duration for hardsubs to seconds. Default 5. ---video-hardsub-halo= - Set the halo thickness. 0 disables halo. Default 0. ---video-hardsub-foreground-color= ---video-hardsub-foreground-color=, ---video-hardsub-foreground-color=,, ---video-hardsub-foreground-color=,,, - Set the color at characters to specified color. If color is not specified, it defaults to white. - If alpha is not specified, it defaults to 255 (opaque). ---video-hardsub-halo-color= ---video-hardsub-halo-color=, ---video-hardsub-halo-color=,, ---video-hardsub-halo-color=,,, - Set the color at halo to specified color. If color is not specified, it defaults to black. - If alpha is not specified, it defaults to 255 (opaque). ---video-hardsub-background-color= ---video-hardsub-background-color=, ---video-hardsub-background-color=,, ---video-hardsub-background-color=,,, - Set the color at background to specified color. If color is not specified, it defaults to black. - If alpha is not specified, it defaults to 0 (transparent). ---video-hardsub-textalign= - Set text alignment to . Valid values are 'left' (align left), 'center' (center the text) - and 'right' (align right). Default is 'center'. ---video-hardsub-spacing= - Set text line spacing. Default is 1. ---video-hardsub-text=, - Place the text at timecode . '\\' stands for backslash. '\n' stands for newline. ---video-hardsub-reset - Reset all hardsub settings that have defaults to their defaults. ---video-hardsub-push - Push all hardsub settings into temporary storage stack. ---video-hardsub-pop - Pop all hardsub settings from temporary storage stack. ---video-hardsub-script= - Read as hardsub commands. - -Note: --video-hardsub uses the previous value of each setting. If none is set, defaults are used. - - -dumpplayback options: ---------------------- -Syntax: dumpplayback ... - -Plays back concatenation of s. is any of the audio or video processing options -in dumpconvert. - -Playback options: ---speed= - Play at percent speed. Default 100. +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. Thus e.g. 130 is encoded as 0x81 0x02. + +Dump is split into one or more chapters, just concatenated one after another. +Timecodes in first chapter start from 0 and in each subsequent chapter they start +from last timecode of previous chapter. + + +The structure of each chapter: +------------------------------ +Offset: Length: Description: +0 16 Magic: FFFFh JPCRRMULTIDUMP +16 2 Number of streams (WORD). Must be nonzero. +18 ? Stream header table (consists of stream header elements) +? ? Data table (consists of data elements and special elements) + +Stream header element structure: +-------------------------------- +Offset: Length: Description: +0 2 Channel number (WORD, FFFFh is reserved an MUST NOT be used) + All stream numbers must be unique within chapter. +2 2 Stream type. + 0x0000: Video + 0x0001: PCM audio + 0x0002: FM audio + 0x0003: Dummy + 0x0004: Subtitle + 0x0005: Runinfo +4 2 Stream name length in bytes (0 if no name). +6 ? Stream name (UTF-8). + +Special element (time skip): +---------------------------- +Offset: Length: Description: +0 6 Magic: FFFFFFFFFFFFh + +Signals that no events occur in 2^32-1 ns. Last known timestamp is updated. + +Data elemement: +--------------- +Offset: Length: Description: +0 2 Stream number. WORD, FFFFh MUST NOT be used. +2 4 Time in nanoseconds (DWORD) relative to last timestamp. +6 1 Event subtype +7 ? Event payload data size (not counting any headers, VARIABLE). +? ? Event payload data. + +Payload for stream type 0 subtype 0/1 (video frame): +---------------------------------------------------- +Offset: Length: Description: +0 2 Frame width (WORD) +2 2 Frame height (WORD) +4 ? If subtype is 0, Raw RGBx video data. + If subtype is 1, zlib-compressed Raw RGBx video data. + +Payload for stream type 1/2 subtype 0 (audio volume): +----------------------------------------------------- +Offset: Length: Description: +0 4 Left channel volume numerator (DWORD) +4 4 Left channel volume denumerator (DWORD) +8 4 Right channel volume numerator (DWORD) +12 4 Right channel volume denumerator (DWORD) + +Payload for stream type 1 subtype 1 (PCM sample): +------------------------------------------------- +Offset: Length: Description: +0 2 Left sample (signed WORD). +2 2 Right sample (signed WORD). + +Payload for stream type 2 subtype 1/2 (FM write): +------------------------------------------------- +Offset: Length: Description: +0 1 Low byte of register number (BYTE). The bit 8 of register number is clear if + subtype is 1, set if subtype is 2. +1 1 Data to write. + + +Payload for stream type 2 subtype 3 (Reset): +-------------------------------------------- +No data. + +Payload for stream type 3 (dummy): +---------------------------------- +Ignored. + +Payload for stream type 4 subtype 0 (Subtitle): +----------------------------------------------- +Offset: Length: Description: +0 8 Length of subtitle display in ns (QWORD). +8 ? UTF-8 encoded subtitle text. + +Payload for stream type 5 subtype 71 (Game name): +------------------------------------------------- +Offset: Length: Description: +0 ? UTF-8 encoded game name. + +Payload for stream type 5 subtype 65 (Authors): +----------------------------------------------- +Offset: Length: Description: +0 ? UTF-8 encoded authors string. + +Payload for stream type 5 subtype 76 (Length): +----------------------------------------------- +Offset: Length: Description: +0 8 Length of movie in ns (QWORD). + +Payload for stream type 5 subtype 82 (Rerecords): +------------------------------------------------- +Offset: Length: Description: +0 8 Number of rerecords (QWORD). -- 2.11.4.GIT