Expand description
Reference implementations: a toy container (TIVF: a 20-byte header and length-prefixed timed packets) and a toy codec (a packet holds 0..3 grey pictures and may re-present the previous one).
They exercise every rule of the media contracts: output later than input
and 0..N frames per packet, shared pictures, backpressure, drain, reset,
configuration epochs, seeking with an index scan, and pulled muxer output
with or without patches. The conformance checks are validated against
them, as zencodec-testkit’s checks are against its reference codec.
TIVF header: b"TIVF", width u16, height u16, time base numerator
u32, denominator u32, packet count u32 (0 = unknown), all little
endian. Packet: payload length u32, pts i64, flags u8 (bit 0:
random access), payload. Toy payload: picture count u8 (0..=3),
show-existing u8, then the grey planes.
Structs§
- ToyDecoder
- Toy decoder. Pictures come out one packet late (a one-packet reorder),
so output trails input; a show-existing flag re-presents the previous
picture. Holds at most
max_queued_framesbefore pushing back. - ToyDemuxer
- Sans-I/O TIVF demuxer. Sequential by default;
seekbuilds a bounded index by scanning packet headers withRangerequests. - ToyEncoder
- Toy encoder: one gray picture per packet,
lookaheadframes held back, a random-access point everykeyintpackets. - ToyMuxer
- TIVF muxer.
write_countmeans the header’s packet count is patched at finish, which a forward-only destination cannot accept.
Enums§
- ToyError
- Errors of the toy container and codec.
Constants§
- HEADER_
LEN - TIVF header length.
- MAGIC
- The TIVF file signature.
- PACKET_
HEADER_ LEN - TIVF packet header length.
Functions§
- toy_
payload - Build a toy packet payload.