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
impl PixelFormat
Sourcepub fn to_c_enum(self) -> CcapPixelFormat
pub fn to_c_enum(self) -> CcapPixelFormat
Convert pixel format to C enum
Sourcepub fn from_c_enum(format: CcapPixelFormat) -> Self
pub fn from_c_enum(format: CcapPixelFormat) -> Self
Create pixel format from C enum
Sourcepub fn as_str(self) -> &'static str
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
impl Clone for PixelFormat
Source§fn clone(&self) -> PixelFormat
fn clone(&self) -> PixelFormat
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PixelFormat
impl Debug for PixelFormat
Source§impl From<PixelFormat> for CcapPixelFormat
impl From<PixelFormat> for CcapPixelFormat
Source§fn from(val: PixelFormat) -> Self
fn from(val: PixelFormat) -> Self
Converts to this type from the input type.
Source§impl From<u32> for PixelFormat
impl From<u32> for PixelFormat
Source§fn from(format: CcapPixelFormat) -> Self
fn from(format: CcapPixelFormat) -> Self
Converts to this type from the input type.
Source§impl PartialEq for PixelFormat
impl PartialEq for PixelFormat
impl Copy for PixelFormat
impl Eq for PixelFormat
impl StructuralPartialEq for PixelFormat
Auto Trait Implementations§
impl Freeze for PixelFormat
impl RefUnwindSafe for PixelFormat
impl Send for PixelFormat
impl Sync for PixelFormat
impl Unpin for PixelFormat
impl UnwindSafe for PixelFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more