Skip to main content

rave_nvcodec/
nvdec_stub.rs

1//! CPU-only stub for builds without NVDEC/NVENC system dependencies.
2
3use std::sync::Arc;
4
5use rave_core::codec_traits::{BitstreamSource, DecodedFrame, FrameDecoder};
6use rave_core::context::GpuContext;
7use rave_core::error::{EngineError, Result};
8use rave_core::ffi_types::cudaVideoCodec as CoreCodec;
9
10/// Stub NVDEC decoder used when `rave_nvcodec_stub` cfg is active.
11pub struct NvDecoder;
12
13impl NvDecoder {
14    pub fn new(
15        ctx: Arc<GpuContext>,
16        source: Box<dyn BitstreamSource>,
17        codec: CoreCodec,
18    ) -> Result<Self> {
19        let _ = (ctx, source, codec);
20        Err(EngineError::Decode(
21            "rave-nvcodec built in stub mode: NVDEC is unavailable on this build host".into(),
22        ))
23    }
24}
25
26impl FrameDecoder for NvDecoder {
27    fn decode_next(&mut self) -> Result<Option<DecodedFrame>> {
28        Err(EngineError::Decode(
29            "rave-nvcodec built in stub mode: NVDEC is unavailable at runtime".into(),
30        ))
31    }
32}