ekiga r5989 - in trunk: . lib/engine/vidinput/skel src src/devices src/endpoints src/gui



Author: mschneid
Date: Sat Feb 23 08:57:02 2008
New Revision: 5989
URL: http://svn.gnome.org/viewvc/ekiga?rev=5989&view=rev

Log:
Switch over video input to the engine.


Removed:
   trunk/src/devices/fakevideoinput.cpp
   trunk/src/devices/fakevideoinput.h
Modified:
   trunk/ChangeLog
   trunk/lib/engine/vidinput/skel/vidinput-gmconf-bridge.cpp
   trunk/src/Makefile.am
   trunk/src/common.h
   trunk/src/devices/videoinput.cpp
   trunk/src/devices/videoinput.h
   trunk/src/endpoints/ekiga.cpp
   trunk/src/endpoints/ekiga.h
   trunk/src/endpoints/manager.cpp
   trunk/src/endpoints/manager.h
   trunk/src/gui/assistant.cpp
   trunk/src/gui/callbacks.cpp
   trunk/src/gui/main.cpp
   trunk/src/gui/preferences.cpp
   trunk/src/gui/preferences.h

Modified: trunk/lib/engine/vidinput/skel/vidinput-gmconf-bridge.cpp
==============================================================================
--- trunk/lib/engine/vidinput/skel/vidinput-gmconf-bridge.cpp	(original)
+++ trunk/lib/engine/vidinput/skel/vidinput-gmconf-bridge.cpp	Sat Feb 23 08:57:02 2008
@@ -50,14 +50,14 @@
   Ekiga::ConfKeys keys;
   property_changed.connect (sigc::mem_fun (this, &VidInputCoreConfBridge::on_property_changed));
 
-/*  keys.push_back (VIDEO_DEVICES_KEY "size"); 
+  keys.push_back (VIDEO_DEVICES_KEY "size"); 
   keys.push_back (VIDEO_CODECS_KEY "max_frame_rate"); 
   keys.push_back (VIDEO_DEVICES_KEY "input_device"); 
   keys.push_back (VIDEO_DEVICES_KEY "plugin"); 
   keys.push_back (VIDEO_DEVICES_KEY "channel"); 
   keys.push_back (VIDEO_DEVICES_KEY "format"); 
   keys.push_back (VIDEO_DEVICES_KEY "image"); 
-  keys.push_back (VIDEO_DEVICES_KEY "enable_preview"); */
+  keys.push_back (VIDEO_DEVICES_KEY "enable_preview");
   load (keys);
 }
 

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Sat Feb 23 08:57:02 2008
@@ -15,6 +15,7 @@
 	-I$(top_srcdir)/lib/engine/protocol/skel	\
 	-I$(top_srcdir)/lib/engine/protocol/sip		\
 	-I$(top_srcdir)/lib/engine/display/skel		\
+	-I$(top_srcdir)/lib/engine/vidinput/skel	\
 	-I$(top_srcdir)/lib/engine/framework		\
 	-I$(top_builddir)				\
 	$(GNOME_INCLUDEDIR)				\
@@ -74,8 +75,6 @@
 ekiga_SOURCES +=			\
 	devices/audio.h			\
 	devices/audio.cpp		\
-	devices/fakevideoinput.h	\
-	devices/fakevideoinput.cpp	\
 	devices/videoinput.h		\
 	devices/videoinput.cpp		\
 	devices/videooutput.h           \

Modified: trunk/src/common.h
==============================================================================
--- trunk/src/common.h	(original)
+++ trunk/src/common.h	Sat Feb 23 08:57:02 2008
@@ -72,18 +72,6 @@
 #define AUDIO_CODECS_KEY "/apps/" PACKAGE_NAME "/codecs/audio/"
 #define VIDEO_CODECS_KEY  "/apps/" PACKAGE_NAME "/codecs/video/"
 
-#define GM_4CIF_WIDTH  704
-#define GM_4CIF_HEIGHT 576
-#define GM_CIF_WIDTH   352
-#define GM_CIF_HEIGHT  288
-#define GM_QCIF_WIDTH  176
-#define GM_QCIF_HEIGHT 144
-#define GM_4SIF_WIDTH  640
-#define GM_4SIF_HEIGHT 480
-#define GM_SIF_WIDTH   320
-#define GM_SIF_HEIGHT  240
-#define GM_QSIF_WIDTH  160
-#define GM_QSIF_HEIGHT 120
 #define GM_FRAME_SIZE  10
 
 #define GNOMEMEETING_PAD_SMALL 1
@@ -121,18 +109,4 @@
 } PanelSection;
 
 
-#define NB_VIDEO_SIZES 5
-
-const static struct { 
-  int width; 
-  int height; 
-  } 
-  video_sizes[NB_VIDEO_SIZES] = {
-    {  GM_QCIF_WIDTH,  GM_QCIF_HEIGHT },
-    {  GM_CIF_WIDTH,   GM_CIF_HEIGHT  },
-    {  GM_4CIF_WIDTH,  GM_4CIF_HEIGHT },
-    {  GM_SIF_WIDTH,   GM_SIF_HEIGHT  },
-    {  GM_4SIF_WIDTH,  GM_4SIF_HEIGHT },
-};
-
 #endif /* GM_COMMON_H */

Modified: trunk/src/devices/videoinput.cpp
==============================================================================
--- trunk/src/devices/videoinput.cpp	(original)
+++ trunk/src/devices/videoinput.cpp	Sat Feb 23 08:57:02 2008
@@ -36,656 +36,231 @@
  *
  */
 
-
-#include "config.h"
+#define P_FORCE_STATIC_PLUGIN
 
 #include "videoinput.h"
 #include "ekiga.h"
-#include "misc.h"
-#include "main.h"
-
-#include "gmdialog.h"
-#include "gmconf.h"
-
-#define new PNEW
-
 
