[FFmpeg-devel] [PATCH 2/2] v4l2: allow to set device controls.

Michael Niedermayer michaelni at gmx.at
Sun Apr 7 20:38:57 CEST 2013


On Sun, Apr 07, 2013 at 07:57:18PM +0200, Giorgio Vazzana wrote:
> 2013/4/1 Nicolas George <nicolas.george at normalesup.org>
> >
> > L'octidi 8 germinal, an CCXXI, Giorgio Vazzana a écrit :
> > > >      int list_format;    /**< Set by a private option. */
> > > >      int list_standard;  /**< Set by a private option. */
> > > >      char *framerate;    /**< Set by a private option. */
> > > > +    char *controls;
> > > nit: maybe use the same comment as above? "/**< Set by a private option. */"
> >
> > The comment seemed a bit useless to me, but I have no strong objection.
> >
> > > "v4l2_ioctl" instead of "ioctl" to make libv4l2 happy :)
> >
> > Locally changed.
> >
> > > V4L2_CTRL_TYPE_BITMASK was added in linux 3.1, I get an error here on
> > > 2.6.32. Maybe add something like:
> > >
> > > #ifdef V4L2_CTRL_TYPE_BITMASK
> > >         case V4L2_CTRL_TYPE_BITMASK:
> > > #endif
> >
> > It will not work: V4L2_CTRL_TYPE_* are enums, not macros.
> 
> Yes, sorry, I didn't think they were enums of course.
> 
> > I do not find a
> > relevant VERSION macro that could be used for testing :(
> 
> From a quick look neither did I... we could probably comment it until
> we find a proper way to deal with it.
> 
> > > The rest would LGTM, except that I cannot compile it:
> > >
> > > holden at rye:~/src/ffmpeg$ uname -a
> > > Linux rye 2.6.32-46-generic #105-Ubuntu SMP Fri Mar 1 00:04:17 UTC
> > > 2013 x86_64 GNU/Linux
> > >
> > > holden at rye:~/src/ffmpeg$ gcc --version
> > > gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3
> > > Copyright (C) 2009 Free Software Foundation, Inc.
> > > This is free software; see the source for copying conditions.  There is NO
> > > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> > >
> > <snip error>
> > >
> > > I see we're using -std=c99, but I think anonymous unions are not
> > > supported in c99?
> > >
> > > holden at rye:~/tmp$ cat v4l2_control.c
> > > #include <stdio.h>
> > > #include <linux/videodev2.h>
> > >
> > > int main()
> > > {
> > >       struct v4l2_ext_control ec;
> > >
> > >       ec.id      = 0;
> > >       ec.size    = 0;
> > >       ec.value   = 0;
> > >       ec.value64 = 0;
> > >       ec.string  = NULL;
> > >
> > >       return 0;
> > > }
> > >
> > > holden at rye:~/tmp$ gcc -Wall -std=c99 v4l2_control.c
> > > v4l2_control.c: In function ‘main’:
> > > v4l2_control.c:10: error: ‘struct v4l2_ext_control’ has no member named ‘value’
> > > v4l2_control.c:11: error: ‘struct v4l2_ext_control’ has no member
> > > named ‘value64’
> > > v4l2_control.c:12: error: ‘struct v4l2_ext_control’ has no member named ‘string’
> > >
> > > holden at rye:~/tmp$ gcc -Wall -std=gnu89 v4l2_control.c
> >
> > That works for me with -std=c99 and gcc (Debian 4.7.2-5) 4.7.2. I wonder
> > which version is right, and if there is an easy way of solving the issue.
> 
> Me too. I have searched around for a solution but did not find any...
> apart from using -std=gnu89 of course. Maybe Michael or someone else
> has a suggestion? Thanks.

a better struct could be written and used or AV_R/WNxy() could be
used
these assume that the structs layout doesnt change 

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130407/78e00913/attachment.asc>


More information about the ffmpeg-devel mailing list