[MPlayer-dev-eng] [PATCH] Fix conversion for v4l2 video controls

Vladimir Voroshilov voroshil at gmail.com
Mon Sep 17 12:59:27 CEST 2007


Hi, Trent

2007/9/17, Trent Piepho <xyzzy at speakeasy.org>:
> On Sun, 16 Sep 2007, Vladimir Voroshilov wrote:
> > Hi, All
> >
> > I hve found some trange conversion in v4l2's set(get)_control
> >
> > It converts (0-50) range to drivers' (min-default) and (50-100) to
> > (default-max).
> > (The same is doing for (-100-0) and (0-100) ranges).
> >
> > Attached patch changes conversion to (0-100) -> (min-max)
> >
> > Otherwise one of ranges is unsuable for cases when default==min or
> > default==max (and even cause devision by zero error).
> >
> > I'll apply it in two days if nobody will say something against.
>
> mplayer default value for all the controls is 50, so if you change it so 50
> is no longer the v4l2 default, then the two won't match.
>
> This will cause a problem with the common cx23880 chip.  The contrast range
> for this chip is 0% to 400%, instead of the more common 0% to 200%.  The
> v4l2 control ranges from 0 to 255 with a default value of 63.  mplayer
> handles this nicely now, as the mplayer control value of 50 gives you the
> default 100% contrast with the cx88 driver and with other drivers too.
> After your change, 50 will give you 200% contrast with cx88 but still 100%
> with other drivers.
>
> The default control value is information the driver is providing about how
> to use the hardware, so by ignoring it you're not supporting the hardware
> as well as you could.
>
> I think it would be a lot better if you just checked for default==min or
> default==max and used the full range in that case, and kept the current
> behavior when min<default<max.

Thank for detailed info.
I was wrong. Division by zero can happen only if value<minimum or value>maximum.
So my patch is not needed.
Sorry to disturb you.


-- 
Regards,
Vladimir Voroshilov     mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719



More information about the MPlayer-dev-eng mailing list