-/* The functions */
-GMVideoGrabber::GMVideoGrabber (bool start_grabbing,
-				bool sync,
-				unsigned _width,
-				unsigned _height,
-				unsigned _rate,
-				GMManager & endpoint)
-  : PThread (1000, NoAutoDeleteThread), ep (endpoint)
-{
-  /* Variables */
-  height = _height;
-  width = _width;
-  frame_rate = _rate;
-
-  whiteness = 0;
-  brightness = 0;
-  colour = 0;
-  contrast = 0;
+/* Plugin definition */
+class PVideoInputDevice_EKIGA_PluginServiceDescriptor 
+: public PDevicePluginServiceDescriptor
+{
+  public:
+    virtual PObject *CreateInstance (int) const 
+      {
+	return new PVideoInputDevice_EKIGA (*(GnomeMeeting::Process ()->GetServiceCore ())); 
+      }
+    
+    
+    virtual PStringArray GetDeviceNames(int) const 
+      { 
+	return PStringList("EKIGA"); 
+      }
+    
+    virtual bool ValidateDeviceName (const PString & deviceName, 
+				     int) const 
+      { 
+	return deviceName.Find("EKIGA") == 0; 
+      }
+} PVideoInputDevice_EKIGA_descriptor;
 
-  
-  /* Internal state */
-  stop = FALSE;
-  is_grabbing = start_grabbing;
-  synchronous = sync;
-  is_opened = FALSE;
+PCREATE_PLUGIN(EKIGA, PVideoInputDevice, &PVideoInputDevice_EKIGA_descriptor);
 
-  
-  /* Initialisation */
-  display = NULL;
-  grabber = NULL;
 
-  if (synchronous)
-    VGOpen ();
-  
-  /* Start the thread */
-  this->Resume ();
-  thread_sync_point.Wait ();
+PVideoInputDevice_EKIGA::PVideoInputDevice_EKIGA (Ekiga::ServiceCore & _core)
+: core (_core), vidinput_core (*(dynamic_cast<Ekiga::VidInputCore *> (_core.get ("vidinput-core"))))
+{
+  opened = false;
 }
 
 
-GMVideoGrabber::~GMVideoGrabber ()
+PVideoInputDevice_EKIGA::~PVideoInputDevice_EKIGA ()
 {
-  is_grabbing = FALSE;
-  stop = TRUE;
-
-  /* Wait for the device to be unlocked */
-  PWaitAndSignal q(device_mutex);
-
-  /* Wait for the Main () method to be terminated */
-  PWaitAndSignal m(quit_mutex);
-  PTRACE(4, "GMVidGra\tGMVideoGrabber::~GMVideoGrabber ()"); //FIXME: There seems to be a problem in win32 at this point since 2.0.x
+  Close ();
 }
 
-
-void
-GMVideoGrabber::Main ()
+bool
+PVideoInputDevice_EKIGA::Open (const PString &name,
+			       bool start_immediate)
 {
-  PBYTEArray frame;
-
-  PWaitAndSignal m(quit_mutex);
-  thread_sync_point.Signal ();
- 
-  if (!synchronous)
-    VGOpen ();
-
-  while (!stop) {
-
-    var_mutex.Wait ();
-    if (is_grabbing == 1) {
-
-      grabber->GetFrame (frame);
-      if (frame != NULL)
-	display->SetFrameData (0, 0, 
-			       grabber->GetFrameWidth (), 
-			       grabber->GetFrameHeight (), 
-			       frame);
-    }
-    var_mutex.Signal ();
-
-    Current()->Sleep (5);
+  if (start_immediate) {
+    vidinput_core.set_stream_config(frameWidth, frameHeight, frameRate);
+    vidinput_core.start_stream();
   }
+  opened = true;
 
-  VGClose ();
+  return true;
 }
 
 
-void
-GMVideoGrabber::StartGrabbing (void)
+bool
+PVideoInputDevice_EKIGA::IsOpen ()
 {
-  PWaitAndSignal m(var_mutex);
-  
-  is_grabbing = 1;
+  return opened;
 }
 
 
-void
-GMVideoGrabber::StopGrabbing (void)
+bool
+PVideoInputDevice_EKIGA::Close ()
 {
-  PWaitAndSignal m(var_mutex);
+  vidinput_core.stop_stream();
+  opened = false;
 
-  is_grabbing = 0;
+  return true;
 }
 
-
+  
 bool
-GMVideoGrabber::IsGrabbing (void)
+PVideoInputDevice_EKIGA::Start ()
 {
-  PWaitAndSignal m(var_mutex);
+  vidinput_core.set_stream_config(frameWidth, frameHeight, frameRate);
+  vidinput_core.start_stream();
 
-  return is_grabbing;
+  return true;
 }
 
-
-PVideoInputDevice *
-GMVideoGrabber::GetInputDevice (void)
-{
-  PWaitAndSignal m(var_mutex);
   
-  return grabber;
-}
-
-
-PVideoOutputDevice *
-GMVideoGrabber::GetOutputDevice (void)
+bool
+PVideoInputDevice_EKIGA::Stop ()
 {
-  PWaitAndSignal m(var_mutex);
-  
-  return display;
+  return true;
 }
 
 
 bool
-GMVideoGrabber::SetColour (int _colour)
+PVideoInputDevice_EKIGA::IsCapturing ()
 {
-  PWaitAndSignal m(var_mutex);
-
-  if (grabber)
-    return grabber->SetColour (_colour);
-
-  return FALSE;
+  return IsCapturing ();
 }
 
 
-bool
-GMVideoGrabber::SetBrightness (int _brightness)
+PStringArray
+PVideoInputDevice_EKIGA::GetDeviceNames() const
 {
-  PWaitAndSignal m(var_mutex);
+  PStringArray  devlist;
+  devlist.AppendString(GetDeviceName());
 
-  if (grabber)
-    return grabber->SetBrightness (_brightness);
-
-  return FALSE;
+  return devlist;
 }
 
 
 bool
-GMVideoGrabber::SetWhiteness (int _whiteness)
+PVideoInputDevice_EKIGA::SetFrameSize (unsigned int width,
+				       unsigned int height)
 {
-  PWaitAndSignal m(var_mutex);
-
-  if (grabber)
-    return grabber->SetWhiteness (_whiteness);
+  if (!PVideoDevice::SetFrameSize (width, height))
+    return false;
 
-  return FALSE;
+  return true;
 }
 
 
 bool
-GMVideoGrabber::SetContrast (int constrast)
+PVideoInputDevice_EKIGA::GetFrameData (BYTE *a,
+				       PINDEX *i)
 {
-  PWaitAndSignal m(var_mutex);
-  
-  if (grabber)
-    return grabber->SetContrast (constrast);
+  unsigned width;
+  unsigned height;
+  vidinput_core.get_frame_data(width, height, (char*)a);
 
-  return FALSE;
+  *i = width * height * 3 / 2;
+ 
+  return true;
 }
 
-
-void
-GMVideoGrabber::GetParameters (int *_whiteness,
-			       int *_brightness, 
-			       int *_colour,
-			       int *_contrast)
+//FIXME
+bool PVideoInputDevice_EKIGA::GetFrameDataNoDelay (BYTE *frame,
+						   PINDEX *i)
 {
-  int hue = 0;
-  
-  PWaitAndSignal m(var_mutex);
-  
-  grabber->GetParameters (_whiteness, _brightness, _colour, _contrast, &hue);
+  unsigned width;
+  unsigned height;
+  vidinput_core.get_frame_data(width, height, (char*)frame);
 
-  *_whiteness = (int) *_whiteness / 256;
-  *_brightness = (int) *_brightness / 256;
-  *_colour = (int) *_colour / 256;
-  *_contrast = (int) *_contrast / 256;
+  *i = width * height * 3 / 2;
+  return true;
 }
 
 
-void
-GMVideoGrabber::Lock ()
+bool
+PVideoInputDevice_EKIGA::TestAllFormats ()
 {
-  device_mutex.Wait ();
+  return true;
 }
 
 
-void
-GMVideoGrabber::Unlock ()
+PINDEX
+PVideoInputDevice_EKIGA::GetMaxFrameBytes ()
 {
-  device_mutex.Signal ();
+  return CalculateFrameBytes (frameWidth, frameHeight, colourFormat);
 }
 
 
-void
-GMVideoGrabber::VGOpen (void)
+bool
+PVideoInputDevice_EKIGA::SetVideoFormat (VideoFormat newFormat)
 {
-  GtkWidget *main_window = NULL;
-
-  PString input_device;
-  PString plugin;
-
-  gchar *dialog_title = NULL;
-  gchar *dialog_msg = NULL;
-  gchar *tmp_msg = NULL;
-  gchar *conf_value = NULL;
-  
-  int error_code = 0;
-  int channel = 0;
-
-  bool no_device_found = FALSE;
-  
-  PVideoDevice::VideoFormat format = PVideoDevice::PAL;
-
-  main_window = GnomeMeeting::Process ()->GetMainWindow ();
-  
-  if (!is_opened) {
-    
-    /* Get the video device options from the configuration database */
-    gnomemeeting_threads_enter ();
-
-    conf_value = gm_conf_get_string (VIDEO_DEVICES_KEY "input_device");
-    input_device = conf_value;
-    g_free (conf_value);
-    
-    conf_value = gm_conf_get_string (VIDEO_DEVICES_KEY "plugin");
-    plugin = conf_value;
-    g_free (conf_value);
-    
-    channel = gm_conf_get_int (VIDEO_DEVICES_KEY "channel");
-
-    format =
-      (PVideoDevice::VideoFormat) gm_conf_get_int (VIDEO_DEVICES_KEY "format");
-
-    no_device_found = (input_device == _("No device found"));
-    gnomemeeting_threads_leave ();
-
-
-    /* If there is no device, directly open the fake device */
-    if (!no_device_found) {
- 
-      var_mutex.Wait ();
-      grabber = 
-	PVideoInputDevice::CreateOpenedDevice (plugin, input_device, FALSE);
-      if (!grabber)
-	error_code = 1;
-      else if (!grabber->SetVideoFormat (format))
-	error_code = 2;
-      else if (!grabber->SetChannel (channel))
-	error_code = 3;
-      else if (!grabber->SetColourFormatConverter ("YUV420P"))
-	error_code = 4;
-      else if (!grabber->SetFrameRate (frame_rate))
-	error_code = 5;
-      else if (!grabber->SetFrameSizeConverter (width, height, PVideoFrameInfo::eScale))
-	error_code = 6;
-      var_mutex.Signal ();
-    
-
-      /* If error */
-      if (error_code) {
-	
-	/* If we want to open the fake device for a real error, and not because
-	   the user chose the Picture device */
-	gnomemeeting_threads_enter ();
-	dialog_title =
-	  g_strdup_printf (_("Error while opening video device %s"),
-			   (const char *) input_device);
-
-	tmp_msg = g_strdup (_("A moving logo will be transmitted during calls. Notice that you can always transmit a given image or the moving logo by choosing \"Picture\" as video plugin and \"Moving logo\" or \"Static picture\" as device."));
-	switch (error_code) {
-	  
-	case 1:
-	  dialog_msg = g_strconcat (tmp_msg, "\n\n", _("There was an error while opening the device. Please check your permissions and make sure that the appropriate driver is loaded."), NULL);
-	  break;
-	  
-	case 2:
-	  dialog_msg = g_strconcat (tmp_msg, "\n\n", _("Your video driver doesn't support the requested video format."), NULL);
-	  break;
-
-	case 3:
-	  dialog_msg = g_strconcat (tmp_msg, "\n\n", _("Could not open the chosen channel."), NULL);
-	  break;
-      
-	case 4:
-	  dialog_msg = g_strconcat (tmp_msg, "\n\n", _("Your driver doesn't seem to support any of the color formats supported by Ekiga.\n Please check your kernel driver documentation in order to determine which Palette is supported."), NULL);
-	  break;
-	  
-	case 5:
-	  dialog_msg = g_strconcat (tmp_msg, "\n\n", _("Error while setting the frame rate."), NULL);
-	  break;
-
-	case 6:
-	  dialog_msg = g_strconcat (tmp_msg, "\n\n", _("Error while setting the frame size."), NULL);
-	  break;
-
-	default:
-	  break;
-	}
-
-	gnomemeeting_warning_dialog_on_widget (GTK_WINDOW (main_window),
-					       VIDEO_DEVICES_KEY "enable_preview",
-					       dialog_title,
-					       "%s", dialog_msg);
-	g_free (dialog_msg);
-	g_free (dialog_title);
-	g_free (tmp_msg);
-
-	gnomemeeting_threads_leave ();
-      }
-    }
-      
-    if (error_code || no_device_found) {
-	
-      /* delete the failed grabber and open the fake grabber */
-      var_mutex.Wait ();
-      if (grabber) {
-	
-	delete grabber;
-	grabber = NULL;
-      }
-
-      grabber =
-	PVideoInputDevice::CreateOpenedDevice ("Picture",
-					       "Moving logo",
-					       FALSE);
-      if (grabber) {
-	
-	grabber->SetColourFormatConverter ("YUV420P");
-	grabber->SetVideoFormat (PVideoDevice::PAL);
-	grabber->SetChannel (1);    
-	grabber->SetFrameRate (6);
-	grabber->SetFrameSizeConverter (width, height, FALSE);
-      }
-      var_mutex.Signal ();
-    }
-   
-
-    grabber->Start ();
-
-    var_mutex.Wait ();
-
-    display = PVideoOutputDevice::CreateDevice ("EKIGA");
-    display->Open ("EKIGAIN", FALSE);
-    display->SetFrameSizeConverter (width, height, FALSE);
-    display->SetColourFormatConverter ("YUV420P");
-
-    is_opened = TRUE;
-    var_mutex.Signal ();
-  
-      
-    /* Setup the video settings */
-    GetParameters (&whiteness, &brightness, &colour, &contrast);
-    if (whiteness > 0 || brightness > 0 || colour > 0 || contrast > 0) {
-
-      gnomemeeting_threads_enter ();
-      gm_main_window_set_video_sliders_values (main_window,
-					       whiteness,
-					       brightness,
-					       colour, 
-					       contrast);
-      gnomemeeting_threads_leave ();
-    }
-    else {
-
-      /* Driver made a reset, keep the old values */
-      gnomemeeting_threads_enter ();
-      gm_main_window_get_video_sliders_values (main_window,
-					       whiteness,
-					       brightness,
-					       colour,
-					       contrast);
-      gnomemeeting_threads_leave ();
-
-      if (whiteness > 0)
-	SetWhiteness (whiteness << 8);
-      if (brightness > 0)
-	SetBrightness (brightness << 8);
-      if (colour > 0)
-	SetColour (colour << 8);
-      if (contrast > 0)
-	SetContrast (contrast << 8);
-    }
-
-      
-    /* Update the GUI sensitivity if not in a call */
-    if (ep.GetCallingState () == GMManager::Standby) {
-
-      gnomemeeting_threads_enter ();      
-      gm_main_window_update_sensitivity (main_window, TRUE, FALSE, TRUE);
-      gnomemeeting_threads_leave ();
-    }
-  }
+  return PVideoDevice::SetVideoFormat (newFormat);
 }
-  
-
-void
-GMVideoGrabber::VGClose ()
-{
-  GtkWidget *main_window = NULL;
-
-  main_window = GnomeMeeting::Process ()->GetMainWindow ();
-
-  if (is_opened) {
 
-    var_mutex.Wait ();
-    is_grabbing = FALSE;
-    var_mutex.Signal ();
-
-
-    /* Update menu sensitivity if we are not in a call */
-    gnomemeeting_threads_enter ();
-    if (ep.GetCallingState () == GMManager::Standby
-	&& !gm_conf_get_bool (VIDEO_DEVICES_KEY "enable_preview")) {
-
-      gm_main_window_update_sensitivity (main_window, TRUE, FALSE, FALSE);
-      gm_main_window_update_logo_have_window (main_window);
-    }
-    gnomemeeting_threads_leave ();
 
+int
+PVideoInputDevice_EKIGA::GetNumChannels()
+{
+  return 1;
+}
 
-    /* Initialisation */
-    var_mutex.Wait ();
-    is_opened = FALSE;
-    delete grabber;
-    delete display;
-    display = NULL;
-    grabber = NULL;
-    var_mutex.Signal ();
-  }
 
-  
-  /* Quick Hack for buggy drivers that return from the ioctl before the device
-     is really closed */
-  PThread::Current ()->Sleep (1000);
+bool
+PVideoInputDevice_EKIGA::SetChannel (int /*newChannel*/)
+{
+  return true;
 }
 
 
-/* The video tester class */
-GMVideoTester::GMVideoTester (gchar *manager,
-			      gchar *recorder)
-  :PThread (1000, AutoDeleteThread)
+bool
+PVideoInputDevice_EKIGA::SetColourFormat (const PString &newFormat)
 {
-  if (manager)
-    video_manager = PString (manager);
-  if (recorder)
-    video_recorder = PString (recorder);
+  if (newFormat == "YUV420P") 
+    return PVideoDevice::SetColourFormat (newFormat);
 
-  test_dialog = NULL;
-  test_label = NULL;
-  
-  this->Resume ();
-  thread_sync_point.Wait ();
+  return false;  
 }
 
 
-GMVideoTester::~GMVideoTester ()
+bool
+PVideoInputDevice_EKIGA::SetFrameRate (unsigned rate)
 {
- PWaitAndSignal m(quit_mutex);
+  PVideoDevice::SetFrameRate (rate);
+ 
+  return true;
 }
 
 
-void GMVideoTester::Main ()
+bool
+PVideoInputDevice_EKIGA::GetFrameSizeLimits (unsigned & minWidth,
+					       unsigned & minHeight,
+					       unsigned & maxWidth,
+					       unsigned & maxHeight)
 {
-  GtkWidget *assistant_window = NULL;
+  minWidth  = 10;
+  minHeight = 10;
+  maxWidth  = 1000;
+  maxHeight =  800;
 
-  PVideoInputDevice *grabber = NULL;
-  
-  int height = GM_QCIF_HEIGHT; 
-  int width = GM_QCIF_WIDTH; 
-  int error_code = -1;
-  int cpt = 0;
-
-  gchar *dialog_msg = NULL;
-  gchar *tmp = NULL;
-
-  assistant_window = GnomeMeeting::Process ()->GetAssistantWindow (); 
-
-  PWaitAndSignal m(quit_mutex);
-  thread_sync_point.Signal ();
-
-  if (video_recorder.IsEmpty ()
-      || video_manager.IsEmpty ()
-      || video_recorder == PString (_("No device found"))
-      || video_recorder == PString (_("Picture")))
-    return;
-  
-  gdk_threads_enter ();
-  test_dialog =
-    gtk_dialog_new_with_buttons ("Video test running",
-				 GTK_WINDOW (assistant_window),
-				 (GtkDialogFlags) (GTK_DIALOG_MODAL),
-				 GTK_STOCK_OK,
-				 GTK_RESPONSE_ACCEPT,
-				 NULL);
-  dialog_msg = 
-    g_strdup_printf (_("Ekiga is now testing the %s video device. If you experience machine crashes, then report a bug to the video driver author."), (const char *) video_recorder);
-  test_label = gtk_label_new (dialog_msg);
-  gtk_label_set_line_wrap (GTK_LABEL (test_label), true);
-  g_free (dialog_msg);
-
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (test_dialog)->vbox), test_label,
-		      FALSE, FALSE, 2);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (test_dialog)->vbox), 
-		      gtk_hseparator_new (), FALSE, FALSE, 2);
-
-  test_label = gtk_label_new (NULL);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (test_dialog)->vbox), 
-		      test_label, FALSE, FALSE, 2);
-
-  g_signal_connect (G_OBJECT (test_dialog), "delete-event",
-		    G_CALLBACK (gtk_widget_hide_on_delete), NULL);
-
-  gtk_window_set_transient_for (GTK_WINDOW (test_dialog),
-				GTK_WINDOW (assistant_window));
-  gtk_widget_show_all (GTK_DIALOG (test_dialog)->vbox);
-  gnomemeeting_threads_dialog_show (test_dialog);
-  gdk_threads_leave ();
-
-  
-  while (cpt < 6 && error_code == -1) {
-
-    if (!video_recorder.IsEmpty ()
-	&& !video_manager.IsEmpty ()) {
+  return true;
+}
 
-      error_code = -1;
-      
-      grabber = 
-	PVideoInputDevice::CreateOpenedDevice (video_manager,
-					       video_recorder,
-					       FALSE);
-
-      if (!grabber)
-	error_code = 0;
-      else
-	if (!grabber->SetVideoFormat (PVideoDevice::Auto))
-	  error_code = 2;
-      else
-        if (!grabber->SetChannel (0))
-          error_code = 2;
-      else
-	if (!grabber->SetColourFormatConverter ("YUV420P"))
-	  error_code = 3;
-      else
-	if (!grabber->SetFrameRate (30))
-	  error_code = 4;
-      else
-	if (!grabber->SetFrameSizeConverter (width, height, FALSE))
-	  error_code = 5;
-      else
-	grabber->Close ();
-
-      if (grabber)
-	delete (grabber);
-    }
-
-
-    if (error_code == -1) 
-      dialog_msg = g_strdup_printf (_("Test %d done"), cpt);
-    else
-      dialog_msg = g_strdup_printf (_("Test %d failed"), cpt);
-
-    tmp = g_strdup_printf ("<b>%s</b>", dialog_msg);
-    gdk_threads_enter ();
-    gtk_label_set_markup (GTK_LABEL (test_label), tmp);
-    gdk_threads_leave ();
-    g_free (dialog_msg);
-    g_free (tmp);
 
