[GnomeMeeting-devel-list] PVideoInputManager API



Now, let's discuss the PVideoInputManager more precisely;
here is the .h I used:

#include <ptlib.h>
#include <ptlib/videoio.h>
 
struct video_plugin {
  const char *name;
  void *handle;
  PVideoInputDevice *(*Create)(void);
  PStringList (*DeviceNames)(void);
  struct video_plugin *next;
};

class PVideoInputManager
{
public:
  PVideoInputManager();
  ~PVideoInputManager();

  static PStringList GetInputDeviceNames();

  static void LoadPluginDirectory(PDirectory);
  static BOOL LoadPlugin(PString);
  
  static PVideoInputDevice *GetOpenedDevice(PString, BOOL);

private:
  static PVideoInputDevice *GetDevice(PString);
  static void LoadAllPlugins();

};

I think:
* the struct can be put in the class' declaration, as it is only used
there;
* the class definition belongs to videoio.h;
* all methods should be virtual;
this is for the cleaning of the code.

For the API:
* I left public two functions that allow to load a plugin, or all
plugins in a directory. I thought perhaps gm would turn its moving logo
in a plugin, and load it like this...
* I left only one function public to get a PVideoInputDevice, and that
is the one for opening it (returns NULL if it fails). Since the device
reports "buggy" device names, I thought it wouldn't be that useful for a
program to be able to ask for a driver by name (which wouldn't be
natural anyway).

Is there some function the manager should provide? Should the
GetOpenedDevice function accept more arguments?

Snark




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