8.16.0.1
Resource Interchange File Format (RIFF)
(require binary-class/riff) | package: binary-class-riff |
This module provides utilities for reading and writing RIFF files.
1 Reading and Writing
procedure
in : input-port? = (current-input-port) (read-riff in dispatch) → (is-a?/c riff%) in : input-port? dispatch : (-> bytes? (or/c (subclass?/c riff%) #f))
Reads RIFF data from in and returns it.
If dispatch is supplied, it must be a procedure accepting
a four-byte chunk ID, and returning a subclass of riff%
or #f if no special handling is required.
procedure
(write-riff v [out]) → void?
v : (is-a?/c riff%) out : output-port? = (current-output-port)
Writes the RIFF object v to out.
2 Binary Classes
The base type for all RIFF data.
|
superclass: riff% |
Represents a raw chunk.
constructor
(new riff:chunk% [data data] ...superclass-args...) → (is-a?/c riff:chunk%) data : bytes?
|
superclass: riff% |
Represents a list chunk.
constructor
(new riff:list% [type type] [chunks chunks] ...superclass-args...) → (is-a?/c riff:list%) type : bytes? chunks : (listof (is-a?/c riff%)) Returns the first sub-chunk with ID matching id. If multiple ids are supplied, they refer to nested sub-chunks.
value
fourcc : binary? = (bytestring 4)
A binary type for reading chunk IDs.
Returns a binary type based on type, with padding to the nearest word.