-    cpt++;
-    PThread::Current () ->Sleep (100);
-  }
-
-  
-  if (error_code != - 1) {
-    
-    switch (error_code)	{
-	  
-    case 0:
-      dialog_msg = g_strdup_printf (_("Error while opening %s."),
-			     (const char *) video_recorder);
-      break;
-      
-    case 1:
-      dialog_msg = g_strdup_printf (_("Your video driver doesn't support the requested video format."));
-      break;
-      
-    case 2:
-      dialog_msg = g_strdup_printf (_("Could not open the chosen channel with the chosen video format."));
-      break;
-      
-    case 3:
-      dialog_msg = g_strdup_printf (_("Your driver doesn't support any of the color formats tried by Ekiga"));
-      break;
-      
-    case 4:
-      dialog_msg = g_strdup_printf ( _("Error with the frame rate."));
-      break;
-      
-    case 5:
-      dialog_msg = g_strdup_printf (_("Error with the frame size."));
-      break;
-
-    default:
-      break;
-    }
-
-    gdk_threads_enter ();
-    gnomemeeting_error_dialog (GTK_WINDOW (assistant_window),
-			       _("Failed to open the device"),
-			       "%s", dialog_msg);
-    gdk_threads_leave ();
-    
-    g_free (dialog_msg);
-  }
+bool PVideoInputDevice_EKIGA::GetParameters (int *whiteness,
+					       int *brightness,
+					       int *colour,
+					       int *contrast,
+					       int *hue)
+{
+  *whiteness = 0;
+  *brightness = 0;
+  *colour = 0;
+  *contrast = 0;
+  *hue = 0;
 
-  gdk_threads_enter ();
-  if (test_dialog)
-    gnomemeeting_threads_widget_destroy (test_dialog);
-  gdk_threads_leave ();
+  return true;
 }

