#![cfg(test)]
#![allow(
clippy::unwrap_used,
clippy::expect_used,
clippy::print_stderr,
reason = "unit tests may unwrap"
)]
use super::*;
use crate::VideoOutputPreference;
use mediaway_common::{CodecKind, PixelFormat, Rational};
#[test]
fn open_vaapi_h264_cpu_or_skip() {
let cfg = VideoDecoderConfig {
codec: CodecKind::H264,
width: 64,
height: 64,
time_base: Rational::new(1, 30),
pixel_format: PixelFormat::Nv12,
output: VideoOutputPreference::CpuFramesOk,
gpu_device: None,
extra_data: Bytes::new(),
};
let mut dec = match LinuxVideoDecoder::open(&cfg) {
Ok(d) => d,
Err(e) => {
eprintln!("skip: no VA-API display available ({e:?})");
return;
}
};
dec.flush().expect("flush without packets");
assert!(dec.poll_frame().expect("poll").is_none());
}