Skip to main content

GpuVideoFrame

Enum GpuVideoFrame 

Source
#[non_exhaustive]
pub enum GpuVideoFrame { }

Implementations§

Source§

impl GpuVideoFrame

Source

pub fn backend(&self) -> GpuBackend

Source

pub fn dimensions(&self) -> (u32, u32)

Source

pub fn pts(&self) -> Option<i64>

Source

pub fn estimated_rgba_bytes(&self) -> u64

Examples found in repository?
examples/decode_file.rs (line 119)
102fn receive_frame(
103    decoder: &mut VideoDecoder,
104    mode: DecodeMode,
105    receive: ReceiveMode,
106    cuda: Option<&mut CudaRgbaState>,
107) -> lumen_ffmpeg::Result<Option<usize>> {
108    match receive {
109        ReceiveMode::Rgba => Ok(decoder.receive_rgba_frame()?.map(|frame| frame.data.len())),
110        ReceiveMode::CudaRgba => match decoder.receive_gpu_frame()? {
111            Some(frame) => {
112                let Some(cuda) = cuda else {
113                    return Err(lumen_ffmpeg::FfmpegError::new(
114                        "decode_file",
115                        "cuda-rgba receive mode requires a CUDA conversion state",
116                    ));
117                };
118                cuda.convert(&frame)?;
119                Ok(Some(frame.estimated_rgba_bytes() as usize))
120            }
121            None => Ok(None),
122        },
123        ReceiveMode::Gpu => match mode {
124            DecodeMode::Cpu => Ok(decoder.receive_cpu_frame()?.map(|frame| frame.data.len())),
125            DecodeMode::Gpu(_) => Ok(decoder.receive_gpu_frame()?.map(|_| 0)),
126        },
127    }
128}

Trait Implementations§

Source§

impl Debug for GpuVideoFrame

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.