Modified: trunk/src/devices/videoinput.h
==============================================================================
--- trunk/src/devices/videoinput.h	(original)
+++ trunk/src/devices/videoinput.h	Sat Feb 23 08:57:02 2008
@@ -37,221 +37,150 @@
  */
 
 
-#ifndef _VIDEO_GRABBER_H_
-#define _VIDEO_GRABBER_H_
+#ifndef _EKIGA_VIDEO_INPUT_H_
+#define _EKIGA_VIDEO_INPUT_H_
 
+#include "vidinput-core.h"
 #include "common.h"
 
-class GMManager;
-
-class GMVideoGrabber : public PThread
+class PVideoInputDevice_EKIGA : public PVideoInputDevice 
 {
-  PCLASSINFO(GMVideoGrabber, PThread);
-
+  PCLASSINFO(PVideoInputDevice_EKIGA, PVideoInputDevice);
+  
  public:
-
+  
   /* DESCRIPTION  :  The constructor.
-   * BEHAVIOR     :  Initialises the VideoGrabber, the VideoGrabber is opened
-   *                 asynchronously given the config parameters. If the opening
-   *                 fails, an error popup is displayed.
-   * PRE          :  First parameter is TRUE if the VideoGrabber must grab
-   *                 once opened. The second one is TRUE if the VideoGrabber
-   *                 must be opened synchronously. The last one is a 
-   *                 reference to the GMManager.
-   */
-  GMVideoGrabber (bool start_grabbing,
-		  bool sync,
-		  unsigned _width,
-		  unsigned _height,
-		  unsigned _rate,
-		  GMManager &endpoint);
-
-
-  /* DESCRIPTION  :  The destructor.
-   * BEHAVIOR     :  /
+   * BEHAVIOR     :  Creates the Fake Input Device.
    * PRE          :  /
    */
-  ~GMVideoGrabber (void);
+  PVideoInputDevice_EKIGA (Ekiga::ServiceCore & core);
 
 
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Start to grab, i.e. read from the specified device 
-   *                 and display images in the main interface.
+  /* DESCRIPTION  :  The destructor
+   * BEHAVIOR     :  /
    * PRE          :  /
    */
-  void StartGrabbing (void);
+  ~PVideoInputDevice_EKIGA ();
 
   
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Stop to grab, i.e. read from the specified device 
-   *                 and display images in the main interface.
-   * PRE          :  /
-   */
-  void StopGrabbing (void);
+  virtual bool Open (const PString &name,
+     	             bool start_immediate = TRUE);
 
   
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Returns TRUE if we are grabbing.
-   * PRE          :  /
+  /**Determine of the device is currently open.
    */
-  bool IsGrabbing (void);
+  virtual bool IsOpen() ;
 
   
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Returns the PVideoInputDevice used to capture
-   *                 the camera images.
-   * PRE          :  /
+  /**Close the device.
    */
-  PVideoInputDevice *GetInputDevice (void);
+  virtual bool Close();
 
   
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Returns the PVideoOutputDevice used to display
-   *                 the camera images.
-   * PRE          :  /
+  /**Start the video device I/O.
    */
-  PVideoOutputDevice *GetOutputDevice (void);
-
+  virtual bool Start();
 
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Sets the colour for the specified device.
-   * PRE          :  0 <= int <= 65535
-   */
-  bool SetColour (int colour);
-
-
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Sets the brightness for the specified device.
-   * PRE          :  0 <= int <= 65535
-   */
-  bool SetBrightness (int brightness);
-
-
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Sets the whiteness for the specified device.
-   * PRE          :  0 <= int <= 65535
-   */
-  bool SetWhiteness (int whiteness);
-
-
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Sets the contrast for the specified device.
-   * PRE          :  0 <= int <= 65535
-   */
-  bool SetContrast (int contrast);
-
-
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Returns respectively the whiteness, brightness, 
-   *                 colour, contrast for the specified device.
-   * PRE          :  Allocated pointers to int. Grabber must be opened.
+  
+  /**Stop the video device I/O capture.
    */
-  void GetParameters (int *whiteness,
-		      int *brightness,
-		      int *colour,
-		      int *contrast);
+  virtual bool Stop();
 
 
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Lock the device, preventing it to be Closed and deleted.
-   * PRE          :  /
+  /**Determine if the video device I/O capture is in progress.
    */
-  void Lock ();
+  virtual bool IsCapturing();
 
   
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Unlock the device.
-   * PRE          :  /
-   */
-  void Unlock ();
-
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Return current width
+  virtual bool SetFrameSize (unsigned int width,
+       		             unsigned int height);
+  
+  
+  /* DESCRIPTION  :  The destructor
+   * BEHAVIOR     :  /
    * PRE          :  /
    */
-  unsigned GetWidth () { return width; };
+  virtual bool GetFrameData (BYTE *a, PINDEX *i = NULL);
 
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Return current height
-   * PRE          :  /
-   */
-  unsigned GetHeight () { return height; };
 
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Return current frame rate
+  /* DESCRIPTION  :  The destructor
+   * BEHAVIOR     :  /
    * PRE          :  /
    */
-  unsigned GetFrameRate () { return frame_rate; };
+  virtual bool GetFrameDataNoDelay (BYTE *frame, PINDEX *i = NULL);
 
   
- protected:
-  void Main (void);
-  void VGOpen (void);
-  void VGClose (void);
-
-  unsigned width;
-  unsigned height;
-  unsigned frame_rate;
-  int whiteness;
-  int brightness;
-  int colour;
-  int contrast;
-
-  char video_buffer [3 * GM_CIF_WIDTH * GM_CIF_HEIGHT];
-
-  PVideoInputDevice *grabber;
-  PVideoOutputDevice *display;
-
-  bool stop;
-  bool is_grabbing;
-  bool synchronous;
-  bool is_opened;
-
-  PMutex var_mutex;      /* To protect variables that are read and written
-			    from various threads */
-  PMutex quit_mutex;     /* To exit */
-  PMutex device_mutex;   /* To Lock and Unlock and not exit until
-			    it is unlocked */
-  PSyncPoint thread_sync_point;
+  virtual bool TestAllFormats ();
 
-  GMManager & ep;
-};
+  
+  /**Get the maximum frame size in bytes.
+  */
+  virtual PINDEX GetMaxFrameBytes();
 
+  
+  /** Given a preset interval of n milliseconds, this function
+      returns n msecs after the previous frame capture was initiated.
+  */
+//  virtual void WaitFinishPreviousFrame();
 
-class GMVideoTester : public PThread
-{
-  PCLASSINFO(GMVideoTester, PThread);
+  
+  /**Set the video format to be used.
 
+  Default behaviour sets the value of the videoFormat variable and then
+  returns the IsOpen() status.
+  */
+  virtual bool SetVideoFormat (VideoFormat newFormat);
+  
+  /**Get the number of video channels available on the device.
 
-public:
+  Default behaviour returns 1.
+  */
+  virtual int GetNumChannels() ;
 
-  /* DESCRIPTION  :  The constructor.
-   * BEHAVIOR     :  
-   * PRE          :  /
-   */
-  GMVideoTester (gchar *manager,
-		 gchar *recorder);
+  
+  /**Set the video channel to be used on the device.
 
+  Default behaviour sets the value of the channelNumber variable and then
+  returns the IsOpen() status.
+  */
+  virtual bool SetChannel (int newChannel);
+			
 
-  /* DESCRIPTION  :  The destructor.
-   * BEHAVIOR     :  /
-   * PRE          :  /
-   */
-  ~GMVideoTester ();
+  /**Set the colour format to be used.
 
+  Default behaviour sets the value of the colourFormat variable and then
+  returns the IsOpen() status.
+  */
+  virtual bool SetColourFormat (const PString &newFormat);
 
-  void Main ();
+  
+  /**Set the video frame rate to be used on the device.
 
+  Default behaviour sets the value of the frameRate variable and then
+  return the IsOpen() status.
+  */
+  virtual bool SetFrameRate (unsigned rate);
 
-protected:
+  
+  virtual bool GetFrameSizeLimits (unsigned &minWidth,
+			           unsigned &minHeight,
+			           unsigned &maxWidth,
+			           unsigned &maxHeight);
+  
+  virtual bool GetParameters (int *whiteness,
+		              int *brightness,
+		              int *colour,
+		              int *contrast,
+		              int *hue);
+  
 
-  PString video_manager;
-  PString video_recorder;
+  virtual PStringArray GetDeviceNames() const;
 
-  GtkWidget *test_label;
-  GtkWidget *test_dialog;
+protected:
+  Ekiga::ServiceCore & core;
+  Ekiga::VidInputCore & vidinput_core;
 
-  PMutex quit_mutex;
-  PSyncPoint thread_sync_point;
+  bool opened;
 };
