#[repr(u32)]pub enum NVENCSTATUS {
Show 27 variants
NV_ENC_SUCCESS,
NV_ENC_ERR_NO_ENCODE_DEVICE,
NV_ENC_ERR_UNSUPPORTED_DEVICE,
NV_ENC_ERR_INVALID_ENCODERDEVICE,
NV_ENC_ERR_INVALID_DEVICE,
NV_ENC_ERR_DEVICE_NOT_EXIST,
NV_ENC_ERR_INVALID_PTR,
NV_ENC_ERR_INVALID_EVENT,
NV_ENC_ERR_INVALID_PARAM,
NV_ENC_ERR_INVALID_CALL,
NV_ENC_ERR_OUT_OF_MEMORY,
NV_ENC_ERR_ENCODER_NOT_INITIALIZED,
NV_ENC_ERR_UNSUPPORTED_PARAM,
NV_ENC_ERR_LOCK_BUSY,
NV_ENC_ERR_NOT_ENOUGH_BUFFER,
NV_ENC_ERR_INVALID_VERSION,
NV_ENC_ERR_MAP_FAILED,
NV_ENC_ERR_NEED_MORE_INPUT,
NV_ENC_ERR_ENCODER_BUSY,
NV_ENC_ERR_EVENT_NOT_REGISTERD,
NV_ENC_ERR_GENERIC,
NV_ENC_ERR_INCOMPATIBLE_CLIENT_KEY,
NV_ENC_ERR_UNIMPLEMENTED,
NV_ENC_ERR_RESOURCE_REGISTER_FAILED,
NV_ENC_ERR_RESOURCE_NOT_REGISTERED,
NV_ENC_ERR_RESOURCE_NOT_MAPPED,
NV_ENC_ERR_NEED_MORE_OUTPUT,
}
Variants§
NV_ENC_SUCCESS
NV_ENC_ERR_NO_ENCODE_DEVICE
NV_ENC_ERR_UNSUPPORTED_DEVICE
NV_ENC_ERR_INVALID_ENCODERDEVICE
NV_ENC_ERR_INVALID_DEVICE
NV_ENC_ERR_DEVICE_NOT_EXIST
NV_ENC_ERR_INVALID_PTR
NV_ENC_ERR_INVALID_EVENT
NV_ENC_ERR_INVALID_PARAM
NV_ENC_ERR_INVALID_CALL
NV_ENC_ERR_OUT_OF_MEMORY
NV_ENC_ERR_ENCODER_NOT_INITIALIZED
NV_ENC_ERR_UNSUPPORTED_PARAM
NV_ENC_ERR_LOCK_BUSY
NV_ENC_ERR_NOT_ENOUGH_BUFFER
NV_ENC_ERR_INVALID_VERSION
NV_ENC_ERR_MAP_FAILED
NV_ENC_ERR_NEED_MORE_INPUT
NV_ENC_ERR_ENCODER_BUSY
NV_ENC_ERR_EVENT_NOT_REGISTERD
NV_ENC_ERR_GENERIC
NV_ENC_ERR_INCOMPATIBLE_CLIENT_KEY
NV_ENC_ERR_UNIMPLEMENTED
NV_ENC_ERR_RESOURCE_REGISTER_FAILED
NV_ENC_ERR_RESOURCE_NOT_REGISTERED
NV_ENC_ERR_RESOURCE_NOT_MAPPED
NV_ENC_ERR_NEED_MORE_OUTPUT
Implementations§
source§impl NVENCSTATUS
impl NVENCSTATUS
sourcepub fn result(self, encoder: &Encoder) -> Result<(), EncodeError>
pub fn result(self, encoder: &Encoder) -> Result<(), EncodeError>
Convert an NVENCSTATUS
to a Result
.
NVENCSTATUS::NV_ENC_SUCCESS
is converted to Ok(())
,
and all other variants are mapped to the corresponding variant
in ErrorKind
. The error type is EncodeError
which has
a kind and an optional String
which might contain additional
information about the error.
Errors
Returns an error whenever the status is not
NVENCSTATUS::NV_ENC_SUCCESS
.
Examples
let encoder = Encoder::initialize_with_cuda(cuda_device).unwrap();
// Cause an error by passing in an invalid GUID.
// `Encoder::get_supported_input_formats()` uses `.result()` internally
let error = encoder
.get_supported_input_formats(GUID::default())
.unwrap_err();
// Get the kind.
assert_eq!(error.kind(), ErrorKind::InvalidParam);
// Get the error message.
// Unfortunately, it's not always helpful.
assert_eq!(error.string(), Some("EncodeAPI Internal Error."));
sourcepub fn result_without_string(self) -> Result<(), EncodeError>
pub fn result_without_string(self) -> Result<(), EncodeError>
Convert an NVENCSTATUS
to a Result
without
using an Encoder
.
This function is the same as NVENCSTATUS::result
except
it does not get the error string because it does not have access
to an Encoder
. This is only useful if you do not have an Encoder
yet, for example when initializing the API.
You should always prefer to use NVENCSTATUS::result
when possible.
Errors
Returns an error whenever the status is not
NVENCSTATUS::NV_ENC_SUCCESS
.
Trait Implementations§
source§impl Clone for _NVENCSTATUS
impl Clone for _NVENCSTATUS
source§fn clone(&self) -> _NVENCSTATUS
fn clone(&self) -> _NVENCSTATUS
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for _NVENCSTATUS
impl Debug for _NVENCSTATUS
source§impl From<_NVENCSTATUS> for ErrorKind
impl From<_NVENCSTATUS> for ErrorKind
source§fn from(status: NVENCSTATUS) -> Self
fn from(status: NVENCSTATUS) -> Self
source§impl Hash for _NVENCSTATUS
impl Hash for _NVENCSTATUS
source§impl Ord for _NVENCSTATUS
impl Ord for _NVENCSTATUS
source§fn cmp(&self, other: &_NVENCSTATUS) -> Ordering
fn cmp(&self, other: &_NVENCSTATUS) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<_NVENCSTATUS> for _NVENCSTATUS
impl PartialEq<_NVENCSTATUS> for _NVENCSTATUS
source§fn eq(&self, other: &_NVENCSTATUS) -> bool
fn eq(&self, other: &_NVENCSTATUS) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<_NVENCSTATUS> for _NVENCSTATUS
impl PartialOrd<_NVENCSTATUS> for _NVENCSTATUS
source§fn partial_cmp(&self, other: &_NVENCSTATUS) -> Option<Ordering>
fn partial_cmp(&self, other: &_NVENCSTATUS) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more