mod audio;
mod enums;
mod errors;
mod presets;
mod video;
#[cfg(feature = "f16-pixel-type")]
use half::f16;
#[cfg(test)]
mod tests;
pub unsafe trait Component {
fn is_valid(format: VideoFormat) -> bool;
}
unsafe impl Component for u8 {
#[inline]
fn is_valid(format: VideoFormat) -> bool {
format.sample_type == SampleType::Integer && format.bytes_per_sample == 1
}
}
unsafe impl Component for u16 {
#[inline]
fn is_valid(format: VideoFormat) -> bool {
format.sample_type == SampleType::Integer && format.bytes_per_sample == 2
}
}
unsafe impl Component for u32 {
#[inline]
fn is_valid(format: VideoFormat) -> bool {
format.sample_type == SampleType::Integer && format.bytes_per_sample == 4
}
}
#[cfg(feature = "f16-pixel-type")]
unsafe impl Component for f16 {
#[inline]
fn is_valid(format: VideoFormat) -> bool {
format.sample_type == SampleType::Float && format.bytes_per_sample == 2
}
}
unsafe impl Component for f32 {
#[inline]
fn is_valid(format: VideoFormat) -> bool {
format.sample_type == SampleType::Float && format.bytes_per_sample == 4
}
}
pub use audio::{AudioFormat, AudioFormatBuilder, AudioInfo};
pub use enums::{ChannelLayout, ColorFamily, MediaType, SampleType};
pub use errors::FormatError;
pub use presets::PresetVideoFormat;
pub use video::{VideoFormat, VideoFormatBuilder, VideoInfo};