1 //! C FFI of the V4L2R crate.
2 //!
3 //! This crate provides a C API that can be used by client programs to make use
4 //! of the features exported by this crate. For now it strictly focuses on
5 //! stateful decoders.
6 
7 use log::debug;
8 
9 pub mod decoder;
10 pub mod memory;
11 
12 static INIT: std::sync::Once = std::sync::Once::new();
13 
14 /// Initialize the V4L2R library. This only sets up the proper hooks for
15 /// logging, so although it is not a hard requirement to call this function,
16 /// failure to do so will result in no logs being printed.
17 #[no_mangle]
v4l2r_init()18 pub extern "C" fn v4l2r_init() {
19     INIT.call_once(|| {
20         #[cfg(feature = "env_logger")]
21         env_logger::builder().format_timestamp(None).init();
22 
23         #[cfg(feature = "android")]
24         android_logger::init_once(
25             android_logger::Config::default().with_min_level(log::Level::Trace),
26         );
27     });
28 
29     debug!("v4l2r initialized");
30 }
31