+
 #endif

Modified: trunk/src/endpoints/ekiga.cpp
==============================================================================
--- trunk/src/endpoints/ekiga.cpp	(original)
+++ trunk/src/endpoints/ekiga.cpp	Sat Feb 23 08:57:02 2008
@@ -61,6 +61,7 @@
 #include "gmconf.h"
 
 #include "engine.h"
+#include "vidinput-core.h"
 
 #define new PNEW
 
@@ -213,12 +214,10 @@
 GnomeMeeting::DetectDevices ()
 {
   gchar *audio_plugin = NULL;
-  gchar *video_plugin = NULL;
 
   PINDEX fake_idx;
 
   audio_plugin = gm_conf_get_string (AUDIO_DEVICES_KEY "plugin");
-  video_plugin = gm_conf_get_string (VIDEO_DEVICES_KEY "plugin");
  
   PWaitAndSignal m(dev_access_mutex);
   
@@ -229,16 +228,10 @@
   
   /* Detect the plugins */
   audio_managers = PSoundChannel::GetDriverNames ();
-  video_managers = PVideoInputDevice::GetDriverNames ();
   
-  fake_idx = video_managers.GetValuesIndex (PString ("FakeVideo"));
-  if (fake_idx != P_MAX_INDEX)
-    video_managers.RemoveAt (fake_idx);
 
   PTRACE (1, "Detected audio plugins: " << setfill (',') << audio_managers
 	  << setfill (' '));
-  PTRACE (1, "Detected video plugins: " << setfill (',') << video_managers
-	  << setfill (' '));
 
 #ifdef HAX_IXJ
   audio_managers += PString ("Quicknet");
@@ -246,22 +239,15 @@
 
   PTRACE (1, "Detected audio plugins: " << setfill (',') << audio_managers
 	  << setfill (' '));
-  PTRACE (1, "Detected video plugins: " << setfill (',') << video_managers
-	  << setfill (' '));
   
 
-  fake_idx = video_managers.GetValuesIndex (PString ("Picture"));
-  if (fake_idx == P_MAX_INDEX)
-    return FALSE;
-
   /* No audio plugin => Exit */
   if (audio_managers.GetSize () == 0)
     return FALSE;
   
   
   /* Detect the devices */
-  video_input_devices = PVideoInputDevice::GetDriversDeviceNames (video_plugin);
- 
+
   audio_input_devices = 
     PSoundChannel::GetDeviceNames (audio_plugin, PSoundChannel::Recorder);
   audio_output_devices = 
@@ -272,9 +258,6 @@
     audio_input_devices += PString (_("No device found"));
   if (audio_output_devices.GetSize () == 0)
     audio_output_devices += PString (_("No device found"));
-  if (video_input_devices.GetSize () == 0)
-    video_input_devices += PString (_("No device found"));
-
 
   PTRACE (1, "Detected the following audio input devices: "
 	  << setfill (',') << audio_input_devices << setfill (' ')
@@ -282,9 +265,6 @@
   PTRACE (1, "Detected the following audio output devices: "
 	  << setfill (',') << audio_output_devices << setfill (' ')
 	  << " with plugin " << audio_plugin);
-  PTRACE (1, "Detected the following video input devices: "
-	  << setfill (',') << video_input_devices << setfill (' ')
-	  << " with plugin " << video_plugin);
   
   PTRACE (1, "Detected the following audio input devices: " 
 	  << setfill (',') << audio_input_devices << setfill (' ') 
@@ -292,12 +272,8 @@
   PTRACE (1, "Detected the following audio output devices: " 
 	  << setfill (',') << audio_output_devices << setfill (' ') 
 	  << " with plugin " << audio_plugin);
-  PTRACE (1, "Detected the following video input devices: " 
-	  << setfill (',') << video_input_devices << setfill (' ')  
-	  << " with plugin " << video_plugin);
 
   g_free (audio_plugin);
-  g_free (video_plugin);
 
   gnomemeeting_sound_daemons_resume ();
 
@@ -305,8 +281,7 @@
   if (prefs_window)
     gm_prefs_window_update_devices_list (prefs_window, 
 					 audio_input_devices,
-					 audio_output_devices,
-					 video_input_devices);
+					 audio_output_devices);
   return TRUE;
 }
 
@@ -402,7 +377,7 @@
 GnomeMeeting::GetPrefsWindow (bool create)
 {
   if (!prefs_window && create)
-    prefs_window = gm_prefs_window_new ();
+    prefs_window = gm_prefs_window_new (service_core);
   return prefs_window;
 }
 
@@ -487,7 +462,6 @@
 #endif
 }
 
-
 PStringArray 
 GnomeMeeting::GetInterfaces ()
 {
@@ -497,14 +471,6 @@
 }
 
 
-PStringArray 
-GnomeMeeting::GetVideoInputDevices ()
-{
-  PWaitAndSignal m(dev_access_mutex);
-
-  return video_input_devices;
-}
-
 
 PStringArray 
 GnomeMeeting::GetAudioInputDevices ()
@@ -534,15 +500,6 @@
 }
 
 
-PStringArray 
-GnomeMeeting::GetVideoPlugins ()
-{
-  PWaitAndSignal m(dev_access_mutex);
-
-  return video_managers;
-}
-
-
 void
 GnomeMeeting::InitEngine ()
 {

Modified: trunk/src/endpoints/ekiga.h
==============================================================================
--- trunk/src/endpoints/ekiga.h	(original)
+++ trunk/src/endpoints/ekiga.h	Sat Feb 23 08:57:02 2008
@@ -219,16 +219,7 @@
    */
   PStringArray GetInterfaces ();
 
-  
-  /* DESCRIPTION  : / 
-   * BEHAVIOR     : Returns the list of detected video devices. 
-   * 		    That doesn't force a redetection. Use DetectDevices 
-   * 		    for that.
-   * PRE          : /
-   */
-  PStringArray GetVideoInputDevices ();
-  
-  
+
   /* DESCRIPTION  : / 
    * BEHAVIOR     : Returns the list of detected audio input devices. 
    * 		    That doesn't force a redetection. Use DetectDevices 
@@ -256,13 +247,6 @@
   PStringArray GetAudioPlugins ();
   
   
-  /* DESCRIPTION  : / 
-   * BEHAVIOR     : Returns the list of detected video plugins. 
-   * 		    That doesn't force a redetection. Use DetectDevices 
-   * 		    for that.
-   * PRE          : /
-   */
-  PStringArray GetVideoPlugins ();
 
  private:
   
@@ -279,7 +263,6 @@
 
 
   /* Detected devices and plugins */
-  PStringArray video_input_devices;
   PStringArray audio_input_devices;
   PStringArray audio_output_devices;
   PStringArray audio_managers;

Modified: trunk/src/endpoints/manager.cpp
==============================================================================
--- trunk/src/endpoints/manager.cpp	(original)
+++ trunk/src/endpoints/manager.cpp	Sat Feb 23 08:57:02 2008
@@ -56,6 +56,8 @@
 #include "opal-call.h"
 #include "opal-codec-description.h"
 
+#include "vidinput-info.h"
+
 #include <opal/transcoders.h>
 #include <ptclib/http.h>
 #include <ptclib/html.h>
@@ -83,6 +85,7 @@
                                           gpointer data);
 
 
+
 /* DESCRIPTION  :  This notifier is called when the config database data
  *                 associated with the public ip changes.
  * BEHAVIOR     :  Updates the IP Translation address.
@@ -93,21 +96,6 @@
                                   gpointer data);
 
 
-/* DESCRIPTION  :  This callback is called when the video device changes
- *                 in the config database.
- * BEHAVIOR     :  It creates a new video grabber if preview is active with
- *                 the selected video device.
- *                 If preview is not enabled, then the potentially existing
- *                 video grabber is deleted provided we are not in
- *                 a call.
- *                 Notice that the video device can't be changed during calls,
- *                 but its setting can be changed.
- * PRE          :  data is a pointer to the GMManager.
- */
-static void video_device_changed_nt (G_GNUC_UNUSED gpointer id,
-                                     GmConfEntry *entry, 
-                                     gpointer data);
-
 
 /* DESCRIPTION  :  This callback is called when the status config value changes.
  * BEHAVIOR     :  Updates the presence for the endpoints.
@@ -180,22 +168,6 @@
 }
 
 
-static void 
-video_device_changed_nt (G_GNUC_UNUSED gpointer id,
-			 GmConfEntry *entry, 
-			 gpointer data)
-{
-  GMManager *ep = (GMManager *) data;
-  
-  if ((gm_conf_entry_get_type (entry) == GM_CONF_BOOL) ||
-      (gm_conf_entry_get_type (entry) == GM_CONF_STRING) ||
-      (gm_conf_entry_get_type (entry) == GM_CONF_INT)) {
-
-    ep->UpdateDevices ();
-  }
-}
-
-
 /* DESCRIPTION  :  This callback is called when the status config value changes.
  * BEHAVIOR     :  Updates the presence for the endpoints.
  * PRE          :  /
@@ -223,7 +195,6 @@
 : core (_core), runtime (*(dynamic_cast<Ekiga::Runtime *> (core.get ("runtime"))))
 {
   /* Initialise the endpoint paramaters */
-  video_grabber = NULL;
   SetCallingState (GMManager::Standby);
 
 #ifdef HAVE_AVAHI
@@ -257,7 +228,7 @@
   SetVideoPreviewDevice (video);
   
   video = GetVideoInputDevice();
