Skip to main content

codec/encode/
qsv_stub.rs

1//! Stub Intel QSV encoder, compiled when the `qsv` feature is **off**.
2//!
3//! Keeps `qsv::QsvEncoder` a real type so the dispatcher in
4//! `encode/mod.rs` compiles unchanged, but construction always errors —
5//! auto-select then skips the Intel tier, and an explicit
6//! `EncoderBackend::Qsv` request surfaces the error. Enable `--features
7//! qsv` to compile the real oneVPL-backed encoder (`qsv.rs`).
8
9use anyhow::{Result, bail};
10
11use super::{EncodedPacket, Encoder, EncoderConfig};
12use crate::frame::VideoFrame;
13
14pub struct QsvEncoder;
15
16impl QsvEncoder {
17    pub fn new(_config: EncoderConfig, _gpu_index: u32) -> Result<Self> {
18        bail!(
19            "QSV (Intel oneVPL) encode support was not compiled in; \
20             rebuild with the `qsv` feature enabled to use Intel hardware encode"
21        )
22    }
23}
24
25impl Encoder for QsvEncoder {
26    fn send_frame(&mut self, _frame: &VideoFrame) -> Result<()> {
27        unreachable!("stub QSV encoder is never constructed")
28    }
29    fn flush(&mut self) -> Result<()> {
30        unreachable!("stub QSV encoder is never constructed")
31    }
32    fn receive_packet(&mut self) -> Result<Option<EncodedPacket>> {
33        unreachable!("stub QSV encoder is never constructed")
34    }
35}