[Gambas-devel] Video4Linux2 compile error svn Gambas 3 on Ubuntu Hardy 8.04

Ron_1st ronstk at ...124...
Fri Jul 24 17:45:12 CEST 2009


On Friday 24 July 2009, Benoît Minisini wrote:
> > On Monday 13 July 2009, Ron wrote:
> > > Ron wrote:
> > > > Trying to compile svn Gambas3 rev 2110 on Ubuntu 8.04
> > > >
> > > > gv4l2.c:633: error: 'V4L2_PIX_FMT_SGBRG8' undeclared (first use in
> > > > this function                           )
> > > > make[2]: Leaving directory
> > > > `/home/ron/install/gambas/trunk/trunk/gb.v4l/src'
> > > > make[1]: *** [install-recursive] Error 1
> > > > make[1]: Leaving directory
> > > > `/home/ron/install/gambas/trunk/trunk/gb.v4l' make: ***
> > > > [install-recursive] Error 1
> > > >
> > > > I found an older thread about this exact problem, where they talk
> > > > about having to comment out these defines....
> > > > Is this still needed, if so, this is not practical!
> > > >
> > > > Or do I miss a dependency?
> > >
> > > Found this new gv4l2.c by Ron_1st, see diff below, with it I can compile
> > > gambas3 succesfully.
> > > Any reason why it's not commited to svn?
> >
> > Glad to know someone can use it also. :)
> >
> > There was some discusion about a complete renew for the v4l part
> > but it looks to me it is dead.
> > I do now use vlook module from the motion webcam project. (www.lavrsen.dk)
> >
> >
> 
> Can I have the patch to insert it into Gambas 3 ?
> 

O yes, you can get it :)

The biggest change is in the gv4l2.c file

gv4l2.c is after adding my code
gv4l2.c.org is the version made by gareth in the past

The effective problem is the case statement. 

#ifdef V4L2_PIX_FMT_SBGGR16
		case V4L2_PIX_FMT_SBGGR16: 	gv4l2_debug("SBGGR16"); break;
#endif

		case V4L2_PIX_FMT_MJPEG: 	gv4l2_debug("MJPEG"); 	break;  

The V4L2_PIX_FMT_SBGGR16 constant is not in every videodev2.h released in time.
Ubuntu use a older version then Gareth(Mmandriva) and Gareth has his file included
in his code and added a line to the 'CWebcam.h' file.
This file is invalid for the runtime version for the distribution the user is using.
For my solution that line must be marked as comment.

The difference consist of two changes. 
1) I marked blocks of not supported formats as comment
2) For some formats I surround the format with a IFDEF/ENDIF to switch of
   the case line if the format is not specified in videodev2.h file. 

The best solution IMHO is to comment( or remove) all the case lines for 
not supported formats. 
Gareth was against the delete as it is valuable info about those formats 
exists for later maintenance, I agree with that too
Best regards,

So there are only two files involved in my change:
1) 'CWebcam.h', 2) 'gv4l2.c'

Code from trunk gambas3 revision ??? (~1860) in v4l2_src.tar.gz

Ron_1st


PS:
I did post about this change here in the list several times
found:
[Gambas-devel]  unknown V4L2_PIX_FMT_???? formats at 2009-01-24 18:40
[Gambas-devel] gbv4l2.c missing some V4L2_PIX_FMT_ format declaration kubunt 8.04 at 
   2009-01-28 20:04
and my patch
[Gambas-devel] gb.v4l rework the gv4l2.c at 2009-02-22 17:51
[Gambas-devel] gb.v4l rework the gv4l2.c at 2009-02-22 17:53 (gv4l2c.zip)
I do not have the mood to reread it all again. 
For me I just put "my" gv4l2.c and see what happens.
I did start a new v4l2 project but my actual split to seperate parts where
not welkom at that time.
I did need support for more as ONE camera and some with sound and/or a tuner.


Just some old brainstorm:
dim camdev as new v4ldev("BT878") 'the device from v4l2 
dim tuner1 as new v4ltuner('"DVBT") ' add the tuner
dim tuner2 as new v4ltuner('"DVBC") ' an other type tuner
dim sound1 as new v4lsound("bt878snd") ' where sound come from
  tun.channels.load=file("channels.txt") 'I want to see TV5, ARD, RTL  
  camdev.tuner=tuner1
  camdev.sound=sound1
  camdev.ctrl.load=file("control.txt") ' my default image/sound settings
  camdev.ctrl.volume=25 ' always use at start now in percent
  camdev.ctrl.brightness=50 ' same for the image

This way you could add those available parts to the device you need.
The idea was to make a general component usable for webcam and other
video/tv cards. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v4l2_src.tar.gz
Type: application/x-tgz
Size: 75983 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20090724/a0d9f09b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gv4l2.c.zip
Type: application/x-zip
Size: 6025 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20090724/a0d9f09b/attachment-0001.bin>


More information about the Devel mailing list