-  video.deviceName = "Moving logo";
+  video.deviceName = "EKIGA";
   SetVideoInputDevice (video);
 
   // Create endpoints
@@ -589,9 +560,9 @@
     if (media_format.GetDefaultSessionID () == OpalMediaFormat::DefaultVideoSessionID) {
 
       media_format.SetOptionInteger (OpalVideoFormat::FrameWidthOption (), 
-                                     video_sizes [options.size].width);  
+                                     Ekiga::VideoSizes [options.size].width);  
       media_format.SetOptionInteger (OpalVideoFormat::FrameHeightOption (), 
-                                     video_sizes [options.size].height);  
+                                     Ekiga::VideoSizes [options.size].height);  
       media_format.SetOptionInteger (OpalVideoFormat::FrameTimeOption (),
                                      (int) (90000 / options.maximum_frame_rate));
       media_format.SetOptionInteger (OpalVideoFormat::MaxBitRateOption (), 
@@ -663,8 +634,8 @@
       int j = 0;
       for (j = 0; j < NB_VIDEO_SIZES; j++) {
 
-        if (video_sizes [j].width == media_format.GetOptionInteger (OpalVideoFormat::FrameWidthOption ())
-            && video_sizes [j].width == media_format.GetOptionInteger (OpalVideoFormat::FrameWidthOption ()))
+        if (Ekiga::VideoSizes [j].width == media_format.GetOptionInteger (OpalVideoFormat::FrameWidthOption ())
+            && Ekiga::VideoSizes [j].width == media_format.GetOptionInteger (OpalVideoFormat::FrameWidthOption ()))
           break;
       }
       options.size = j;
@@ -695,8 +666,6 @@
 
   RemoveAccountsEndpoint ();
 
-  RemoveVideoGrabber ();
-
   RemoveSTUNClient ();
 }
 
@@ -714,47 +683,6 @@
 }
 
 
-void GMManager::UpdateDevices ()
-{
-  bool preview = FALSE;
-  gchar *device_name = NULL;
-  unsigned size = 0;
-  unsigned max_frame_rate = 15;
-
-  /* Get the config settings */
-  gnomemeeting_threads_enter ();
-  preview = gm_conf_get_bool (VIDEO_DEVICES_KEY "enable_preview");
-  device_name = gm_conf_get_string (VIDEO_DEVICES_KEY "input_device");
-  size = gm_conf_get_int (VIDEO_DEVICES_KEY "size");
-  max_frame_rate = gm_conf_get_int (VIDEO_CODECS_KEY "max_frame_rate");
-  gnomemeeting_threads_leave ();
-
-  /* Do not change these values during calls */
-  if (GetCallingState () == GMManager::Standby) {
-
-    /* Video preview */
-    if (preview) {
-      GMVideoGrabber *vg = GetVideoGrabber ();
-      if (vg) {
-        vg->StopGrabbing (); 
-        vg->Unlock ();
-      }
-      PThread::Sleep (1000);
-      CreateVideoGrabber (TRUE, TRUE, video_sizes[size].width, video_sizes[size].height, max_frame_rate);
-    }
-    else 
-      RemoveVideoGrabber ();
-
-    /* Update the video input device */
-    PVideoDevice::OpenArgs video = GetVideoInputDevice();
-    video.deviceName = device_name;
-    SetVideoInputDevice (video);
-  }
-
-  g_free (device_name);
-}
-
-
 void 
 GMManager::SetCallingState (CallingState i)
 {
@@ -950,51 +878,6 @@
 }
 
 
-GMVideoGrabber *
-GMManager::CreateVideoGrabber (bool start_grabbing,
-                               bool synchronous,
-			       unsigned width,
-			       unsigned height,
-			       unsigned rate)
-{
-  PWaitAndSignal m(vg_access_mutex);
-
-  if (video_grabber)
-    delete (video_grabber);
-
-  video_grabber = new GMVideoGrabber (start_grabbing, synchronous, width, height, rate, *this);
-
-  return video_grabber;
-}
-
-
-void
-GMManager::RemoveVideoGrabber ()
-{
-  PWaitAndSignal m(vg_access_mutex);
-
-  PTRACE(4, "GMManager\t Deleting grabber device");  //FIXME: There seems to be a problem in win32 since 2.0.x here
-  if (video_grabber) {
-
-    delete (video_grabber);
-  }      
-  PTRACE(4, "GMManager\t Sucessfully deleted grabber device");  //FIXME: There seems to be a problem in win32 since 2.0.x here
-  video_grabber = NULL;
-}
-
-
-GMVideoGrabber *
-GMManager::GetVideoGrabber ()
-{
-  PWaitAndSignal m(vg_access_mutex);
-
-  if (video_grabber)
-    video_grabber->Lock ();
-  
-  return video_grabber;
-}
-
-
 void
 GMManager::UpdatePublishers (void)
 {
@@ -1247,10 +1130,6 @@
 
   /* Reinitialize codecs */
   re_audio_codec = tr_audio_codec = re_video_codec = tr_video_codec = "";
-
-  /* Try to update the devices use if some settings were changed 
-     during the call */
-  UpdateDevices ();
 }
 
 
@@ -1337,9 +1216,6 @@
   else
     SetTranslationAddress (PString ("0.0.0.0")); 
   
-  /* Update general devices configuration */
-  UpdateDevices ();
-  
   /* Set the User Name and Alias */  
   SetUserNameAndAlias ();
 
@@ -1368,19 +1244,6 @@
 			network_interface_changed_nt, this);
   gm_conf_notifier_add (NAT_KEY "public_ip",
 			public_ip_changed_nt, this);
-  gm_conf_notifier_add (VIDEO_DEVICES_KEY "input_device", 
-			video_device_changed_nt, this);
-  gm_conf_notifier_add (VIDEO_DEVICES_KEY "channel", 
-			video_device_changed_nt, this);
-  gm_conf_notifier_add (VIDEO_DEVICES_KEY "size", 
-			video_device_changed_nt, this);
-  gm_conf_notifier_add (VIDEO_DEVICES_KEY "format", 
-			video_device_changed_nt, this);
-  gm_conf_notifier_add (VIDEO_DEVICES_KEY "image", 
-			video_device_changed_nt, this);
-  gm_conf_notifier_add (VIDEO_DEVICES_KEY "enable_preview", 
-			video_device_changed_nt, this);
-
   gm_conf_notifier_add (PERSONAL_DATA_KEY "status",
 			status_changed_nt, this);
 }
@@ -1641,95 +1504,6 @@
   return err;
 }
 
