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 macros;
72pub(crate) mod utils;
73
74fn init_error() {
75    util::error::register_all();
76}
77
78#[cfg(not(feature = "format"))]
79fn init_format() {}
80
81#[cfg(feature = "device")]
82fn init_device() {
83    device::register_all();
84}
85
86#[cfg(not(feature = "device"))]
87fn init_device() {}
88
89#[cfg(all(feature = "filter", not(feature = "ffmpeg_5_0")))]
90fn init_filter() {
91    filter::register_all();
92}
93
94#[cfg(not(feature = "filter"))]
95fn init_filter() {}
96
97pub fn init() -> Result<(), Error> {
98    init_error();
99    init_device();
100    #[cfg(not(feature = "ffmpeg_5_0"))]
101    init_filter();
102
103    Ok(())
104}