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 crate::util::{
18 channel_layout::{self, ChannelLayout},
19 chroma, color, dictionary,
20 dictionary::{Mut as DictionaryMut, Owned as Dictionary, Ref as DictionaryRef},
21 error::{self, Error},
22 frame::{self, Frame},
23 log,
24 mathematics::{self, Rescale, Rounding, rescale},
25 media, option, picture,
26 rational::{self, Rational},
27 time,
28};
29
30#[cfg(feature = "format")]
31pub mod format;
32#[cfg(feature = "format")]
33pub use crate::format::chapter::{Chapter, ChapterMut};
34#[cfg(feature = "format")]
35pub use crate::format::format::Format;
36#[cfg(feature = "format")]
37pub use crate::format::stream::{Stream, StreamMut};
38
39#[cfg(feature = "codec")]
40pub mod codec;
41#[cfg(feature = "codec")]
42pub use crate::codec::audio_service::AudioService;
43#[cfg(feature = "codec")]
44pub use crate::codec::codec::Codec;
45#[cfg(feature = "codec")]
46pub use crate::codec::discard::Discard;
47#[cfg(feature = "codec")]
48pub use crate::codec::field_order::FieldOrder;
49#[cfg(feature = "codec")]
50pub use crate::codec::packet::{self, Packet};
51#[cfg(all(feature = "codec", not(feature = "ffmpeg_5_0")))]
52pub use crate::codec::picture::Picture;
53#[cfg(feature = "codec")]
54pub use crate::codec::subtitle::{self, Subtitle};
55#[cfg(feature = "codec")]
56pub use crate::codec::threading;
57#[cfg(feature = "codec")]
58pub use crate::codec::{decoder, encoder};
59
60#[cfg(feature = "device")]
61pub mod device;
62
63#[cfg(feature = "filter")]
64pub mod filter;
65#[cfg(feature = "filter")]
66pub use filter::Filter;
67
68pub mod software;
69
70fn init_error() {
71 util::error::register_all();
72}
73
74#[cfg(all(feature = "format", not(feature = "ffmpeg_5_0")))]
75fn init_format() {
76 format::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
98#[cfg_attr(
99 any(feature = "ffmpeg4", feature = "ffmpeg41", feature = "ffmpeg42"),
100 deprecated(note = "features ffmpeg4/ffmpeg41/ffmpeg42/ffmpeg43 are now auto-detected \
101 and will be removed in a future version")
102)]
103pub fn init() -> Result<(), Error> {
104 init_error();
105 #[cfg(not(feature = "ffmpeg_5_0"))]
106 init_format();
107 init_device();
108 #[cfg(not(feature = "ffmpeg_5_0"))]
109 init_filter();
110
111 Ok(())
112}