-
-bool
-GMManager::CreateVideoInputDevice (G_GNUC_UNUSED const OpalConnection &con,
-				   const OpalMediaFormat &format,
-				   PVideoInputDevice * & device,
-				   bool & auto_delete)
-{
-  GMVideoGrabber *vg = NULL;
-  auto_delete = FALSE;
-
-  unsigned width  = format.GetOptionInteger(OpalVideoFormat::FrameWidthOption (),  PVideoFrameInfo::QCIFWidth);
-  unsigned height = format.GetOptionInteger(OpalVideoFormat::FrameHeightOption (), PVideoFrameInfo::QCIFHeight);
-  unsigned rate   = round ((double)format.GetClockRate() / (double)format.GetFrameTime());
-
-  PTRACE(4, "GMManager\tCreating grabber with " << width << "x" << height << "/" << rate);
-  vg = GetVideoGrabber ();
-  if (!vg) {
-    CreateVideoGrabber (FALSE, TRUE, width, height, rate);
-    vg = GetVideoGrabber ();
-  } 
-  else {
-    if ((vg->GetWidth()     != width)  ||
-        (vg->GetHeight()    != height) ||
-        (vg->GetFrameRate() != rate)) {
-      // We have negotiated a different resolution than the 
-      // preview device was configure with
-      CreateVideoGrabber (FALSE, TRUE, width, height, rate);
-      vg = GetVideoGrabber ();
-    }
-  }
-
-  vg->StopGrabbing ();
-  device = vg->GetInputDevice ();
-  vg->Unlock ();
-  
-  return (device != NULL);
-}
-
-
-bool 
-GMManager::CreateVideoOutputDevice(G_GNUC_UNUSED const OpalConnection & connection,
-				   const OpalMediaFormat & format,
-				   bool preview,
-				   PVideoOutputDevice * & device,
-				   bool & auto_delete)
-{
-  const PVideoDevice::OpenArgs & args = videoOutputDevice;
-
-  /* Display of the input video, the display already
-   * has the same size as the grabber 
-   */
-  if (preview) {
-
-    GMVideoGrabber *vg = NULL;
-    auto_delete = FALSE;
-
-    vg = GetVideoGrabber ();
-
-    if (vg) {
-
-      device = vg->GetOutputDevice ();
-      vg->Unlock ();
-    }
-    return (device != NULL);
-  }
-  else { /* Display of the video we are receiving */
-    
-    auto_delete = TRUE;
-    device = PVideoOutputDevice::CreateDeviceByName (args.deviceName);
-    
-    if (device != NULL) {
-      
-      videoOutputDevice.width = 
-	format.GetOptionInteger(OpalVideoFormat::FrameWidthOption (),  PVideoFrameInfo::QCIFWidth);
-      videoOutputDevice.height = 
-	format.GetOptionInteger(OpalVideoFormat::FrameHeightOption (), PVideoFrameInfo::QCIFHeight);
-      videoOutputDevice.rate = format.GetClockRate() / format.GetFrameTime();
-
-      if (device->OpenFull (args, FALSE))
-	return TRUE;
-
-      delete device;
-    }
-  }
-
-  return FALSE;
-}
-
-
 void
 GMManager::on_dial (std::string uri)
 {

Modified: trunk/src/endpoints/manager.h
==============================================================================
--- trunk/src/endpoints/manager.h	(original)
+++ trunk/src/endpoints/manager.h	Sat Feb 23 08:57:02 2008
@@ -49,8 +49,6 @@
 
 #include "accounts.h"
 
-#include "videoinput.h"
-
 #include "stun.h"
 
 #include "accountshandler.h"
@@ -222,52 +220,6 @@
   bool AcceptCurrentIncomingCall ();
 
   
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Update the internal audio and video devices for playing
-   *                 and recording following the config database content.
-   *                 If a Quicknet card is used, it will be opened, and if
-   *                 a video grabber is used in preview mode, it will also
-   *"                be opened.
-   * PRE          :  /
-   */
-  void UpdateDevices ();
-
-
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Creates a video grabber.
-   * PRE          :  If TRUE, then the grabber will start
-   *                 grabbing after its creation. If TRUE,
-   *                 then the opening is done sync.
-   */  
-  GMVideoGrabber *CreateVideoGrabber (bool start_grabbing, 
-				      bool synchronous,
-				      unsigned width,
-				      unsigned height,
-				      unsigned rate);
-
-
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Removes the current video grabber, if any.
-   * PRE          :  /
-   */  
-  void RemoveVideoGrabber ();
-
-
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Returns the current videograbber, if any.
-   *                 The pointer is locked, which means that the device
-   *                 can't be deleted until the pointer is unlocked with
-   *                 Unlock. This is a protection to always manipulate
-   *                 existing objects. Notice that all methods in the
-   *                 GMH323Endpoint class related to the GMVideoGrabber
-   *                 use internal mutexes so that the pointer cannot be
-   *                 returned during a RemoveVideoGrabber/CreateVideoGrabber,
-   *                 among others. You should use those functions and not
-   *                 manually delete the GMVideoGrabber.
-   * PRE          :  /
-   */
-  GMVideoGrabber *GetVideoGrabber ();
-
 
   /* DESCRIPTION  :  /
    * BEHAVIOR     :  Returns the local or remote OpalConnection for the 
@@ -331,28 +283,6 @@
   void OnMessageSent (const PString & to,
                       const PString & body);
 
-  /* DESCRIPTION  :  This callback is called when an input video device 
-   *                 has to be opened.
-   * BEHAVIOR     :  Initialise the PVideoInputDevice.
-   * PRE          :  /
-   */
-  bool CreateVideoInputDevice (const OpalConnection &,
-			       const OpalMediaFormat &,
-			       PVideoInputDevice * &,
-			       bool &);
-
-  
-  /* DESCRIPTION  :  This callback is called when an input video device 
-   *                 has to be opened.
-   * BEHAVIOR     :  Initialise the PVideoOutputDevice.
-   * PRE          :  /
-   */
-  bool CreateVideoOutputDevice(const OpalConnection &,
-			       const OpalMediaFormat &,
-			       bool,
-			       PVideoOutputDevice * &,
-			       bool &);
-
 
   /** Return the list of available codecs
    * @return a set of the codecs and their descriptions
@@ -640,7 +570,6 @@
 
   /* The various components of the endpoint */
   GMAccountsEndpoint *manager;
-  GMVideoGrabber *video_grabber;
   GMH323Gatekeeper *gk;
   GMStunClient *sc;
 

Modified: trunk/src/gui/assistant.cpp
==============================================================================
--- trunk/src/gui/assistant.cpp	(original)
+++ trunk/src/gui/assistant.cpp	Sat Feb 23 08:57:02 2008
@@ -45,6 +45,8 @@
 #include "toolbox/toolbox.h"
 #include "assistant.h"
 
+#include "vidinput-core.h"
+
 G_DEFINE_TYPE(EkigaAssistant, ekiga_assistant, GTK_TYPE_ASSISTANT)
 
 struct _EkigaAssistantPrivate
@@ -798,18 +800,79 @@
   gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox, TRUE);
 }
 
+// FIXME: duplicate to gm_prefs_window_get_video_devices_list
+void 
+get_video_devices_list (Ekiga::ServiceCore *core,
+                                        std::vector<std::string> & plugin_list,
+                                        std::vector<std::string> & device_list)
+{
+  Ekiga::VidInputCore *vidinput_core = dynamic_cast<Ekiga::VidInputCore *> (core->get ("vidinput-core"));
+  std::vector <Ekiga::VidInputDevice> vidinput_devices;
+  Ekiga::VidInputDevice vidinput_device;
+
+  vidinput_core->get_vidinput_devices(vidinput_devices);
+
+  std::string plugin_string;
+  std::string device_string;
+
+  gchar *current_plugin = NULL;
+  current_plugin = gm_conf_get_string (VIDEO_DEVICES_KEY "plugin");
+
+  for (std::vector<Ekiga::VidInputDevice>::iterator iter = vidinput_devices.begin ();
+       iter != vidinput_devices.end ();
+       iter++) {
+
+    vidinput_device = (*iter);
+    plugin_string = vidinput_device.type + "/" + vidinput_device.source;
+    plugin_list.push_back(plugin_string);
+
+    if (current_plugin && plugin_string == current_plugin) {
+      device_string = vidinput_device.device;
+      device_list.push_back(device_string);
+    }
+  }
+
+  if (device_list.size() == 0) {
+    device_string = _("No device found");
+      device_list.push_back(device_string);
+  }
+
+  g_free (current_plugin);
+
+}
+// FIXME: duplicate to gm_prefs_window_convert_string_list
+gchar**
+convert_string_list (const std::vector<std::string> & list)
+{
+  gchar **array = NULL;
+  unsigned i;
+
+  array = (gchar**) malloc (sizeof(gchar*) * (list.size() + 1));
+  for (i = 0; i < list.size(); i++)
+    array[i] = (gchar*) list[i].c_str();
+  array[i] = NULL;
+
+  return array;
+}
+
 static void
 prepare_video_manager_page (EkigaAssistant *assistant)
 {
-  char **array;
-  gchar *video_manager;
+  std::vector <std::string> plugin_list;
+  std::vector <std::string> device_list;
+  gchar** array;
+  gchar* current_plugin;
+
+  get_video_devices_list (assistant->priv->core, plugin_list, device_list);
 
-  array = GnomeMeeting::Process ()->GetVideoPlugins ().ToCharArray ();
-  video_manager = gm_conf_get_string (VIDEO_DEVICES_KEY "plugin");
+  array = convert_string_list (plugin_list);
+
+  current_plugin = gm_conf_get_string (VIDEO_DEVICES_KEY "plugin");
 
   update_combo_box (GTK_COMBO_BOX (assistant->priv->video_manager),
-                    array, video_manager);
-  free (array);
+                    array, current_plugin);
+
+  g_free (array);
 }
 
 static void

Modified: trunk/src/gui/callbacks.cpp
==============================================================================
--- trunk/src/gui/callbacks.cpp	(original)
+++ trunk/src/gui/callbacks.cpp	Sat Feb 23 08:57:02 2008
@@ -274,7 +274,6 @@
   Ekiga::ServiceCore *core = GnomeMeeting::Process ()->GetServiceCore ();
   GMManager *manager = dynamic_cast<GMManager*> (core->get("opal-component"));
   manager->ClearAllCalls ();
-  manager->RemoveVideoGrabber ();
   gdk_threads_enter ();
   
   main_window = GnomeMeeting::Process ()->GetMainWindow ();

Modified: trunk/src/gui/main.cpp
==============================================================================
--- trunk/src/gui/main.cpp	(original)
+++ trunk/src/gui/main.cpp	Sat Feb 23 08:57:02 2008
@@ -90,6 +90,8 @@
 
 #include <libxml/parser.h>
 
+#include "vidinput-core.h"
+
 #include "call-core.h"
 #include "gtk-frontend.h"
 #include "services.h"
