playa_ffmpeg/util/mod.rs
1//! Core utilities and data structures.
2//!
3//! This module provides fundamental types and utilities used throughout the library.
4//! It wraps FFmpeg's `libavutil` library.
5//!
6//! # Main Components
7//!
8//! - [`frame`] - Raw audio/video frames (decoded data)
9//! - [`error`] - Error types and error handling
10//! - [`dictionary`] - Key-value metadata and options
11//! - [`rational`] - Rational number representation for timestamps/framerates
12//! - [`channel_layout`] - Audio channel layouts (stereo, 5.1, etc.)
13//! - [`color`] - Color space and color primaries
14//! - [`mod@format`] - Pixel and sample formats
15//! - [`mathematics`] - Mathematical utilities (rescaling, rounding)
16//! - [`time`] - Time representation and conversion
17//! - [`mod@log`] - Logging configuration and levels
18
19#[macro_use]
20pub mod dictionary;
21pub mod chroma;
22pub mod color;
23pub mod error;
24pub mod format;
25pub mod frame;
26pub mod interrupt;
27pub mod log;
28pub mod mathematics;
29pub mod media;
30pub mod option;
31pub mod picture;
32pub mod range;
33pub mod rational;
34pub mod time;
35
36#[cfg_attr(feature = "ffmpeg_7_0", path = "channel_layout.rs")]
37#[cfg_attr(not(feature = "ffmpeg_7_0"), path = "legacy_channel_layout.rs")]
38pub mod channel_layout;
39
40use std::{ffi::CStr, str::from_utf8_unchecked};
41
42use crate::ffi::*;
43
44/// Returns the libavutil version number.
45///
46/// The version is encoded as `(major << 16) | (minor << 8) | micro`.
47#[inline(always)]
48pub fn version() -> u32 {
49 unsafe { avutil_version() }
50}
51
52/// Returns the libavutil build configuration string.
53///
54/// Shows compile-time options used when building FFmpeg's utility library.
55#[inline(always)]
56pub fn configuration() -> &'static str {
57 unsafe { from_utf8_unchecked(CStr::from_ptr(avutil_configuration()).to_bytes()) }
58}
59
60/// Returns the libavutil license string.
61///
62/// Typically "LGPL version 2.1 or later" unless built with GPL components.
63#[inline(always)]
64pub fn license() -> &'static str {
65 unsafe { from_utf8_unchecked(CStr::from_ptr(avutil_license()).to_bytes()) }
66}