ffmpeg_the_third/
lib.rs

1#![allow(non_camel_case_types)]
2#![allow(clippy::module_inception)]
3// FFI Types may differ across platforms, making casts necessary
4#![allow(clippy::unnecessary_cast)]
5// This lint sometimes suggests worse code. See rust-lang/rust-clippy#13514
6#![allow(clippy::needless_lifetimes)]
7// TODO: Add safety docs and remove this #[allow]
8#![allow(clippy::missing_safety_doc)]
9
10pub use ffmpeg_sys_the_third as sys;
11pub use ffmpeg_sys_the_third as ffi;
12
13pub mod util;
14#[cfg(feature = "ffmpeg_5_1")]
15pub use crate::util::channel_layout::{
16    Channel, ChannelCustom, ChannelLayout, ChannelLayoutIter, ChannelOrder,
17};
18pub use crate::util::{
19    channel_layout::{self, ChannelLayoutMask},
20    chroma, color, dictionary,
21    dictionary::Mut as DictionaryMut,
22    dictionary::Owned as Dictionary,
23    dictionary::Ref as DictionaryRef,
24    error::{self, Error},
25    frame::{self, Frame},
26    log,
27    mathematics::{self, rescale, Rescale, Rounding},
28    media, option, picture,
29    rational::{self, Rational},
30    time,
31};
32
33#[cfg(feature = "format")]
34pub mod format;
35#[cfg(feature = "format")]
36pub use crate::format::{
37    chapter::{Chapter, ChapterMut},
38    stream::{Stream, StreamMut},
39};
40
41#[cfg(feature = "codec")]
42pub mod codec;
43#[cfg(all(feature = "codec", not(feature = "ffmpeg_5_0")))]
44pub use crate::codec::picture::Picture;
45#[cfg(feature = "codec")]
46pub use crate::codec::{
47    audio_service::AudioService,
48    codec::Codec,
49    decoder,
50    discard::Discard,
51    encoder,
52    field_order::FieldOrder,
53    packet::{self, Packet},
54    subtitle::{self, Subtitle},
55    threading,
56};
57
58#[cfg(feature = "device")]
59pub mod device;
60
61#[cfg(feature = "filter")]
62pub mod filter;
63#[cfg(feature = "filter")]
64pub use crate::filter::Filter;
65
66pub mod software;
67
68mod as_ptr;
69pub use as_ptr::{AsMutPtr, AsPtr};
70
71pub(crate) mod iters;
72pub(crate) mod macros;
73pub(crate) mod utils;
74
75fn init_error() {
76    util::error::register_all();
77}
78
79#[cfg(not(feature = "format"))]
80fn init_format() {}
81
82#[cfg(feature = "device")]
83fn init_device() {
84    device::register_all();
85}
86
87#[cfg(not(feature = "device"))]
88fn init_device() {}
89
90#[cfg(all(feature = "filter", not(feature = "ffmpeg_5_0")))]
91fn init_filter() {
92    filter::register_all();
93}
94
95#[cfg(not(feature = "filter"))]
96fn init_filter() {}
97
98pub fn init() -> Result<(), Error> {
99    init_error();
100    init_device();
101    #[cfg(not(feature = "ffmpeg_5_0"))]
102    init_filter();
103
104    Ok(())
105}