@@ -2389,7 +2391,6 @@
 			   G_GNUC_UNUSED gpointer data)
 { 
 /*  GMManager *ep = NULL;
-  GMVideoGrabber *video_grabber = NULL;
 
   bool success = FALSE;
 
@@ -2416,8 +2417,6 @@
      if the GDK lock is held as it will wait on the GDK lock before 
      updating the GUI */
 /*  gdk_threads_leave ();
-  if ((video_grabber = ep->GetVideoGrabber ())) {
-
     if (whiteness > 0)
       success = video_grabber->SetWhiteness (whiteness << 8);
     if (brightness > 0)
@@ -2426,8 +2425,7 @@
       success = video_grabber->SetColour (colour << 8) || success;
     if (contrast > 0)
       success = video_grabber->SetContrast (contrast << 8) || success;
-    video_grabber->Unlock ();
-  }
+
   gdk_threads_enter ();
 
   if (!success)
@@ -3796,6 +3794,57 @@
   conn = display_core->hw_accel_status_changed.connect (sigc::bind (sigc::ptr_fun (on_hw_accel_status_changed_cb), (gpointer) window));
   mw->connections.push_back (conn);
 
+
+  Ekiga::VidInputCore *vidinput_core = dynamic_cast<Ekiga::VidInputCore *> (mw->core.get ("vidinput-core"));
+  Ekiga::VidInputDevice vidinput_device;
+  std::vector <Ekiga::VidInputDevice> vidinput_devices;
+  vidinput_core->get_vidinput_devices(vidinput_devices);
+
+  // we have to register the error callback here...		    
+// 	dialog_title =
+// 	  g_strdup_printf (_("Error while opening video device %s"),
+// 			   (const char *) input_device);
+// 
+// 	tmp_msg = g_strdup (_("A moving logo will be transmitted during calls. Notice that you can always transmit a given image or the moving logo by choosing \"Picture\" as video plugin and \"Moving logo\" or \"Static picture\" as device."));
+// 	switch (error_code) {
+// 	  
+// 	case 1:
+// 	  dialog_msg = g_strconcat (tmp_msg, "\n\n", _("There was an error while opening the device. Please check your permissions and make sure that the appropriate driver is loaded."), NULL);
+// 	  break;
+// 	  
+// 	case 2:
+// 	  dialog_msg = g_strconcat (tmp_msg, "\n\n", _("Your video driver doesn't support the requested video format."), NULL);
+// 	  break;
+// 
+// 	case 3:
+// 	  dialog_msg = g_strconcat (tmp_msg, "\n\n", _("Could not open the chosen channel."), NULL);
+// 	  break;
+//       
+// 	case 4:
+// 	  dialog_msg = g_strconcat (tmp_msg, "\n\n", _("Your driver doesn't seem to support any of the color formats supported by Ekiga.\n Please check your kernel driver documentation in order to determine which Palette is supported."), NULL);
+// 	  break;
+// 	  
+// 	case 5:
+// 	  dialog_msg = g_strconcat (tmp_msg, "\n\n", _("Error while setting the frame rate."), NULL);
+// 	  break;
+// 
+// 	case 6:
+// 	  dialog_msg = g_strconcat (tmp_msg, "\n\n", _("Error while setting the frame size."), NULL);
+// 	  break;
+// 
+// 	default:
+// 	  break;
+// 	}
+// 
+// 	gnomemeeting_warning_dialog_on_widget (GTK_WINDOW (main_window),
+// 					       VIDEO_DEVICES_KEY "enable_preview",
+// 					       dialog_title,
+// 					       "%s", dialog_msg);
+// 	g_free (dialog_msg);
+// 	g_free (dialog_title);
+// 	g_free (tmp_msg);
+// 
+
   /* New Call Engine signals */
   Ekiga::CallCore *call_core = dynamic_cast<Ekiga::CallCore *> (mw->core.get ("call-core"));
 

Modified: trunk/src/gui/preferences.cpp
==============================================================================
--- trunk/src/gui/preferences.cpp	(original)
+++ trunk/src/gui/preferences.cpp	Sat Feb 23 08:57:02 2008
@@ -75,6 +75,7 @@
   GtkWidget *audio_recorder;
   GtkWidget *video_device;
   GtkWidget *iface;
+  Ekiga::ServiceCore *core;
 } GmPreferencesWindow;
 
 #define GM_PREFERENCES_WINDOW(x) (GmPreferencesWindow *) (x)
@@ -804,6 +805,60 @@
 }
 
 
+void 
+gm_prefs_window_get_video_devices_list (Ekiga::ServiceCore *core,
+                                        std::vector<std::string> & plugin_list,
+                                        std::vector<std::string> & device_list)
+{
+  Ekiga::VidInputCore *vidinput_core = dynamic_cast<Ekiga::VidInputCore *> (core->get ("vidinput-core"));
+  std::vector <Ekiga::VidInputDevice> vidinput_devices;
+  Ekiga::VidInputDevice vidinput_device;
+
+  vidinput_core->get_vidinput_devices(vidinput_devices);
+
+  std::string plugin_string;
+  std::string device_string;
+
+  gchar *current_plugin = NULL;
+  current_plugin = gm_conf_get_string (VIDEO_DEVICES_KEY "plugin");
+
+  for (std::vector<Ekiga::VidInputDevice>::iterator iter = vidinput_devices.begin ();
+       iter != vidinput_devices.end ();
+       iter++) {
+
+    vidinput_device = (*iter);
+    plugin_string = vidinput_device.type + "/" + vidinput_device.source;
+    plugin_list.push_back(plugin_string);
+
+    if (current_plugin && plugin_string == current_plugin) {
+      device_string = vidinput_device.device;
+      device_list.push_back(device_string);
+    }
+  }
+
+  if (device_list.size() == 0) {
+    device_string = _("No device found");
+      device_list.push_back(device_string);
+  }
+
+  g_free (current_plugin);
+}
+
+gchar**
+gm_prefs_window_convert_string_list (const std::vector<std::string> & list)
+{
+  gchar **array = NULL;
+  unsigned i;
+
+  array = (gchar**) malloc (sizeof(gchar*) * (list.size() + 1));
+  for (i = 0; i < list.size(); i++)
+    array[i] = (gchar*) list[i].c_str();
+  array[i] = NULL;
+
+  return array;
+}
+
+
 static void
 gm_pw_init_video_devices_page (GtkWidget *prefs_window,
                                GtkWidget *container)
@@ -829,7 +884,7 @@
 
   for (i=0; i< NB_VIDEO_SIZES; i++) {
 
-    video_size[i] = g_strdup_printf  ( "%dx%d", video_sizes[i].width, video_sizes[i].height);
+    video_size[i] = g_strdup_printf  ( "%dx%d", Ekiga::VideoSizes[i].width, Ekiga::VideoSizes[i].height);
   }
 
   video_size [NB_VIDEO_SIZES] = NULL;
@@ -850,22 +905,30 @@
   subsection = gnome_prefs_subsection_new (prefs_window, container,
                                            _("Video Plugin"), 1, 2);
 
-  devs = GnomeMeeting::Process ()->GetVideoPlugins ();
-  array = devs.ToCharArray ();
+  std::vector <std::string> plugin_list;
+  std::vector <std::string> device_list;
+
+  gm_prefs_window_get_video_devices_list (pw->core, plugin_list, device_list);
+
+  array = gm_prefs_window_convert_string_list(plugin_list);
+
   gnome_prefs_string_option_menu_new (subsection, _("Video plugin:"), (const gchar **)array, VIDEO_DEVICES_KEY "plugin", _("The video plugin that will be used to detect the devices and manage them"), 0);
-  free (array);
 
+  g_free (array);
 
   /* The video devices related options */
   subsection = gnome_prefs_subsection_new (prefs_window, container,
                                            _("Video Devices"), 5, 3);
 
   /* The video device */
-  devs = GnomeMeeting::Process ()->GetVideoInputDevices ();
-  array = devs.ToCharArray ();
+
+  array = gm_prefs_window_convert_string_list(device_list);
+
   pw->video_device =
     gnome_prefs_string_option_menu_new (subsection, _("Input device:"), (const gchar **)array, VIDEO_DEVICES_KEY "input_device", _("Select the video input device to use. If an error occurs when using this device a test picture will be transmitted."), 0);
-  free (array);
+
+  g_free (array);
+
 
   /* Video Channel */
   gnome_prefs_spin_new (subsection, _("Channel:"), VIDEO_DEVICES_KEY "channel", _("The video channel number to use (to select camera, tv or other sources)"), 0.0, 10.0, 1.0, 3, NULL, false);
@@ -1282,12 +1345,10 @@
   free (array);
 }
 
-
 void 
 gm_prefs_window_update_devices_list (GtkWidget *prefs_window, 
 				     PStringArray audio_input_devices,
-				     PStringArray audio_output_devices,
-				     PStringArray video_input_devices)
+				     PStringArray audio_output_devices)
 {
   GmPreferencesWindow *pw = NULL;
 
@@ -1318,11 +1379,18 @@
 
 
   /* The Video player */
-  array = video_input_devices.ToCharArray ();
+  std::vector <std::string> plugin_list;
+  std::vector <std::string> device_list;
+
+  gm_prefs_window_get_video_devices_list (pw->core, plugin_list, device_list);
+
+  array = gm_prefs_window_convert_string_list(device_list);
+
   gnome_prefs_string_option_menu_update (pw->video_device,
 					 (const gchar **)array,
 					 VIDEO_DEVICES_KEY "input_device");
-  free (array);
+
+  g_free (array);
 }
 
 
@@ -1404,7 +1472,7 @@
 
 
 GtkWidget *
-gm_prefs_window_new ()
+gm_prefs_window_new (Ekiga::ServiceCore *core)
 {
   GmPreferencesWindow *pw = NULL;
 
@@ -1429,6 +1497,9 @@
 
   /* The GMObject data */
   pw = new GmPreferencesWindow ();
+
+  pw->core = core;
+
   g_object_set_data_full (G_OBJECT (window), "GMObject", 
 			  pw, (GDestroyNotify) gm_pw_destroy);
 

Modified: trunk/src/gui/preferences.h
==============================================================================
--- trunk/src/gui/preferences.h	(original)
+++ trunk/src/gui/preferences.h	Sat Feb 23 08:57:02 2008
@@ -41,6 +41,8 @@
 #define _PREFERENCES_H_
 
 #include "common.h"
+#include "framework/services.h"
+#include "vidinput-core.h"
 
 
 /* DESCRIPTION  :  /
@@ -59,8 +61,7 @@
  */
 void gm_prefs_window_update_devices_list (GtkWidget *prefs_window,
 					  PStringArray audio_input_devices,
-					  PStringArray audio_output_devices,
-					  PStringArray video_input_devices);
+					  PStringArray audio_output_devices);
 
 
 /* DESCRIPTION  :  / 
@@ -76,7 +77,7 @@
  *                 to appropriate callbacks, then returns it.
  * PRE          :  /
  */
-GtkWidget *gm_prefs_window_new ();
+GtkWidget *gm_prefs_window_new (Ekiga::ServiceCore *core);
 
 
 #endif



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