Native media component
The Rust crate media/ builds bobine-media, a read-only inspector run as a child process of the backend. It speaks JSON-RPC 2.0 on standard input and output, one object per UTF-8 line: no network port, no shell, no audio decoding, no write. It is on by default (setting media_native, overridden by BOBINE_MEDIA_NATIVE=1 or 0); ffprobe and ffmpeg remain the fallback for anything outside its subset.
Strict subset
Any ambiguity or structure outside the list answers unsupported, ambiguous_metadata or ambiguous_cover (code -32001, no source path in messages), and the caller goes through ffprobe.
| Format | Accepted |
|---|---|
| MP3 (Layer III) | ID3v2.3 and 2.4 without duplicates; duration from Xing or Info (LAME, Lavf and Lavc delay and padding), VBRI v1 or exact CBR; refused: VBR without index, ID3v1, APE |
| FLAC | STREAMINFO, one bounded Vorbis comment block, picture blocks |
| WAV | little-endian RIFF PCM, fmt and data, LIST INFO limited to the keys ffmpeg renames |
| M4A | one progressive AAC or ALAC track, ilst atoms; mvhd duration within 1 ms of elst and mdhd |
| Ogg Vorbis, Opus | one logical stream starting at 0, ending with EOS |
| AIFF | FORM AIFF PCM; AIFF-C refused |
| MP4, M4V, MOV video | known brand, one moov read alone (32 MiB at most); avc1 track with one SPS (4:2:0, 8 or 10 bits, progressive, crop right and bottom only), constant frame step (a shorter last sample allowed), at most one plain edit per track; first sound track mp4a AAC-LC, implicit SBR and mono PS refused |
Video duration is the latest end among video and sound tracks; a track that could run past it answers ambiguous_metadata. pix_fmt follows the SPS range; a full-range nclx colr box without an SPS range is refused. The reply is a reduced ffprobe document (format.duration, video stream then audio stream), checked key by key by the backend before use.
Covers: raw embedded bytes, straight 8-bit JPEG without Adobe or CMYK, or 8-bit PNG neither interlaced nor animated, 40 Mpx at most, one image.
Protocol
| Method | Parameters | Reply |
|---|---|---|
| hello | protocol_version 1, profiles, formats, video_formats, capabilities, limits | |
| probe_audio | path, profile | status, format, metadata (nine fixed keys including duration_seconds) |
| extract_cover | path, profile | cover null (absence proven) or {mime, bytes, data_base64} |
| probe_video | path | status, format, probe; asked only when hello advertises it |
Errors: the standard -32700, -32600, -32601, -32602, and -32001 with data.reason among not_found, unreadable, unsupported, corrupt, limit_exceeded, ambiguous_metadata, ambiguous_cover.
Limits
Request 64 KiB, reply 8 MiB, cover 4 MiB, audio file 512 MiB, metadata 4 MiB, cumulative reads 16 MiB (128 MiB for an MP3 CBR without index). Video: file 1 TiB, reads 33 MiB, 4096 top-level boxes, 16 tracks, sides of 16384. Paths are absolute Unicode paths to regular files; symbolic links are refused; a file that changes during the read is refused.
Checks
cargo fmt –check, cargo clippy with warnings as errors, cargo test, a fuzz target per reader, a license check of the crate’s dependencies, and on Android an alignment check of libbobine_media.so on 16 KiB pages.