mediaway-container 0.1.2

Container facade — mux/demux traits and Mediaway MP4 surface
Documentation

mediaway-container

Status: early development (0.x). Not recommended for production; public APIs may change without notice. Part of the Mediaway media stack.

The Mediaway container facade: shared mux/demux traits plus Mediaway-typed modules for eight container formats — mp4, webm, wav, adts, mp3, ogg, flv, ts. Each module is a sans-io state machine over the workspace's format cores, speaking mediaway_common's StreamInfo/Packet types so apps can swap formats behind one interface.

Quick start

use mediaway_common::{Bytes, CodecKind, Packet, Rational, StreamInfo, VideoGeometry};
use mediaway_container::mp4;

// Typestate mux: register tracks, begin, push packets, collect bytes.
let mut muxer = mp4::Muxer::new();
let v_track = muxer.add_track(StreamInfo::Video {
    id: 0, codec: CodecKind::H264, time_base: Rational::new(1, 30),
    geometry: VideoGeometry { width: 1920, height: 1080 },
    extra_data: Bytes::new(),
})?;

let mut muxer = muxer.begin(); // Open -> Live
muxer.push_packet(&Packet {
    stream_id: v_track, pts: 0, dts: 0, duration: 1,
    is_keyframe: true, is_discard: false,
    payload: Bytes::from_static(b"\x00\x00\x00\x01"),
})?;
muxer.flush();

let mut mp4_bytes = Vec::new();
muxer.poll_bytes(&mut mp4_bytes);

// Streaming demux: feed bytes, poll packets.
let mut demux = mp4::Demuxer::new();
demux.push_bytes(&mp4_bytes);
while let Some(pkt) = demux.poll_packet() { /**/ }

Status

Status marks: ✅ first-class (tests for claimed scope) · ⚡ Zero-Copy path (no payload copy; implies ✅) · 🆗 best-effort / prototype · 🛠️ planned · ❌ attempted and genuinely blocked · 👻 not exercisable yet (no hardware / device / session available)

Format Module Status Notes
MP4 / fMP4 mp4 Mux + demux + ClearKey CENC
WebM webm Mux + demux (full Matroska-profile demux)
WAV / RIFF (PCM) wav Mux + demux; own method shape (size known up front)
ADTS (raw AAC) adts Mux/Demux traits
MP3 mp3 Demux only; no Mux fit (per-frame padding bit)
Ogg ogg Mux/Demux; codec from OpusHead/Vorbis id header
FLV flv Codec-aware mux + demux (AVC video, AAC/MP3 audio)
MPEG-TS ts Demux only; mux exposes per-PID write_access_unit
VP8 CodecKind mapping Recognized structurally in WebM, not representable yet

Docs

Contributing

Contributions are welcome — open an issue or pull request at github.com/nyxways/mediaway.

License

MIT OR Apache-2.0.