RRiffMeadow
Product

Product features · RIFF chunk boundary walking

01

Inspect riff_chunks.py at each declared chunk boundary before handing any payload to a separate decoder.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

RIFF chunk boundary walking

● ● ●RiffMeadow●
A concrete starting point · RIFF chunk boundary walking ×
def riff_chunks(wire):
    if type(wire) is not bytes or not 12 <= len(wire) <= 1048576:
        raise ValueError("riff.input")
    if wire[:4] != b"RIFF" or wire[8:12] != b"WAVE" or int.from_bytes(wire[4:8], "little")+8 != len(wire):
        raise ValueError("riff.header")
    chunks, pos = [], 12
    while pos < len(wire):
        if len(chunks) == 128 or pos+8 > len(wire):
            raise ValueError("riff.chunk")
        tag = wire[pos:pos+4]
        size = int.from_bytes(wire[pos+4:pos+8], "little")
        start, stop = pos+8, pos+8+size
        next_pos = stop+(size & 1)
        if next_pos > len(wire):
            raise ValueError("riff.truncated")
        chunks.append((tag, wire[start:stop]))
        pos = next_pos
    return chunks
✳RIFF chunk boundary walking
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