PixelFormat

Enum PixelFormat 

Source
pub enum PixelFormat {
Show 13 variants Unknown, Nv12, Nv12F, I420, I420F, Yuyv, YuyvF, Uyvy, UyvyF, Rgb24, Bgr24, Rgba32, Bgra32,
}
Expand description

Pixel format enumeration

Variants§

§

Unknown

Unknown pixel format

§

Nv12

NV12 pixel format

§

Nv12F

NV12F pixel format

§

I420

I420 pixel format

§

I420F

I420F pixel format

§

Yuyv

YUYV pixel format

§

YuyvF

YUYV flipped pixel format

§

Uyvy

UYVY pixel format

§

UyvyF

UYVY flipped pixel format

§

Rgb24

RGB24 pixel format

§

Bgr24

BGR24 pixel format

§

Rgba32

RGBA32 pixel format

§

Bgra32

BGRA32 pixel format

Implementations§

Source§

impl PixelFormat

Source

pub fn to_c_enum(self) -> CcapPixelFormat

Convert pixel format to C enum

Source

pub fn from_c_enum(format: CcapPixelFormat) -> Self

Create pixel format from C enum

Source

pub fn as_str(self) -> &'static str

Get string representation of pixel format

Examples found in repository?
examples/print_camera.rs (line 46)
20fn print_camera_info(device_name: &str) -> Result<()> {
21    Utils::set_log_level(LogLevel::Verbose);
22
23    // Create provider with specific device name
24    let provider = match Provider::with_device_name(device_name) {
25        Ok(p) => p,
26        Err(e) => {
27            eprintln!(
28                "### Failed to create provider for device: {}, error: {}",
29                device_name, e
30            );
31            return Ok(());
32        }
33    };
34
35    match provider.device_info() {
36        Ok(device_info) => {
37            println!("===== Info for device: {} =======", device_name);
38
39            println!("  Supported resolutions:");
40            for resolution in &device_info.supported_resolutions {
41                println!("    {}x{}", resolution.width, resolution.height);
42            }
43
44            println!("  Supported pixel formats:");
45            for format in &device_info.supported_pixel_formats {
46                println!("    {}", format.as_str());
47            }
48
49            println!("===== Info end =======\n");
50        }
51        Err(e) => {
52            eprintln!(
53                "Failed to get device info for: {}, error: {}",
54                device_name, e
55            );
56        }
57    }
58
59    Ok(())
60}

Trait Implementations§

Source§

impl Clone for PixelFormat

Source§

fn clone(&self) -> PixelFormat

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PixelFormat

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<PixelFormat> for CcapPixelFormat

Source§

fn from(val: PixelFormat) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for PixelFormat

Source§

fn from(format: CcapPixelFormat) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for PixelFormat

Source§

fn eq(&self, other: &PixelFormat) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for PixelFormat

Source§

impl Eq for PixelFormat

Source§

impl StructuralPartialEq for PixelFormat

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.