Re: [GnomeMeeting-devel-list] Towards a new video driver support in pwlib



Hello Julien,

Congratulations for your excellent work up to now!

[..]

> The way I think about it, the PVideoInputDevice class should be a
> plugin-manager class, and could be used not only for linux, but also for
> any reasonable system (POSIX?). The rest would be plugins.
> 
> A plugin would have a prefix (V4L, IEEE1394AVC, IEEE1394DC, ...), and
> add it to the list of devices it thinks can handle, so that the manager
> would know which plugin to use when asked to open "[V4L]/dev/foo"; that
> would allow the manager to do its magic, without breaking all apps.
> 

I agree with this approach. I would use that approach if I had to code
it myself.

> == Questions ==
> 
> The main question is: when do we load the plugins, and thus know what we
> have at disposal? We don't really want to scan them twenty times, but we
> don't want to change the way the programs that use pwlib work, and I
> find it a little tricky; looking at the way a gm does device detection:
> gw->video_devices = PVideoInputDevice::GetInputDeviceNames ();
> gw->video_devices += PString (_("Picture"));
> there is no created PVideoInputDevice at that moment, but since we want
> to return the device names, we need the plugins!
> 

That is indeed a tricky problem. What about loading/unloading the
different plugins when detecting devices?

ie:
- plugin1, plugin2 are available
- /dev/video0 is a video device
- /dev/video0 can not be opened with plugin1 but can be opened with
plugin2, we remember it

> PVideoInputDevice *grabber;
> grabber = new PVideoInputDevice();
> grabber->SetPreferredColourFormat (color_format);
> ...
> when PVideoInputDevice() is called, looks like a good moment to load
> plugins, but I think it is already too late as gm already tried to get
> the devices names...
> 

That could be done inside PVideoInputDevice. When detecting the devices,
you could try to remember what plugin was able to correctly open the
device, so when the user calls the "Open" method, you automatically load
the plugin.

> And there's also the little technical detail that I don't know (yet) how
> to code a plugin in C++. Already done so in C with dlopen...
> 

That is exactly the same in C++ + some tricks required because of symbol
mangling.

> == Conclusion ==
> 
> I need some advice, some directions, some doc, and some contradictory
> view. If you find any missing informatoin or anything false/inaccurate
> in the spreadsheet, I would be glad to know about it!
> 
> Snark
> 
> PS: this little program shows that sscanf may be enough for the manager
> to get the driver name... notice that the driver name shall not be
> bigger than ten characters in that example.
> 
> #include <stdio.h>
> 
> static char *tests[] = {
>   "V4L /dev/video0",
>   "IEEE1394AVC /dev/raw1394",
>   "IEEE1394DC /dev/raw1394",
>   "PLOP TIC /dev/toto",
>   NULL
> };
> 
> 
> int main(int argc, char **argv)
> {
>   char **deviceline, driver[11], *devicename;
>   
>   for(deviceline=tests; *deviceline!=NULL; deviceline++)
>     {
>       if(sscanf(*deviceline, "%s", &driver) != 1)
> printf("Error\n");
>       else
> {
>   devicename=*deviceline+strlen(driver)+1;
>   printf("Device line: %s\n Driver: %s\n Device: %s\n",
> *deviceline, driver, devicename);
> }
>     }
>   
>   exit(0);
> 
> }
-- 
 _	Damien Sandras
(o-	GnomeMeeting: http://www.gnomemeeting.org/
//\	FOSDEM 2003:  http://www.fosdem.org
v_/_	H.323 phone:  callto://ils.seconix.com/dsandras seconix com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]