-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resource Interchange File Format #230
Comments
I've figured out a way how to move basic building RIFF types into separate files and reuse them in all RIFF-compliant formats. The basic building unit of every RIFF file is the chunk: meta:
id: chunk
encoding: ASCII
endian: le
params:
- id: expected_chunk_id
doc: Optional parameter, pass empty string ('') if you don't want to specify
type: str
seq:
- id: chunk_id
if: expected_chunk_id == ''
type: str
size: 4
pad-right: 0x20
- id: chunk_id_assert
if: expected_chunk_id != ''
type: str
size: 4
pad-right: 0x20
valid: expected_chunk_id
- id: chunk_size
type: u4
- id: chunk_data
type: slot
size: chunk_size
- id: pad_byte
size: chunk_size % 2
types:
slot: {} # Keeps _io for later use of the same substream The 'RIFF' and 'LIST' chunk data structure is defined as follows: meta:
id: parent_chunk_data
encoding: ASCII
endian: le
params:
- id: expected_form_type
doc: Optional parameter, pass empty string ('') if you don't want to specify
type: str
seq:
- id: form_type
if: expected_form_type == ''
type: str
size: 4
pad-right: 0x20
- id: form_type_assert
if: expected_form_type != ''
type: str
size: 4
pad-right: 0x20
valid: expected_form_type
- id: subchunks
type: slot
size-eos: true
types:
slot: {} # Keeps _io for later use of the same substream Instead of parsing the chunk body immediately, I use an empty type named info_subchunk:
seq:
- id: chunk
type: chunk('')
instances:
chunk_data:
io: chunk.chunk_data._io
pos: 0
type: strz I enclose a KSY spec for a sample RIFF form type 'GOBL', which is used in the original RIFF specification as an example of how an RIFF form should look like. I created a sample file to test it, so you can see the structure. |
The text was updated successfully, but these errors were encountered: