1#![allow(non_camel_case_types)]
2#![allow(clippy::missing_safety_doc)]
3#![allow(clippy::module_inception)]
4#![allow(clippy::too_many_arguments)]
5
6#[macro_use]
7extern crate bitflags;
8pub extern crate ffmpeg_sys_next as sys;
9#[cfg(feature = "image")]
10extern crate image;
11extern crate libc;
12
13pub use sys as ffi;
14
15#[macro_use]
16pub mod util;
17pub use util::channel_layout::{self, ChannelLayout};
18pub use util::chroma;
19pub use util::color;
20pub use util::dictionary;
21pub use util::dictionary::Mut as DictionaryMut;
22pub use util::dictionary::Owned as Dictionary;
23pub use util::dictionary::Ref as DictionaryRef;
24pub use util::error::{self, Error};
25pub use util::frame::{self, Frame};
26pub use util::log;
27pub use util::mathematics::{self, rescale, Rescale, Rounding};
28pub use util::media;
29pub use util::option;
30pub use util::picture;
31pub use util::rational::{self, Rational};
32pub use util::time;
33
34#[cfg(feature = "format")]
35pub mod format;
36#[cfg(feature = "format")]
37pub use format::chapter::{Chapter, ChapterMut};
38#[cfg(feature = "format")]
39pub use format::format::Format;
40#[cfg(feature = "format")]
41pub use format::stream::{Stream, StreamMut};
42
43#[cfg(feature = "codec")]
44pub mod codec;
45#[cfg(feature = "codec")]
46pub use codec::audio_service::AudioService;
47#[cfg(feature = "codec")]
48pub use codec::codec::Codec;
49#[cfg(feature = "codec")]
50pub use codec::discard::Discard;
51#[cfg(feature = "codec")]
52pub use codec::field_order::FieldOrder;
53#[cfg(feature = "codec")]
54pub use codec::packet::{self, Packet};
55#[cfg(all(feature = "codec", not(feature = "ffmpeg_5_0")))]
56pub use codec::picture::Picture;
57#[cfg(feature = "codec")]
58pub use codec::subtitle::{self, Subtitle};
59#[cfg(feature = "codec")]
60pub use codec::threading;
61#[cfg(feature = "codec")]
62pub use codec::{decoder, encoder};
63
64#[cfg(feature = "device")]
65pub mod device;
66
67#[cfg(feature = "filter")]
68pub mod filter;
69#[cfg(feature = "filter")]
70pub use filter::Filter;
71
72pub mod software;
73
74fn init_error() {
75 util::error::register_all();
76}
77
78#[cfg(all(feature = "format", not(feature = "ffmpeg_5_0")))]
79fn init_format() {
80 format::register_all();
81}
82
83#[cfg(not(feature = "format"))]
84fn init_format() {}
85
86#[cfg(feature = "device")]
87fn init_device() {
88 device::register_all();
89}
90
91#[cfg(not(feature = "device"))]
92fn init_device() {}
93
94#[cfg(all(feature = "filter", not(feature = "ffmpeg_5_0")))]
95fn init_filter() {
96 filter::register_all();
97}
98
99#[cfg(not(feature = "filter"))]
100fn init_filter() {}
101
102#[cfg_attr(
103 any(feature = "ffmpeg4", feature = "ffmpeg41", feature = "ffmpeg42"),
104 deprecated(
105 note = "features ffmpeg4/ffmpeg41/ffmpeg42/ffmpeg43 are now auto-detected \
106 and will be removed in a future version"
107 )
108)]
109pub fn init() -> Result<(), Error> {
110 init_error();
111 #[cfg(not(feature = "ffmpeg_5_0"))]
112 init_format();
113 init_device();
114 #[cfg(not(feature = "ffmpeg_5_0"))]
115 init_filter();
116
117 Ok(())
118}
119