How do I implement a spec for this format?

181 Views Asked by At

I am working on the VST3 preset format. This is what I managed till now:

meta:
  id: vstpreset
  file-extension: vstpreset
  endian: le
seq:
  - id: magic
    contents: 'VST3'
  - id: version
    type: u4
  - id: class_id
    type: str
    size: 32
    encoding: ASCII
  - id: ofs_chunk_list
    type: u8
instances:
  chunk_list:
    pos: ofs_chunk_list
    type: chunk_list
    size-eos: true
types:
  chunk:
    seq:
      - id: blob
        size-eos: true
  chunk_list:
    seq:
      - id: magic
        contents: 'List'
      - id: len_entries
        type: u4
      - id: entries
        repeat: expr
        repeat-expr: len_entries
        type: entry
    types:
      entry:
        seq:
          - id: id
            type: u4
          - id: offset
            type: u8
          - id: length
            type: u8
        instances:
          chunk:
            io: _root._io
            pos: offset
            size: length

This kind of works; however, I cannot figure out how to implement the section labelled DATA AREA in the illustration shown in the link above. Isn't it kinda unintuitive to store the CHUNK LIST after the DATA AREA?

0

There are 0 best solutions below