ez-ffmpeg 0.16.0

A safe and ergonomic Rust interface for FFmpeg integration, designed for ease of use.
Documentation
use ffmpeg_sys_next::AVMediaType;
use ffmpeg_sys_next::AVMediaType::{
    AVMEDIA_TYPE_ATTACHMENT, AVMEDIA_TYPE_AUDIO, AVMEDIA_TYPE_DATA, AVMEDIA_TYPE_SUBTITLE,
    AVMEDIA_TYPE_VIDEO,
};

mod dec_task;
mod demux_task;
mod enc_task;
/// The **ffmpeg_scheduler** module provides the orchestrator that actually runs the
/// configured FFmpeg job. It handles the lifecycle of the FFmpeg process, manages
/// threading (or subprocess execution) as appropriate, and returns the final results.
/// You can optionally run this job synchronously or, if the `async` feature is enabled,
/// as an async task that you `.await`.
///
/// # Synchronous Example
///
/// ```rust,ignore
/// // Assume we've already built an FfmpegContext
/// let context = FfmpegContext::builder()
///     .input("test.mp4")
///     .filter_desc("hue=s=0")
///     .output("output.mp4")
///     .build()
///     .unwrap();
///
/// // Create a scheduler, start the job, then block until it's finished
/// let result = FfmpegScheduler::new(context)
///     .start()
///     .unwrap()
///     .wait();
///
/// assert!(result.is_ok(), "FFmpeg job failed unexpectedly");
/// ```
///
/// # Asynchronous Example (requires `async` feature)
///
/// ```rust,ignore
/// // Note: you need to enable the "async" feature in Cargo.toml:
/// // [dependencies.ez_ffmpeg]
/// // features = ["async"]
///
/// #[tokio::main]
/// async fn main() {
///     let context = FfmpegContext::builder()
///         .input("test.mp4")
///         .filter_desc("hue=s=0")
///         .output("output.mp4")
///         .build()
///         .unwrap();
///
///     let mut scheduler = FfmpegScheduler::new(context)
///         .start()
///         .expect("Failed to start FFmpeg job");
///
///     // Asynchronous wait
///     scheduler.await.expect("FFmpeg job failed unexpectedly");
/// }
/// ```
pub mod ffmpeg_scheduler;
pub(crate) mod filter_task;
mod frame_filter_pipeline;
mod frame_source_task;
pub(crate) mod input_controller;
mod mux_task;
/// The output interrupt callback lives outside this module tree and must
/// reach the probe to record its cut election; the probe itself stays
/// test-only.
#[cfg(test)]
pub(crate) use mux_task::tcp_write_probe;
pub(crate) mod owned_run_iter;
#[cfg(test)]
mod packet_sink_wedge_tests;
// Typed, pull-based progress reporting for running jobs; documented by its
// own module-level docs (an outer doc comment here would merge with them
// and break their intra-doc link resolution scope).
pub mod progress;
pub(crate) mod sync_queue;

pub(crate) fn type_to_symbol(media_type: AVMediaType) -> String {
    match media_type {
        AVMediaType::AVMEDIA_TYPE_UNKNOWN => "unknown".to_string(),
        AVMEDIA_TYPE_VIDEO => "v".to_string(),
        AVMEDIA_TYPE_AUDIO => "a".to_string(),
        AVMEDIA_TYPE_DATA => "d".to_string(),
        AVMEDIA_TYPE_SUBTITLE => "s".to_string(),
        AVMEDIA_TYPE_ATTACHMENT => "t".to_string(),
        AVMediaType::AVMEDIA_TYPE_NB => "nb".to_string(),
    }
}