[Gambas-devel] v4l2 patch for gb.v4l

Gareth Bult gareth at ...623...
Fri Feb 20 11:50:07 CET 2009


>Still the problems with unknown v4l2 formats.

What is the problem?

>The include for the inserted videodev.h should be in the C source that needs it, 
>not the gambas component that uses the C code generated object.

Feel free to modify the location of the "#include" if you think it could be better placed (!)

>This way the gambas commponent can't replaced by some other component code
>because the .c is more or less corrupt IMHO.

The v4l2 code is in gv4l2.c , the code is CWebCam.* is pre-existing code that was modified to cope with v4l2. I have commented a couple of times that it would be nice to re-factor all the v4l code out into (for example) gv4l.c and leave CWebCam.c purely as a Gambas component container rather than something that contains v4l[2] specific code.

Please can you specify whether your problem is with gv4l2.c, in which case I can look at "uncorrupting" it .. or with "CWebCam.*" in which case I need some agreement before I completely rip apart someone else's code.

>The best would be not to check fantasy formats not supported and 
>tell the value used in the case into the error message.

Yes, I know, I have a habit of inventing completely non-existent video formats all on my own(!)
Not!

We have three choices as I see it;
a. Support the author's camera only, as with the pre-existing v4l code
b. Support all camera's on the V4L2 spec
c. Support all camera's that Linux supports (which is a super-set of (b)

I have opted for (c), you are telling me this is wrong - I'm open to comments, however as a Linux user, IMHO (c) is a better option. All the video formats listed in the code exist as far as the Linux kernel is concerned. Technically we could have some #ifdef's in the source to look at the kernel version at compile time .. however given the videodev2.h file should be backwards compatible, including it in SVN does make a certain degree of sense. Another alternative would be to remove videodev2.h from SVN and get developers to upgrade to current kernel releases (!)

>tell the value used in the case into the error message.

This is strange, you've obviously looked at the code... you will see in gv4l2_process_image some code that looks like this;

        switch(format)
        {
                case V4L2_PIX_FMT_RGB332:       gv4l2_debug("RGB332");  break;
                case V4L2_PIX_FMT_RGB444:       gv4l2_debug("RGB444");  break;
                ...

and a routine that looks like this;

void gv4l2_debug( char *s )
{
        if( ! gv4l2_debug_mode ) return;
        printf("gambas v4l2: %s [%d]\n",s,errno);
        fflush(stdout);
}

So assuming you have debug turned on .. it "should" tell you what format the camera is supplying if it can't handle it ... Feel free to enhance the text of the message if you wish .. does this not work for you ?

Gareth.

----- Original Message -----
From: "Ron_1st" <ronstk at ...124...>
To: gambas-devel at lists.sourceforge.net
Sent: Friday, 20 February, 2009 10:01:03 AM GMT +00:00 GMT Britain, Ireland, Portugal
Subject: Re: [Gambas-devel] v4l2 patch for gb.v4l

On Friday 20 February 2009, Gareth Bult wrote:
> Erm, which version of Gambas is the patch against?
> (SVN already has full V4L2 support ... ????)
> 
> ----- Original Message -----
> From: "Silvan Calarco" <silvan.calarco at ...531...>
> To: "Gambas-devel" <gambas-devel at lists.sourceforge.net>
> Sent: Friday, 20 February, 2009 3:32:01 AM GMT +00:00 GMT Britain, Ireland, Portugal
> Subject: [Gambas-devel] v4l2 patch for gb.v4l
> 
> Hello.
> attached is a patch I wrote for a customer who needs support for a v4l2 webcam 
> (it's a Logitech QuickCam 9000 Pro) in gambas. 
> The patch integrates the example code from v4l2 api documentation 
> (http://v4l2spec.bytesex.org/spec/capture-example.html) in a way that should 
> be backwards compatibile (v4l1). The patch is at a basic and ugly level and 
> only supports YUYV to BGR24 pixel format conversion (the function is taken 
> from libv4l though the library could be used for most pixel formats support), 
> but with some work it might be of wider interest so I'm posting it here.
> 
> Silvan
> 
> -- 
> mambaSoft di Calarco Silvan
> Web: http://www.mambasoft.it
>  
> mambaSoft Store @ http://shop.mambasoft.it
> openmamba GNU/Linux development @ http://www.openmamba.org
> 
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Gambas-devel mailing list
> Gambas-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-devel
> 

Still the problems with unknown v4l2 formats.
The include for the inserted videodev.h should be in the C source that needs it, 
not the gambas component that uses the C code generated object.
This way the gambas commponent can't replaced by some other component code
because the .c is more or less corrupt IMHO.

The best would be not to check fantasy formats not supported and tell the
value used in the case into the error message.




Best regards,

Ron_1st

-- 
 A: Delete the text you reply on.
 Q: What to do to get my post on top?
---
 A: Because it messes up the order in which people normally read text. 
 Q: Why is top-posting such a bad thing? 
---
 A: Top-posting. 
 Q: What is the most annoying thing in e-mail? 
 

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-devel mailing list
Gambas-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-devel

-- 
Gareth Bult (Gareth at ...624...)




More information about the Devel mailing list