[Gambas-devel] V4L2 for Gambas ...
Gareth Bult
gareth at ...560...
Sat Jan 17 05:13:09 CET 2009
No, the problem is the API is different, and some camera are V4L and some are V4L2.
It would need an v4l2 "ioctl" call to fail to indicate that the device was v4l.
This would then set a boolean flag that would be checked in each method / property and an alternative version of the code called depending on the version.
It also requires a different structure for CWEBCAM, this is what I'm working with for example;
typedef struct
{
GB_BASE ob;
GB_STREAM stream;
char *device;
int io;
struct v4l2_capability cap;
struct v4l2_cropcap cropcap;
struct v4l2_crop crop;
struct v4l2_format fmt;
struct gv4l2_buffer* buffers;
int use_mmap;
int buffer_count;
void* frame;
} CWEBCAM;
Gareth.
----- Original Message -----
From: "Benoit Minisini" <gambas at ...1...>
To: "mailing list for gambas developers" <gambas-devel at lists.sourceforge.net>
Sent: Saturday, 17 January, 2009 12:09:29 AM GMT +00:00 GMT Britain, Ireland, Portugal
Subject: Re: [Gambas-devel] V4L2 for Gambas ...
On samedi 17 janvier 2009, Gareth Bult wrote:
> Hi,
>
> After plugging in a new camera and finding it only supports V4L2 and hence
> doesn't work (at all) with the Gambas V4L interface, I sat down and
> re-coded a component from scratch for V4L2. This is now working and
> includes conversion routines for non-RGB devices. (the #2 API is actually
> quite different to #1)
>
> To get a clean start, I've called it "VideoDevice2" and apart from that
> (and a few properties I'm still in the process of implementing) it's a drop
> in replacement for the current "VideoDevice" object.
>
> Question:: should I submit this as a new module / new object type, or
> should I try to integrate it into VideoDevice such that people don't need
> to worry about whether they are using V4L or V4L2 ? (i.e. so a new object
> type is not needed?)
>
> Gareth.
Is V4L2 compatible with V4L? I mean, do all V4L features exist in V4L2?
Apparently no user library is needed to use V4L or V4L2, so you can use both
API in the same module, with the same interface.
If V4L can be entirely replaced by V4L2, then you can just use V4L2, and drop
the old code.
Otherwise, you must think how you can know when you must use V4L, and when you
must use V4L2. If you can't decide, then add an optional argument to the
VideoDevice constructor that will tell which API to use.
Regards,
--
Benoit Minisini
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Gambas-devel mailing list
Gambas-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-devel
--
Managing Director, Encryptec Limited
Tel: 0845 5082719, Mob: 0785 3305393
Email: gareth at ...560...
Statements made are at all times subject to Encryptec's Terms and Conditions of Business, which are available upon request.
More information about the Devel
mailing list