Skip to main content

Crate mediaway_test_media

Crate mediaway_test_media 

Source
Expand description

Deterministic test-media generators with a local gitignored cache.

Cache hits are validated with BLAKE3 against an expected digest — same path alone is not enough. Binaries must not be committed — see docs/conventions/testing.md.

Enums§

TestMediaError
Errors from fixture ensure / generate.

Constants§

DEFAULT_CACHE_DIR_NAME
Default cache directory name under the workspace root.
PCM_SILENCE_48K_STEREO_20MS_BLAKE3
BLAKE3 hex digest of 20 ms of silent 48 kHz stereo 16-bit PCM (pcm/silence_48k_stereo_20ms.pcm).
SOLID_GRAY_NV12_64X64_BLAKE3
BLAKE3 hex digest of a 64×64 mid-gray NV12 frame (solid/gray_nv12_64x64.yuv).
SOLID_RED_64X64_BLAKE3
BLAKE3 hex digest of a 64×64 opaque red RGBA8 frame (solid/red_64x64.rgba).

Functions§

cache_dir
Resolve the local fixture cache directory.
ensure
Ensure relative_name exists under the cache and matches expected_blake3_hex.
ensure_pcm_silence_48k_stereo_20ms
Ensure 20 ms of silent 48 kHz stereo 16-bit PCM (pcm/silence_48k_stereo_20ms.pcm).
ensure_solid_gray_nv12_64x64
Ensure a 64×64 mid-gray NV12 fixture (solid/gray_nv12_64x64.yuv).
ensure_solid_red_64x64
Ensure a 64×64 opaque red RGBA8 fixture (solid/red_64x64.rgba).
hash_bytes
BLAKE3 hex digest of an in-memory buffer.
hash_file
BLAKE3 hex digest of a file (streaming).
pcm_silence_bytes
In-memory silent interleaved 16-bit PCM buffer (frames_per_channel * channels * 2 bytes, all zero).
solid_nv12_bytes
In-memory solid-color NV12 buffer (layout matches write_solid_nv12).
solid_rgba8_bytes
In-memory solid RGBA8 buffer (for digest computation / tiny fixtures).
write_pcm_silence
Write a silent interleaved 16-bit PCM buffer.
write_solid_nv12
Write a solid-color NV12 frame: width * height luma bytes, then width * height / 2 bytes of interleaved chroma (U, V, U, V, … per row).
write_solid_rgba8
Write a solid-color packed RGBA8 frame (width * height * 4 bytes).