Skip to main content

crispy_media_probe/
lib.rs

1//! ffprobe/ffmpeg stream analysis and screenshot capture.
2//!
3//! This crate provides async functions for probing IPTV streams using
4//! ffprobe and ffmpeg. It is a Rust translation of logic from:
5//!
6//! - [IPTVChecker-Python](https://github.com/kristofferR/IPTVChecker-Python)
7//! - [iptv-checker-module](https://github.com/detroitenglish/iptv-checker-module)
8//! - [iptvtools](https://github.com/huxuan/iptvtools)
9//!
10//! # Optional: libmpv backend
11//!
12//! When the `libmpv-backend` feature is enabled, this crate also provides
13//! stream probing and screenshot capture via libmpv (loaded at runtime via
14//! `dlopen`/`LoadLibrary`). This is useful when mpv is bundled by the
15//! application (e.g. via Flutter's media_kit) but ffprobe is not installed.
16//!
17//! Set the `CRISPY_LIBMPV_PATH` environment variable to point to a specific
18//! libmpv shared library. If not set, the system default is tried.
19
20pub mod bitrate;
21pub mod error;
22pub mod hls;
23pub mod mismatch;
24pub mod probe;
25pub mod screenshot;
26pub mod types;
27
28// libmpv backend modules (optional feature).
29#[cfg(feature = "libmpv-backend")]
30pub mod mpv_ffi;
31#[cfg(feature = "libmpv-backend")]
32pub mod mpv_probe;
33#[cfg(feature = "libmpv-backend")]
34pub mod mpv_screenshot;
35
36// Re-export public API at crate root.
37pub use bitrate::profile_bitrate;
38pub use error::ProbeError;
39pub use hls::{parse_hls_variants, select_best_variant};
40pub use mismatch::check_label_mismatch;
41pub use probe::{
42    ProbeOptions, is_ffprobe_available, parse_ffprobe_json, probe_audio, probe_stream,
43    probe_stream_with_options,
44};
45pub use screenshot::{capture_screenshot, is_ffmpeg_available, sanitize_filename};
46pub use types::{
47    AudioInfo, HlsVariant, MediaInfo, VideoInfo, classify_resolution, height_to_label,
48    parse_frame_rate,
49};
50
51// Re-export libmpv backend public API.
52#[cfg(feature = "libmpv-backend")]
53pub use mpv_ffi::is_mpv_available;
54#[cfg(feature = "libmpv-backend")]
55pub use mpv_probe::{is_mpv_probe_available, probe_stream_mpv};
56#[cfg(feature = "libmpv-backend")]
57pub use mpv_screenshot::{capture_screenshot_mpv, is_mpv_screenshot_available};