ioctl: use the type field to determine FrmIvalTypes and FrmSizeTypes am: dadf07ac58
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/v4l2r/+/3364191
Change-Id: Ie6e661de734c8ba70194f056d92648454a37d72e
Signed-off-by: Automerger Merge Worker <[email protected]>
diff --git a/lib/src/ioctl/frameintervals.rs b/lib/src/ioctl/frameintervals.rs
index b1b5ebf..e817e6e 100644
--- a/lib/src/ioctl/frameintervals.rs
+++ b/lib/src/ioctl/frameintervals.rs
@@ -15,11 +15,11 @@
impl v4l2_frmivalenum {
/// Safely access the intervals member of the struct based on the
- /// returned index.
+ /// returned type.
pub fn intervals(&self) -> Option<FrmIvalTypes> {
- match self.index {
+ match self.type_ {
// SAFETY: the member of the union that gets used by the driver
- // is determined by the index
+ // is determined by the type
bindings::v4l2_frmivaltypes_V4L2_FRMIVAL_TYPE_DISCRETE => {
Some(FrmIvalTypes::Discrete(unsafe {
&self.__bindgen_anon_1.discrete
@@ -27,7 +27,7 @@
}
// SAFETY: the member of the union that gets used by the driver
- // is determined by the index
+ // is determined by the type
bindings::v4l2_frmivaltypes_V4L2_FRMIVAL_TYPE_CONTINUOUS
| bindings::v4l2_frmivaltypes_V4L2_FRMIVAL_TYPE_STEPWISE => {
Some(FrmIvalTypes::StepWise(unsafe {
diff --git a/lib/src/ioctl/framesizes.rs b/lib/src/ioctl/framesizes.rs
index f6f8aa3..3ca459f 100644
--- a/lib/src/ioctl/framesizes.rs
+++ b/lib/src/ioctl/framesizes.rs
@@ -15,11 +15,11 @@
impl v4l2_frmsizeenum {
/// Safely access the size member of the struct based on the
- /// returned index.
+ /// returned type.
pub fn size(&self) -> Option<FrmSizeTypes> {
- match self.index {
+ match self.type_ {
// SAFETY: the member of the union that gets used by the driver
- // is determined by the index
+ // is determined by the type
bindings::v4l2_frmsizetypes_V4L2_FRMSIZE_TYPE_DISCRETE => {
Some(FrmSizeTypes::Discrete(unsafe {
&self.__bindgen_anon_1.discrete
@@ -27,7 +27,7 @@
}
// SAFETY: the member of the union that gets used by the driver
- // is determined by the index
+ // is determined by the type
bindings::v4l2_frmsizetypes_V4L2_FRMSIZE_TYPE_CONTINUOUS
| bindings::v4l2_frmsizetypes_V4L2_FRMSIZE_TYPE_STEPWISE => {
Some(FrmSizeTypes::StepWise(unsafe {