Trait nokhwa::FormatDecoder
source · pub trait FormatDecoder: Clone + Sized + Send + Sync {
type Output: Pixel<Subpixel = u8>;
const FORMATS: &'static [FrameFormat];
// Required methods
fn write_output(
fcc: FrameFormat,
resolution: Resolution,
data: &[u8]
) -> Result<Vec<u8, Global>, NokhwaError>;
fn write_output_buffer(
fcc: FrameFormat,
resolution: Resolution,
data: &[u8],
dest: &mut [u8]
) -> Result<(), NokhwaError>;
}
Expand description
Trait that has methods to convert raw data from the webcam to a proper raw image.
Required Associated Types§
Required Associated Constants§
const FORMATS: &'static [FrameFormat]
Required Methods§
sourcefn write_output(
fcc: FrameFormat,
resolution: Resolution,
data: &[u8]
) -> Result<Vec<u8, Global>, NokhwaError>
fn write_output( fcc: FrameFormat, resolution: Resolution, data: &[u8] ) -> Result<Vec<u8, Global>, NokhwaError>
Allocates and returns a Vec
Errors
If the data is malformed, or the source FrameFormat
is incompatible, this will error.
sourcefn write_output_buffer(
fcc: FrameFormat,
resolution: Resolution,
data: &[u8],
dest: &mut [u8]
) -> Result<(), NokhwaError>
fn write_output_buffer( fcc: FrameFormat, resolution: Resolution, data: &[u8], dest: &mut [u8] ) -> Result<(), NokhwaError>
Writes to a user provided buffer.
Errors
If the data is malformed, the source FrameFormat
is incompatible, or the user-alloted buffer is not large enough, this will error.