Skip to main content

rave_nvcodec/
nvdec_stub.rs

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