Skip to main content

emit_rust_code_from_args

Function emit_rust_code_from_args 

Source
pub fn emit_rust_code_from_args<S: AsRef<str>>(
    args: &[S],
) -> Result<String, CliError>
Expand description

Translates ffmpeg-style argv tokens into a complete Rust program using the ez-ffmpeg builder API.

Emission works for verified shapes and for the manifest’s enumerated unverified entries — including shapes that are not verified for execution, whose output is prominently labeled “unverified scaffolding”.

The generated program and from_cli_args consume the same lowered plan — same builder calls, same values, same order — but they are not policy-identical. The runtime path layers three checks on top that the emitted program deliberately does not carry:

  • runtime-profile gate: from_cli_args refuses to execute on a non-verified linked FFmpeg (CliError::UnverifiedRuntimeProfile); the emitted program runs against whatever FFmpeg it is built with;
  • strict AVOption handling: an in-process run fails on an option no component consumed (fftools check_avoptions parity, set through a crate-private flag); the emitted builder program only logs the default warning;
  • unique-video-source prerequisite: an in-process -vf run fails unless the opened input has exactly one video stream (CliError::AmbiguousFilterSource); the emitted program uses the builder default, which score-selects a stream like the ffmpeg CLI.