Skip to main content

mediadecode/
lib.rs

1#![doc = include_str!("../README.md")]
2#![cfg_attr(not(feature = "std"), no_std)]
3#![cfg_attr(docsrs, feature(doc_cfg))]
4#![cfg_attr(docsrs, allow(unused_attributes))]
5#![deny(missing_docs)]
6#![forbid(unsafe_code)]
7#![allow(clippy::type_complexity)]
8
9// Workspace pattern (mirrors mediatime / colconv / scenesdetect) — alias
10// `alloc` as `std` so `std::vec::Vec` etc. resolves in alloc-only builds.
11// `unused_extern_crates` is suppressed because the public API currently
12// uses only `core::` paths.
13#[cfg(all(not(feature = "std"), feature = "alloc"))]
14#[allow(unused_extern_crates)]
15extern crate alloc as std;
16
17// Test-only re-extern with `#[macro_use]` so `#[cfg(test)]` modules
18// can use `vec!` / `format!` / `write!` under
19// `--no-default-features --features alloc` (the std prelude that
20// normally provides those macros is gone). `#[macro_use]` on the
21// non-test alias would be flagged as `unused_imports` by `-Dwarnings`
22// because the lib code itself doesn't use the macros — keeping it
23// `cfg(test)`-scoped sidesteps that lint.
24#[cfg(all(test, not(feature = "std"), feature = "alloc"))]
25#[allow(unused_extern_crates)]
26#[macro_use]
27extern crate alloc as alloc_test_macros;
28
29#[cfg(feature = "std")]
30extern crate std;
31
32pub mod adapter;
33pub mod cfa;
34pub mod channel;
35pub mod color;
36pub mod decoder;
37pub mod frame;
38pub mod packet;
39pub mod pixel_format;
40pub mod subtitle;
41
42#[cfg(feature = "future")]
43#[cfg_attr(docsrs, doc(cfg(feature = "future")))]
44pub mod future;
45
46pub use pixel_format::PixelFormat;
47
48// Re-export the time primitives so consumers don't have to add a
49// separate `mediatime` dependency.
50pub use mediatime::{TimeRange, Timebase, Timestamp};