Expand description
Owned finite video encoding with admitted compressed staging (requires std).
Finite video encoding without final-destination waits while the encoder is alive.
The operation owns the encoder and actual prepared container/destination.
Every frame is resolved through policy before conversion and native input.
Encoded payloads use explicit memory or disk staging. Disk writes may block
while the encoder owns raw state. Finish drains and drops
the encoder before publishing any bytes. This intentionally stages the full
compressed sequence; it is not a live streaming/backpressure mechanism.
Caller-held pictures, codec/CMS workspace and bookkeeping are outside the
payload budget. Unsupported timing/layout fails before the first frame.
Optional borrowed Pulse arguments add per-call control. None leaves retained
native controls, storage admission and required policy checks in force.
use zencodec::{frame::Frame, operation::PolicySet, storage::StorageBudget};
use zencodec_media::{container::Muxer, output::Forward, session::VideoEncoder,
staged::StagedEncode};
fn encode<E: VideoEncoder, M: Muxer, W: std::io::Write>(
encoder: E, mux: M, writer: W, frames: impl IntoIterator<Item = Frame>,
) -> Result<(), Box<dyn core::error::Error>> {
let mut job = StagedEncode::new(encoder, mux, Forward(writer),
PolicySet::new(), StorageBudget::new(64 * 1024 * 1024, 4096), None)?;
for frame in frames { job.push(frame, None)?; }
let completed = job.finish(None)?;
let _ = (completed.stats, completed.report);
Ok(())
}Structs§
- Completed
- Completed output and its bounded application decision history.
- Failure
- Failure with bounded policy history and a retained concrete cause. Default formatting omits arbitrary backend and application payloads.
- Staged
Encode - An owned, fixed-configuration video-to-container operation.
Enums§
- Refusal
- Typed refusal of the fixed-configuration staging contract.
- Stage
- Boundary at which the owned operation stopped.
Type Aliases§
- Cause
- Concrete source, native codec, conversion, policy or destination failure.