| 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 ] |
| 7 | extern crate bitflags; |
| 8 | pub extern crate ffmpeg_sys_next as sys; |
| 9 | #[cfg (feature = "image" )] |
| 10 | extern crate image; |
| 11 | extern crate libc; |
| 12 | |
| 13 | pub use sys as ffi; |
| 14 | |
| 15 | #[macro_use ] |
| 16 | pub mod util; |
| 17 | pub use util::channel_layout::{self, ChannelLayout}; |
| 18 | pub use util::chroma; |
| 19 | pub use util::color; |
| 20 | pub use util::dictionary; |
| 21 | pub use util::dictionary::Mut as DictionaryMut; |
| 22 | pub use util::dictionary::Owned as Dictionary; |
| 23 | pub use util::dictionary::Ref as DictionaryRef; |
| 24 | pub use util::error::{self, Error}; |
| 25 | pub use util::frame::{self, Frame}; |
| 26 | pub use util::log; |
| 27 | pub use util::mathematics::{self, rescale, Rescale, Rounding}; |
| 28 | pub use util::media; |
| 29 | pub use util::option; |
| 30 | pub use util::picture; |
| 31 | pub use util::rational::{self, Rational}; |
| 32 | pub use util::time; |
| 33 | |
| 34 | #[cfg (feature = "format" )] |
| 35 | pub mod format; |
| 36 | #[cfg (feature = "format" )] |
| 37 | pub use format::chapter::{Chapter, ChapterMut}; |
| 38 | #[cfg (feature = "format" )] |
| 39 | pub use format::format::Format; |
| 40 | #[cfg (feature = "format" )] |
| 41 | pub use format::stream::{Stream, StreamMut}; |
| 42 | |
| 43 | #[cfg (feature = "codec" )] |
| 44 | pub mod codec; |
| 45 | #[cfg (feature = "codec" )] |
| 46 | pub use codec::audio_service::AudioService; |
| 47 | #[cfg (feature = "codec" )] |
| 48 | pub use codec::codec::Codec; |
| 49 | #[cfg (feature = "codec" )] |
| 50 | pub use codec::discard::Discard; |
| 51 | #[cfg (feature = "codec" )] |
| 52 | pub use codec::field_order::FieldOrder; |
| 53 | #[cfg (feature = "codec" )] |
| 54 | pub use codec::packet::{self, Packet}; |
| 55 | #[cfg (all(feature = "codec" , not(feature = "ffmpeg_5_0" )))] |
| 56 | pub use codec::picture::Picture; |
| 57 | #[cfg (feature = "codec" )] |
| 58 | pub use codec::subtitle::{self, Subtitle}; |
| 59 | #[cfg (feature = "codec" )] |
| 60 | pub use codec::threading; |
| 61 | #[cfg (feature = "codec" )] |
| 62 | pub use codec::{decoder, encoder}; |
| 63 | |
| 64 | #[cfg (feature = "device" )] |
| 65 | pub mod device; |
| 66 | |
| 67 | #[cfg (feature = "filter" )] |
| 68 | pub mod filter; |
| 69 | #[cfg (feature = "filter" )] |
| 70 | pub use filter::Filter; |
| 71 | |
| 72 | pub mod software; |
| 73 | |
| 74 | fn init_error() { |
| 75 | util::error::register_all(); |
| 76 | } |
| 77 | |
| 78 | #[cfg (all(feature = "format" , not(feature = "ffmpeg_5_0" )))] |
| 79 | fn init_format() { |
| 80 | format::register_all(); |
| 81 | } |
| 82 | |
| 83 | #[cfg (not(feature = "format" ))] |
| 84 | fn init_format() {} |
| 85 | |
| 86 | #[cfg (feature = "device" )] |
| 87 | fn init_device() { |
| 88 | device::register_all(); |
| 89 | } |
| 90 | |
| 91 | #[cfg (not(feature = "device" ))] |
| 92 | fn init_device() {} |
| 93 | |
| 94 | #[cfg (all(feature = "filter" , not(feature = "ffmpeg_5_0" )))] |
| 95 | fn init_filter() { |
| 96 | filter::register_all(); |
| 97 | } |
| 98 | |
| 99 | #[cfg (not(feature = "filter" ))] |
| 100 | fn 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 | )] |
| 109 | pub 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 | |