KaitaiStructWorkshop/07_list.ksy

110 lines
2.0 KiB
Plaintext
Raw Normal View History

2020-12-29 11:03:08 +00:00
meta:
id: wav
file-extension: wav
encoding: ascii
endian: le
seq:
- id: magic
type: str
size: 4
- id: size
type: u4
- id: wave_str
type: str
size: 4
- id: sections
type: section
repeat: eos
instances: {}
types:
section:
seq:
- id: name
type: str
size: 4
- id: size
type: u4
- id: content
size: size
type:
switch-on: name
cases:
'"fmt "': fmt
'"data"': data
'"fact"': fact
'"PEAK"': peak
'"LIST"': list
fmt:
seq:
- id: type
type: u2
- id: channels
type: u2
- id: samplerate
type: u4
- id: datarate
type: u4
doc: Might also be datarate per channel
- id: bytes_per_sample
type: u2
- id: bits_per_unit
type: u2
instances:
combined_type:
value: type * 100 + bits_per_unit
data:
seq:
- id: content
type: sample
repeat: eos
types:
sample:
seq:
- id: data
type:
switch-on: _root.sections[0].content.\
as<fmt>.combined_type
cases:
332: f4
108: u1
116: s2
132: s4
repeat: expr
repeat-expr: _root.sections[0].content.\
as<fmt>.channels
fact:
seq:
- id: samples
type: u4
peak:
seq:
- id: unknown_0
type: u4
- id: timestamp
type: u4
- id: peak
type: f4
- id: index
type: u4
list:
seq:
- id: info_str
type: str
size: 4
- id: contents
repeat: eos
type: content
types:
content:
seq:
- id: name
type: str
size: 4
- id: size
type: u4
- id: content
type: str
size: size
enums: {}
doc: Hello, world
doc-ref: https://example.com