On Tuesday 27 January 2009 19:30:18 Trent Piepho wrote:
> On Tue, 27 Jan 2009, Hans Verkuil wrote:
> > On Tuesday 27 January 2009 19:08:43 Trent Piepho wrote:
> > > On Tue, 27 Jan 2009, Hans Verkuil wrote:
> > > > > [Shah, Hardik] Hi Hans,
> > > > > I got your above point.  Now regarding the enum I am not sure
> > > > > about how to implement it.  Are you suggesting me to remove the
> > > > > control ID for rotation and implement in some other way.  Please
> > > > > let me know if I am missing something. Currently in driver I have
> > > > > implemented the rotation in below way {
> > > > >                 .id            = V4L2_CID_ROTATION,
> > > > >                 .name          = "Rotation",
> > > > >                 .minimum       = 0,
> > > > >                 .maximum       = 270,
> > > > >                 .step          = 90,
> > > > >                 .default_value = -1,
> > > > >                 .flags         = 0,
> > > > >                 .type          = V4L2_CTRL_TYPE_INTEGER,
> > > > > You want me to change V4L2_CTRL_TYPE_INTEGER to some enum or
> > > > > something.
> > > >
> > > > Change it to V4L2_CTRL_TYPE_MENU. See:
> > > > http://www.linuxtv.org/downloads/video4linux/API/V4L2_API/spec-sing
> > > >le/v 4l2.html#VIDIOC-QUERYCTRL
> > >
> > > Thinking about it more, I think an integer control like this might
> > > make more sense.  default_value should be changed to 0 of course. 
> > > Extracting the real meaning from the control setting is more obvious
> > > for the integer control than a menu.  And what if some hardware
> > > allows for rotations other than 90 degrees?
> >
> > If the hardware can do rotations other than 90 degrees then we get into
> > the area of video effects. In principle such a driver can implement
> > this rotation control as an integer rather than a menu (apps are
> > supposed to query the type of a control dynamically, after all). But
> > for a case like this where there are only four values I think a
> > menu-type control is much more user-friendly.
>
> How so?  An application can easily tell from the range and step of the
> integer control that there are only four values.  And it can easily tell
> what the values mean.  For instance if the app wants to show icons for
> the rotations or have a command line parameter "rotation in degrees",
> it's easy to figure out what value the control should be set to.  For a
> menu, what is the app supposed to do?  Call atoi() on the menu entry
> names and hope that they parse corretly?  Seems like a kludge to do that.

In the case of menus each possible menu item always corresponds with an enum 
defined in videodev2.h. So it is no problem doing what you want with a 
menu.

That said, it is a good point that you can use an integer with an 
appropriate step size. I'd forgotten about that. Hmm, I really have no 
preference. Let's keep it as an integer after all.

Regards,

        Hans

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to