v4l2_frmsize_stepwise structure contains misnamed member

Bug #1760718 reported by Justin Gottula
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-v4l2
New
Undecided
Unassigned

Bug Description

v4l2.py has the following definition for the `v4l2_frmsize_stepwise` structure:

  class v4l2_frmsize_stepwise(ctypes.Structure):
      _fields_ = [
          ('min_width', ctypes.c_uint32),
          ('min_height', ctypes.c_uint32),
          ('step_width', ctypes.c_uint32),
          ('min_height', ctypes.c_uint32),
          ('max_height', ctypes.c_uint32),
          ('step_height', ctypes.c_uint32),
      ]

But the authoritative upstream C headers (see: https://git.linuxtv.org/v4l-utils.git/tree/include/linux/videodev2.h?id=v4l-utils-1.14.2#n724) have the definition for the same structure as follows:

  struct v4l2_frmsize_stepwise {
          __u32 min_width; /* Minimum frame width [pixel] */
          __u32 max_width; /* Maximum frame width [pixel] */
          __u32 step_width; /* Frame width step size [pixel] */
          __u32 min_height; /* Minimum frame height [pixel] */
          __u32 max_height; /* Maximum frame height [pixel] */
          __u32 step_height; /* Frame height step size [pixel] */
  };

Notice that the second member is supposed to be named `max_width`; not `min_height`. Also notice that in the Python structure definition, there are TWO members named `min_height` in the same structure!

This means that
(a) it's unclear whether accessing `min_height` via python-v4l2 will access the correct member; and
(b) it's impossible to actually access the `max_width` member via python-v4l2; and
(c) the python-v4l2 code here is obviously just wrong, relative to the C v4l2 headers.

So in summary: the Python structure definition for `v4l2_frmsize_stepwise` needs to be corrected to use the correct name `max_width` for its second member. I've attached a one-liner patch that applies the necessary fix.

Tags: python v4l v4l2
Revision history for this message
Justin Gottula (jgottula) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.