ekiga r5981 - in trunk: . lib/engine lib/engine/vidinput lib/engine/vidinput/mlogo lib/engine/vidinput/ptlib lib/engine/vidinput/skel



Author: mschneid
Date: Wed Feb 20 19:09:59 2008
New Revision: 5981
URL: http://svn.gnome.org/viewvc/ekiga?rev=5981&view=rev

Log:
Added the Video Input engine. Not activated yet.
Preview video and all state changes between streaming video
and preview video handled by the core.
Added a Moving Logo Manager.
Added a PTLIB Video Input Manager.
Add a gmconf-bridge for all relevant keys.
Allow switching a device at any time, even during a call.



Added:
   trunk/lib/engine/vidinput/
   trunk/lib/engine/vidinput/Makefile.am
   trunk/lib/engine/vidinput/mlogo/
   trunk/lib/engine/vidinput/mlogo/Makefile.am
   trunk/lib/engine/vidinput/mlogo/vidinput-main-mlogo.cpp
   trunk/lib/engine/vidinput/mlogo/vidinput-main-mlogo.h
   trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.cpp
   trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.h
   trunk/lib/engine/vidinput/ptlib/
   trunk/lib/engine/vidinput/ptlib/Makefile.am
   trunk/lib/engine/vidinput/ptlib/vidinput-main-ptlib.cpp
   trunk/lib/engine/vidinput/ptlib/vidinput-main-ptlib.h
   trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.cpp
   trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.h
   trunk/lib/engine/vidinput/skel/
   trunk/lib/engine/vidinput/skel/Makefile.am
   trunk/lib/engine/vidinput/skel/vidinput-core.cpp
   trunk/lib/engine/vidinput/skel/vidinput-core.h
   trunk/lib/engine/vidinput/skel/vidinput-gmconf-bridge.cpp
   trunk/lib/engine/vidinput/skel/vidinput-gmconf-bridge.h
   trunk/lib/engine/vidinput/skel/vidinput-info.h
   trunk/lib/engine/vidinput/skel/vidinput-manager.h
Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/lib/engine/Makefile.am
   trunk/lib/engine/engine.cpp

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Wed Feb 20 19:09:59 2008
@@ -688,6 +688,10 @@
 lib/engine/display/skel/Makefile
 lib/engine/display/x/Makefile
 lib/engine/display/dx/Makefile
+lib/engine/vidinput/Makefile
+lib/engine/vidinput/skel/Makefile
+lib/engine/vidinput/mlogo/Makefile
+lib/engine/vidinput/ptlib/Makefile
 lib/engine/gui/Makefile
 lib/engine/gui/gtk-core/Makefile
 lib/engine/gui/gtk-frontend/Makefile

Modified: trunk/lib/engine/Makefile.am
==============================================================================
--- trunk/lib/engine/Makefile.am	(original)
+++ trunk/lib/engine/Makefile.am	Wed Feb 20 19:09:59 2008
@@ -1,4 +1,4 @@
-SUBDIRS = framework addressbook presence gui protocol display components
+SUBDIRS = framework addressbook presence gui protocol display vidinput components
 
 noinst_LTLIBRARIES = libekiga_engine.la
 
@@ -17,6 +17,7 @@
 	-I$(top_srcdir)/lib/engine/presence/avahi			\
 	-I$(top_srcdir)/lib/engine/presence/local-roster		\
 	-I$(top_srcdir)/lib/engine/display/skel				\
+	-I$(top_srcdir)/lib/engine/vidinput/skel			\
 	-I$(top_srcdir)/lib/engine/components/gmconf-personal-details
 
 # XVideo/X
@@ -33,6 +34,15 @@
 	-I$(top_srcdir)/lib/engine/display/dx
 endif
 		
+# Default Input Devices
+INCLUDES +=                                             \
+	-I$(top_srcdir)/lib/engine/vidinput/mlogo
+
+# Default PTLIB Input Devices
+INCLUDES +=                                             \
+	-I$(top_srcdir)/lib/engine/vidinput/ptlib
+
+
 libekiga_engine_la_SOURCES = engine.h engine.cpp
 
 AM_CXXFLAGS = $(SIGC_CFLAGS) $(GTK_CFLAGS)
@@ -49,9 +59,18 @@
 	$(top_builddir)/lib/engine/presence/skel/libgmpresence.la 					\
 	$(top_builddir)/lib/engine/presence/local-roster/liblocal-roster.la 				\
 	$(top_builddir)/lib/engine/display/skel/libgmdisplay.la						\
+	$(top_builddir)/lib/engine/vidinput/skel/libgmvidinput.la					\
 	$(top_builddir)/lib/engine/components/gmconf-personal-details/libgmconfpersonaldetails.la	\
 	$(AM_LIBS)
 
+# Default Input Devices
+libekiga_engine_la_LIBADD += \
+	$(top_builddir)/lib/engine/vidinput/mlogo/libgmvidinput-mlogo.la
+
+# PTLIB Input Devices
+libekiga_engine_la_LIBADD += \
+	$(top_builddir)/lib/engine/vidinput/ptlib/libgmvidinput-ptlib.la
+
 # XVideo/X
 if !WIN32
 libekiga_engine_la_LIBADD += \

Modified: trunk/lib/engine/engine.cpp
==============================================================================
--- trunk/lib/engine/engine.cpp	(original)
+++ trunk/lib/engine/engine.cpp	Wed Feb 20 19:09:59 2008
@@ -45,6 +45,7 @@
 #include "contact-core.h"
 #include "call-core.h"
 #include "display-core.h"
+#include "vidinput-core.h"
 #include "history-main.h"
 #include "local-roster-main.h"
 #include "local-roster-bridge.h"
@@ -60,6 +61,10 @@
 #include "display-main-dx.h"
 #endif
 
+#include "vidinput-main-mlogo.h"
+
+#include "vidinput-main-ptlib.h"
+
 #include "opal-main.h"
 
 #ifdef HAVE_AVAHI
@@ -86,11 +91,13 @@
   Ekiga::ContactCore *contact_core = new Ekiga::ContactCore;
   Ekiga::CallCore *call_core = new Ekiga::CallCore;
   Ekiga::DisplayCore *display_core = new Ekiga::DisplayCore;
+  Ekiga::VidInputCore *vidinput_core = new Ekiga::VidInputCore(*display_core);
 
   core->add (*contact_core);
   core->add (*presence_core);
   core->add (*call_core);
   core->add (*display_core);
+  core->add (*vidinput_core);
   core->add (*runtime);
 
   if (!gmconf_personal_details_init (*core, &argc, &argv)) {
@@ -112,6 +119,16 @@
   }
 #endif
 
+  if (!vidinput_mlogo_init (*core, &argc, &argv)) {
+    delete core;
+    return;
+  }
+
+  if (!vidinput_ptlib_init (*core, &argc, &argv)) {
+    delete core;
+    return;
+  }
+
   if (!opal_init (*core, &argc, &argv)) {
     delete core;
     return;
@@ -163,4 +180,6 @@
     delete core;
     return;
   }
+
+  vidinput_core->setup_conf_bridge();
 }

Added: trunk/lib/engine/vidinput/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/Makefile.am	Wed Feb 20 19:09:59 2008
@@ -0,0 +1 @@
+SUBDIRS = skel mlogo ptlib

Added: trunk/lib/engine/vidinput/mlogo/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/mlogo/Makefile.am	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,22 @@
+noinst_LTLIBRARIES = libgmvidinput-mlogo.la
+
+vidinput_dir = $(top_srcdir)/lib/engine/vidinput/mlogo
+
+AM_CXXFLAGS = $(SIGC_CFLAGS) $(GLIB_CFLAGS)
+
+INCLUDES = \
+	-I$(top_srcdir)/lib/gmconf \
+	-I$(top_srcdir)/pixmaps \
+	-I$(top_srcdir)/lib/engine/include \
+	-I$(top_srcdir)/lib/engine/framework \
+	-I$(top_srcdir)/lib/engine/display/skel \
+	-I$(top_srcdir)/lib/engine/vidinput/skel \
+	-I$(top_srcdir)/lib/engine/vidinput/mlogo
+
+libgmvidinput_mlogo_la_SOURCES = \
+	$(vidinput_dir)/vidinput-manager-mlogo.h \
+	$(vidinput_dir)/vidinput-manager-mlogo.cpp \
+	$(vidinput_dir)/vidinput-main-mlogo.h \
+	$(vidinput_dir)/vidinput-main-mlogo.cpp 
+
+libgmvidinput_mlogo_la_LDFLAGS = -export-dynamic -no-undefined $(SIGC_LIBS) $(GLIB_LIBS)

Added: trunk/lib/engine/vidinput/mlogo/vidinput-main-mlogo.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/mlogo/vidinput-main-mlogo.cpp	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,63 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         vidinput-main-mlogo.cpp  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Matthias Schneider
+ *   copyright            : (c) 2008 by Matthias Schneider
+ *   description          : code to hook the Moving Logo vidinput manager 
+ *                          into the main program
+ *
+ */
+
+#include "vidinput-main-mlogo.h"
+#include "vidinput-core.h"
+#include "vidinput-manager-mlogo.h"
+
+bool
+vidinput_mlogo_init (Ekiga::ServiceCore &core,
+	    int */*argc*/,
+	    char **/*argv*/[])
+{
+  bool result = false;
+  Ekiga::VidInputCore *vidinput_core = NULL;
+
+  vidinput_core
+    = dynamic_cast<Ekiga::VidInputCore*>(core.get ("vidinput-core"));
+
+  if (vidinput_core != NULL) {
+
+    GMVidInputManager_mlogo *vidinput_manager = new GMVidInputManager_mlogo(core);
+
+    vidinput_core->add_manager (*vidinput_manager);
+    result = true;
+  }
+
+  return result;
+}

Added: trunk/lib/engine/vidinput/mlogo/vidinput-main-mlogo.h
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/mlogo/vidinput-main-mlogo.h	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,48 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         vidinput-main-mlogo.h  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Matthias Schneider
+ *   copyright            : (c) 2008 by Matthias Schneider
+ *   description          : code to hook the Moving Logo vidinput manager 
+ *                          into the main program
+ *
+ */
+
+#ifndef __VIDINPUT_MAIN_MLOGO_H__
+#define __VIDINPUT_MAIN_MLOGO_H__
+
+#include "services.h"
+
+bool vidinput_mlogo_init (Ekiga::ServiceCore &core,
+  		     int *argc,
+		     char **argv[]);
+
+#endif

Added: trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.cpp	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,177 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+
+ * This program is free software; you can  redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ *                         vidinput-manager-mlogo.cpp  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Matthias Schneider
+ *   copyright            : (c) 2008 by Matthias Schneider
+ *   description          : Declaration of the interface of a vidinput core.
+ *                          A vidinput core manages VidInputManagers.
+ *
+ */
+
+#include "vidinput-manager-mlogo.h"
+#include "icon.h"
+
+#define DEVICE_TYPE "Moving Logo"
+#define DEVICE_SOURCE "Moving Logo"
+#define DEVICE_DEVICE "Moving Logo"
+
+GMVidInputManager_mlogo::GMVidInputManager_mlogo (Ekiga::ServiceCore & _core)
+:    core (_core), runtime (*(dynamic_cast<Ekiga::Runtime *> (_core.get ("runtime"))))
+{
+  current_state.opened  = false;
+}
+
+void GMVidInputManager_mlogo::get_vidinput_devices(std::vector <Ekiga::VidInputDevice> & vidinput_devices)
+{
+  Ekiga::VidInputDevice vidinput_device;
+  vidinput_device.type   = DEVICE_TYPE;
+  vidinput_device.source = DEVICE_SOURCE;
+  vidinput_device.device = DEVICE_DEVICE;
+  vidinput_devices.push_back(vidinput_device);
+}
+
+bool GMVidInputManager_mlogo::set_vidinput_device (const Ekiga::VidInputDevice & vidinput_device, int channel, Ekiga::VideoFormat format)
+{
+  if ( ( vidinput_device.type   == DEVICE_TYPE ) &&
+       ( vidinput_device.source == DEVICE_SOURCE) &&
+       ( vidinput_device.device == DEVICE_DEVICE) ) {
+
+    PTRACE(4, "GMVidInputManager_mlogo\tSetting Device Moving Logo");
+    current_state.vidinput_device = vidinput_device;
+    current_state.channel = channel;
+    current_state.format  = format;
+    return true;
+  }
+  return false;
+}
+
+bool GMVidInputManager_mlogo::open (unsigned width, unsigned height, unsigned fps)
+{
+  PTRACE(4, "GMVidInputManager_mlogo\tOpening Moving Logo with " << width << "x" << height << "/" << fps);
+  current_state.width  = width;
+  current_state.height = height;
+  current_state.fps    = fps;
+
+  pos = 0;
+  increment = 1;
+
+  background_frame = (char*) malloc ((current_state.width * current_state.height * 3) >> 1);
+  memset (background_frame, 0xd3, current_state.width*current_state.height); //ff
+  memset (background_frame + (current_state.width * current_state.height), 0x7f, (current_state.width*current_state.height) >> 2);
+  memset (background_frame + (current_state.width * current_state.height) + ((current_state.width*current_state.height) >> 2), 0x7f, (current_state.width*current_state.height) >> 2);
+
+  current_state.opened  = true;
+
+  m_Pacing.Restart();
+  return true;
+}
+
+void GMVidInputManager_mlogo::close()
+{
+  PTRACE(4, "GMVidInputManager_mlogo\tClosing Moving Logo");
+  free (background_frame);
+  current_state.opened  = false;
+}
+
+void GMVidInputManager_mlogo::get_frame_data (unsigned & width,
+                     unsigned & height,
+                     char *data)
+{
+  if (!current_state.opened) {
+    PTRACE(1, "GMVidInputManager_mlogo\tTrying to get frame from closed device");
+    return;
+  }
+  
+  m_Pacing.Delay (1000 / current_state.fps);
+
+  memcpy (data, background_frame, (current_state.width * current_state.height * 3) >> 1);
+
+  CopyYUVArea  ((char*)&gm_icon_yuv, 
+                gm_icon_width, gm_icon_height, 
+                data, 
+                (current_state.width - gm_icon_width) >> 1, 
+                pos, 
+                current_state.width, current_state.height);
+  pos = pos + increment;
+
+  if ( pos > current_state.height - gm_icon_height - 10) 
+    increment = -1;
+  if (pos < 10) 
+    increment = +1;
+
+  width  = current_state.width;
+  height = current_state.height;
+}
+
+void GMVidInputManager_mlogo::CopyYUVArea (const char* srcFrame,
+					 unsigned srcWidth,
+					 unsigned srcHeight,
+					 char* dstFrame,
+					 unsigned dstX,
+					 unsigned dstY,
+					 unsigned dstWidth,
+					 unsigned dstHeight)
+{
+  unsigned line = 0;
+//Y
+  dstFrame += dstY * dstWidth;
+  for (line = 0; line<srcHeight; line++) {
+    if (dstY + line < dstHeight)
+      memcpy (dstFrame + dstX, srcFrame, srcWidth);
+    srcFrame += srcWidth;
+    dstFrame += dstWidth;
+  }
+  dstFrame += (dstHeight - dstY - srcHeight)* dstWidth;
+
+  dstY = dstY >> 1;
+  dstX = dstX >> 1;
+  srcWidth  = srcWidth >> 1;
+  srcHeight = srcHeight >> 1;
+  dstWidth  = dstWidth >> 1;
+  dstHeight = dstHeight >> 1;
+
+//U
+  dstFrame += dstY * dstWidth;
+  for (line = 0; line<srcHeight; line++) {
+    if (dstY + line < dstHeight)
+      memcpy (dstFrame + dstX, srcFrame , srcWidth);
+    srcFrame += srcWidth;
+    dstFrame += dstWidth;
+  }
+  dstFrame += (dstHeight - dstY - srcHeight)* dstWidth;
+
+//V
+  dstFrame += dstY * dstWidth;
+  for (line = 0; line<srcHeight; line++) {
+    if (dstY + line < dstHeight)
+      memcpy (dstFrame + dstX, srcFrame , srcWidth);
+    srcFrame += srcWidth;
+    dstFrame += dstWidth;
+  }
+}

Added: trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.h
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.h	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,110 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+
+ * This program is free software; you can  redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ *                         vidinput-manager-mlogo.h  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Matthias Schneider
+ *   copyright            : (c) 2008 by Matthias Schneider
+ *   description          : Declaration of the interface of a vidinput core.
+ *                          A vidinput core manages VidInputManagers.
+ *
+ */
+
+
+#ifndef __VIDINPUT_MANAGER_MLOGO_H__
+#define __VIDINPUT_MANAGER_MLOGO_H__
+
+#include "vidinput-core.h"
+#include "vidinput-manager.h"
+#include "runtime.h"
+
+#include "ptbuildopts.h"
+#include <ptclib/delaychan.h>
+
+/**
+ * @addtogroup vidinput
+ * @{
+ */
+
+  class GMVidInputManager_mlogo
+   : public Ekiga::VidInputManager
+    {
+  public:
+
+      /* The constructor
+       */
+      GMVidInputManager_mlogo (Ekiga::ServiceCore & core);
+      /* The destructor
+       */
+      ~GMVidInputManager_mlogo () {}
+
+
+      /*                 
+       * DISPLAY MANAGEMENT 
+       */               
+
+      /** Create a call based on the remote uri given as parameter
+       * @param uri  an uri
+       * @return     true if a Ekiga::Call could be created
+       */
+      virtual void get_vidinput_devices(std::vector <Ekiga::VidInputDevice> & vidinput_devices);
+      
+      virtual bool set_vidinput_device (const Ekiga::VidInputDevice & vidinput_device, int channel, Ekiga::VideoFormat format);
+
+      virtual bool open (unsigned width, unsigned height, unsigned fps);
+
+      virtual void close();
+
+      virtual void get_frame_data (unsigned & width,
+                           unsigned & height,
+                           char *data);
+
+  protected:  
+      void CopyYUVArea (const char* srcFrame,
+			unsigned srcWidth,
+			unsigned srcHeight,
+			char* dstFrame,
+			unsigned dstX,
+			unsigned dstY,
+			unsigned dstWidth,
+			unsigned dstHeight);
+
+      char* background_frame;
+      unsigned pos;
+      unsigned increment;
+
+      Ekiga::ServiceCore & core;
+      Ekiga::Runtime & runtime;
+
+      PAdaptiveDelay m_Pacing;
+  };
+/**
+ * @}
+ */
+
+
+#endif

Added: trunk/lib/engine/vidinput/ptlib/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/ptlib/Makefile.am	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,21 @@
+noinst_LTLIBRARIES = libgmvidinput-ptlib.la
+
+vidinput_dir = $(top_srcdir)/lib/engine/vidinput/ptlib
+
+AM_CXXFLAGS = $(SIGC_CFLAGS) $(GLIB_CFLAGS)
+
+INCLUDES = \
+	-I$(top_srcdir)/lib/gmconf \
+	-I$(top_srcdir)/lib/engine/include \
+	-I$(top_srcdir)/lib/engine/framework \
+	-I$(top_srcdir)/lib/engine/display/skel \
+	-I$(top_srcdir)/lib/engine/vidinput/skel \
+	-I$(top_srcdir)/lib/engine/vidinput/ptlib
+
+libgmvidinput_ptlib_la_SOURCES = \
+	$(vidinput_dir)/vidinput-manager-ptlib.h \
+	$(vidinput_dir)/vidinput-manager-ptlib.cpp \
+	$(vidinput_dir)/vidinput-main-ptlib.h \
+	$(vidinput_dir)/vidinput-main-ptlib.cpp 
+
+libgmvidinput_ptlib_la_LDFLAGS = -export-dynamic -no-undefined $(SIGC_LIBS) $(GLIB_LIBS)

Added: trunk/lib/engine/vidinput/ptlib/vidinput-main-ptlib.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/ptlib/vidinput-main-ptlib.cpp	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,63 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         vidinput-main-ptlib.cpp  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Matthias Schneider
+ *   copyright            : (c) 2008 by Matthias Schneider
+ *   description          : code to hook the PTLIB vidinput manager 
+ *                          into the main program
+ *
+ */
+
+#include "vidinput-main-ptlib.h"
+#include "vidinput-core.h"
+#include "vidinput-manager-ptlib.h"
+
+bool
+vidinput_ptlib_init (Ekiga::ServiceCore &core,
+	    int */*argc*/,
+	    char **/*argv*/[])
+{
+  bool result = false;
+  Ekiga::VidInputCore *vidinput_core = NULL;
+
+  vidinput_core
+    = dynamic_cast<Ekiga::VidInputCore*>(core.get ("vidinput-core"));
+
+  if (vidinput_core != NULL) {
+
+    GMVidInputManager_ptlib *vidinput_manager = new GMVidInputManager_ptlib(core);
+
+    vidinput_core->add_manager (*vidinput_manager);
+    result = true;
+  }
+
+  return result;
+}

Added: trunk/lib/engine/vidinput/ptlib/vidinput-main-ptlib.h
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/ptlib/vidinput-main-ptlib.h	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,48 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         vidinput-main-ptlib.h  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Matthias Schneider
+ *   copyright            : (c) 2008 by Matthias Schneider
+ *   description          : code to hook the PTLIB vidinput manager 
+ *                          into the main program
+ *
+ */
+
+#ifndef __VIDINPUT_MAIN_PTLIB_H__
+#define __VIDINPUT_MAIN_PTLIB_H__
+
+#include "services.h"
+
+bool vidinput_ptlib_init (Ekiga::ServiceCore &core,
+  		     int *argc,
+		     char **argv[]);
+
+#endif

Added: trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.cpp	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,200 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+
+ * This program is free software; you can  redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ *                         vidinput-manager-ptlib.cpp  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Matthias Schneider
+ *   copyright            : (c) 2008 by Matthias Schneider
+ *   description          : declaration of the interface of a vidinput core.
+ *                          A vidinput core manages VidInputManagers.
+ *
+ */
+
+#include "vidinput-manager-ptlib.h"
+#include "ptbuildopts.h"
+#include "ptlib.h"
+
+#define DEVICE_TYPE "PTLIB"
+
+GMVidInputManager_ptlib::GMVidInputManager_ptlib (Ekiga::ServiceCore & _core)
+:    core (_core), runtime (*(dynamic_cast<Ekiga::Runtime *> (_core.get ("runtime"))))
+{
+  current_state.colour = 0;
+  current_state.brightness = 0;
+  current_state.whiteness = 0;
+  current_state.contrast = 0;
+  current_state.opened = false;
+  input_device = NULL;
+}
+
+void GMVidInputManager_ptlib::get_vidinput_devices(std::vector <Ekiga::VidInputDevice> & vidinput_devices)
+{
+  PStringArray video_sources;
+  PStringArray video_devices;
+  char **sources_array;
+  char **devices_array;
+
+  Ekiga::VidInputDevice vidinput_device;
+  vidinput_device.type   = DEVICE_TYPE;
+
+  video_sources = PVideoInputDevice::GetDriverNames ();
+  sources_array = video_sources.ToCharArray ();
+  for (PINDEX i = 0; sources_array[i] != NULL; i++) {
+
+    vidinput_device.source = sources_array[i];
+
+    if ( (vidinput_device.source != "FakeVideo") &&
+         (vidinput_device.source != "EKIGA"    ) ) {
+      video_devices = PVideoInputDevice::GetDriversDeviceNames (vidinput_device.source);
+      devices_array = video_devices.ToCharArray ();
+  
+      for (PINDEX j = 0; devices_array[j] != NULL; j++) {
+  
+        vidinput_device.device = devices_array[j];
+        vidinput_devices.push_back(vidinput_device);  
+      }
+      free (devices_array);
+    }
+  }  
+  free (sources_array);
+}
+
+bool GMVidInputManager_ptlib::set_vidinput_device (const Ekiga::VidInputDevice & vidinput_device, int channel, Ekiga::VideoFormat format)
+{
+  if ( vidinput_device.type == DEVICE_TYPE ) {
+
+    PTRACE(4, "GMVidInputManager_ptlib\tSetting Device " << vidinput_device.source << "/" <<  vidinput_device.device);
+    current_state.vidinput_device = vidinput_device;  
+    current_state.channel = channel;
+    current_state.format = format;
+    return true;
+  }
+		    
+  return false;
+}
+
+bool GMVidInputManager_ptlib::open (unsigned width, unsigned height, unsigned fps)
+{
+  PTRACE(4, "GMVidInputManager_ptlib\tOpening Device " << current_state.vidinput_device.source << "/" <<  current_state.vidinput_device.device);
+  PTRACE(4, "GMVidInputManager_ptlib\tOpening Device with " << width << "x" << height << "/" << fps);
+  PVideoDevice::VideoFormat pvideo_format;
+
+  current_state.width  = width;
+  current_state.height = height;
+  current_state.fps    = fps;
+
+  pvideo_format = (PVideoDevice::VideoFormat)current_state.format;
+  input_device = PVideoInputDevice::CreateOpenedDevice (current_state.vidinput_device.source, current_state.vidinput_device.device, FALSE);
+
+  Ekiga::VidInputErrorCodes error_code = Ekiga::ERR_NONE;
+  if (!input_device)
+    error_code = Ekiga::ERR_DEVICE;
+  else if (!input_device->SetVideoFormat (pvideo_format))
+    error_code = Ekiga::ERR_FORMAT;
+  else if (!input_device->SetChannel (current_state.channel))
+    error_code = Ekiga::ERR_CHANNEL;
+  else if (!input_device->SetColourFormatConverter ("YUV420P"))
+    error_code = Ekiga::ERR_COLOUR;
+  else if (!input_device->SetFrameRate (current_state.fps))
+    error_code = Ekiga::ERR_FPS;
+  else if (!input_device->SetFrameSizeConverter (current_state.width, current_state.height, PVideoFrameInfo::eScale))
+    error_code = Ekiga::ERR_SCALE;
+
+  if (error_code != Ekiga::ERR_NONE) {
+    PTRACE(1, "GMVidInputManager_ptlib\tEncountered error " << error_code << " while opening device ");
+    runtime.run_in_main (sigc::bind (error.make_slot (), error_code));
+    return false;
+  }
+
+  input_device->SetColour(current_state.colour);
+  input_device->SetBrightness(current_state.brightness);
+  input_device->SetBrightness(current_state.whiteness);
+  input_device->SetContrast(current_state.contrast);
+  current_state.opened = true;
+
+  return true;
+}
+
+void GMVidInputManager_ptlib::close()
+{
+  PTRACE(4, "GMVidInputManager_ptlib\tClosing device " << current_state.vidinput_device.source << "/" <<  current_state.vidinput_device.device);
+  if (input_device) {
+   delete input_device;
+   input_device = NULL;
+  }
+  current_state.opened = false;
+}
+
+void GMVidInputManager_ptlib::get_frame_data (unsigned & width,
+                     unsigned & height,
+                     char *data)
+{
+  if (!current_state.opened) {
+    PTRACE(1, "GMVidInputManager_ptlib\tTrying to get frame from closed device");
+    return;
+  }
+
+  width = current_state.width;
+  height = current_state.height;
+
+  PINDEX I;
+
+  if (input_device)
+    input_device->GetFrameData ((BYTE*)data, &I);
+}
+
+void GMVidInputManager_ptlib::set_colour (unsigned colour)
+{
+  PTRACE(4, "GMVidInputManager_ptlib\tSetting colour to " << colour);
+  current_state.colour = colour;
+  if (input_device)
+    input_device->SetColour(colour);
+}
+
+void GMVidInputManager_ptlib::set_brightness (unsigned brightness)
+{
+  PTRACE(4, "GMVidInputManager_ptlib\tSetting brightness to " << brightness);
+  current_state.brightness = brightness;
+  if (input_device)
+    input_device->SetBrightness(brightness);
+}
+
+void GMVidInputManager_ptlib::set_whiteness (unsigned whiteness)
+{
+  PTRACE(4, "GMVidInputManager_ptlib\tSetting whiteness to " << whiteness);
+  current_state.whiteness = whiteness;
+  if (input_device)
+    input_device->SetBrightness(whiteness);
+}
+
+void GMVidInputManager_ptlib::set_contrast (unsigned contrast)
+{
+  PTRACE(4, "GMVidInputManager_ptlib\tSetting contrast to " << contrast);
+  current_state.contrast = contrast;
+  if (input_device)
+    input_device->SetContrast(contrast);
+}

Added: trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.h
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.h	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,100 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+
+ * This program is free software; you can  redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ *                         vidinput-manager-ptlib.h  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Matthias Schneider
+ *   copyright            : (c) 2008 by Matthias Schneider
+ *   description          : declaration of the interface of a vidinput core.
+ *                          A vidinput core manages VidInputManagers.
+ *
+ */
+
+
+#ifndef __VIDINPUT_MANAGER_PTLIB_H__
+#define __VIDINPUT_MANAGER_PTLIB_H__
+
+#include "vidinput-manager.h"
+#include "runtime.h"
+
+#include "ptbuildopts.h"
+#include <ptlib/videoio.h>
+/**
+ * @addtogroup vidinput
+ * @{
+ */
+
+  class GMVidInputManager_ptlib
+   : public Ekiga::VidInputManager
+    {
+  public:
+
+      /* The constructor
+       */
+      GMVidInputManager_ptlib (Ekiga::ServiceCore & core);
+      /* The destructor
+       */
+      ~GMVidInputManager_ptlib () {}
+
+
+      /*                 
+       * DISPLAY MANAGEMENT 
+       */               
+
+      /** Create a call based on the remote uri given as parameter
+       * @param uri  an uri
+       * @return     true if a Ekiga::Call could be created
+       */
+      virtual bool set_vidinput_device (const Ekiga::VidInputDevice & vidinput_device, int channel, Ekiga::VideoFormat format);
+		    
+      virtual void get_vidinput_devices(std::vector <Ekiga::VidInputDevice> & vidinput_devices);
+
+      virtual bool open (unsigned width, unsigned height, unsigned fps);
+
+      virtual void close();
+
+      virtual void get_frame_data (unsigned & width,
+                           unsigned & height,
+                           char *data);
+
+      virtual void set_colour     (unsigned colour     );
+      virtual void set_brightness (unsigned brightness );
+      virtual void set_whiteness  (unsigned whiteness  );
+      virtual void set_contrast   (unsigned contrast   );
+
+  protected:
+      Ekiga::ServiceCore & core;
+      Ekiga::Runtime & runtime;
+
+      PVideoInputDevice *input_device;
+  };
+/**
+ * @}
+ */
+
+
+#endif

Added: trunk/lib/engine/vidinput/skel/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/skel/Makefile.am	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,22 @@
+noinst_LTLIBRARIES = libgmvidinput.la
+
+vidinput_dir = $(top_srcdir)/lib/engine/vidinput/skel
+
+AM_CXXFLAGS = $(SIGC_CFLAGS) $(GLIB_CFLAGS)
+
+INCLUDES = \
+	-I$(top_srcdir)/lib/gmconf \
+	-I$(top_srcdir)/lib/engine/include \
+	-I$(top_srcdir)/lib/engine/framework \
+	-I$(top_srcdir)/lib/engine/display/skel \
+	-I$(top_srcdir)/lib/engine/vidinput/skel
+
+libgmvidinput_la_SOURCES = \
+	$(vidinput_dir)/vidinput-manager.h	\
+	$(vidinput_dir)/vidinput-info.h		\
+	$(vidinput_dir)/vidinput-core.h		\
+	$(vidinput_dir)/vidinput-core.cpp       \
+	$(vidinput_dir)/vidinput-gmconf-bridge.h \
+	$(vidinput_dir)/vidinput-gmconf-bridge.cpp
+
+libgmvidinput_la_LDFLAGS = -export-dynamic -no-undefined $(SIGC_LIBS) $(GLIB_LIBS)

Added: trunk/lib/engine/vidinput/skel/vidinput-core.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/skel/vidinput-core.cpp	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,456 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+
+ * This program is free software; you can  redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ *                         vidinput-core.cpp  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Matthias Schneider
+ *   copyright            : (c) 2008 by Matthias Schneider
+ *   description          : declaration of the interface of a vidinput core.
+ *                          A vidinput core manages VidInputManagers.
+ *
+ */
+
+#include <iostream>
+#include <sstream>
+
+#include "config.h"
+
+#include "vidinput-core.h"
+#include "vidinput-manager.h"
+
+#define FALLBACK_DEVICE_TYPE "Moving Logo"
+#define FALLBACK_DEVICE_SOURCE "Moving Logo"
+#define FALLBACK_DEVICE_DEVICE "Moving Logo"
+
+using namespace Ekiga;
+
+PreviewManager::PreviewManager (VidInputCore& _vidinput_core, DisplayCore& _display_core)
+: PThread (1000, NoAutoDeleteThread),
+  vidinput_core (_vidinput_core),
+  display_core (_display_core)
+{
+  frame = NULL;
+  // Since windows does not like to restart a thread that 
+  // was never started, we do so here
+  this->Resume ();
+  PWaitAndSignal m(quit_mutex);
+}
+
+PreviewManager::~PreviewManager ()
+{
+}
+
+void PreviewManager::start (unsigned width, unsigned height)
+{
+  PTRACE(4, "PreviewManager\tStarting Preview");
+  stop_thread = false;
+  frame = (char*) malloc (unsigned (width * height * 3 / 2));
+
+  display_core.start();
+  this->Restart ();
+  thread_sync_point.Wait ();
+}
+
+void PreviewManager::stop ()
+{
+  PTRACE(4, "PreviewManager\tStopping Preview");
+  stop_thread = true;
+
+  /* Wait for the Main () method to be terminated */
+  PWaitAndSignal m(quit_mutex);
+
+  if (frame) {
+    free (frame);
+    frame = NULL;
+  }  
+  display_core.stop();
+}
+
+void PreviewManager::Main ()
+{
+  PWaitAndSignal m(quit_mutex);
+  thread_sync_point.Signal ();
+
+  if (!frame)
+    return;
+    
+  unsigned width = 176;
+  unsigned height = 144;;
+  while (!stop_thread) {
+    vidinput_core.get_frame_data(width, height, frame);
+
+    if (frame){
+      display_core.set_frame_data(width, height, frame, true, 1);
+    }
+  }
+}
+
+VidInputCore::VidInputCore (DisplayCore& _display_core)
+:  preview_manager(*this, _display_core)
+{
+  PWaitAndSignal m(var_mutex);
+
+  preview_config.active = false;
+  preview_config.width = 176;
+  preview_config.height = 144;
+  preview_config.fps = 30;
+
+
+  stream_config.active = false;
+  stream_config.width = 176;
+  stream_config.height = 144;
+  stream_config.fps = 30;
+
+  current_manager = NULL;
+  vidinput_core_conf_bridge = NULL;
+}
+
+VidInputCore::~VidInputCore ()
+{
+  PWaitAndSignal m(var_mutex);
+
+  if (vidinput_core_conf_bridge)
+    delete vidinput_core_conf_bridge;
+}
+
+void VidInputCore::setup_conf_bridge ()
+{
+  PWaitAndSignal m(var_mutex);
+
+  vidinput_core_conf_bridge = new VidInputCoreConfBridge (*this);
+}
+
+void VidInputCore::add_manager (VidInputManager &manager)
+{
+  managers.insert (&manager);
+  manager_added.emit (manager);
+
+  manager.error.connect (sigc::bind (sigc::mem_fun (this, &VidInputCore::on_error), &manager));
+  manager.vidinputdevice_added.connect (sigc::bind (sigc::mem_fun (this, &VidInputCore::on_vidinputdevice_added), &manager));
+  manager.vidinputdevice_removed.connect (sigc::bind (sigc::mem_fun (this, &VidInputCore::on_vidinputdevice_removed), &manager));
+}
+
+
+void VidInputCore::visit_managers (sigc::slot<bool, VidInputManager &> visitor)
+{
+  PWaitAndSignal m(var_mutex);
+  bool go_on = true;
+  
+  for (std::set<VidInputManager *>::iterator iter = managers.begin ();
+       iter != managers.end () && go_on;
+       iter++)
+      go_on = visitor (*(*iter));
+}		      
+
+void VidInputCore::get_vidinput_devices (std::vector <VidInputDevice> & vidinput_devices)
+{
+  PWaitAndSignal m(var_mutex);
+
+  vidinput_devices.clear();
+  
+  for (std::set<VidInputManager *>::iterator iter = managers.begin ();
+       iter != managers.end ();
+       iter++)
+    (*iter)->get_vidinput_devices (vidinput_devices);
+}
+
+void VidInputCore::set_vidinput_device(const VidInputDevice & vidinput_device, int channel, VideoFormat format)
+{
+  PTRACE(4, "VidInputCore\tSetting device: " << vidinput_device.type << "/" << vidinput_device.source << "/" << vidinput_device.device);
+
+  if ( ( desired_device.type   != vidinput_device.type   ) ||
+       ( desired_device.source != vidinput_device.source ) ||
+       ( desired_device.device != vidinput_device.device ) ||
+       ( current_channel       != channel ) ||
+       ( current_format        != format  ) ) {
+
+    if (preview_config.active && !stream_config.active)
+      preview_manager.stop();
+
+    if (preview_config.active || stream_config.active)
+      internal_close();
+
+    internal_set_device (vidinput_device, channel, format);
+
+    if (preview_config.active && !stream_config.active) {
+      internal_open(preview_config.width, preview_config.height, preview_config.fps);
+      preview_manager.start(preview_config.width,preview_config.height);
+    }
+
+    if (stream_config.active)
+      internal_open(stream_config.width, stream_config.height, stream_config.fps);
+
+  }
+  desired_device  = vidinput_device;
+}
+
+
+void VidInputCore::set_preview_config (unsigned width, unsigned height, unsigned fps)
+{
+  PWaitAndSignal m(var_mutex);
+
+  PTRACE(4, "VidInputCore\tSetting new preview config: " << width << "x" << height << "/" << fps);
+  // There is only one state where we have to reopen the preview device:
+  // we have preview enabled, no stream is active and some value has changed
+  if ( ( preview_config.active && !stream_config.active) &&
+       ( preview_config.width != width ||
+         preview_config.height != height ||
+         preview_config.fps != fps ) )
+  {
+    preview_manager.stop();
+    internal_close();
+
+    internal_open(width, height, fps);
+    preview_manager.start(width, height);
+  }
+
+  preview_config.width = width;
+  preview_config.height = height;
+  preview_config.fps = fps;
+}
+
+
+void VidInputCore::start_preview ()
+{
+  PWaitAndSignal m(var_mutex);
+
+  PTRACE(4, "VidInputCore\tStarting preview " << preview_config.width << "x" << preview_config.height << "/" << preview_config.fps);
+  if (!preview_config.active && !stream_config.active) {
+    internal_open(preview_config.width, preview_config.height, preview_config.fps);
+    preview_manager.start(preview_config.width,preview_config.height);
+  }
+
+  preview_config.active = true;
+}
+
+void VidInputCore::stop_preview ()
+{
+  PWaitAndSignal m(var_mutex);
+
+  PTRACE(4, "VidInputCore\tStopping Preview");
+  if (preview_config.active && !stream_config.active) {
+    preview_manager.stop();
+    internal_close();
+  }
+
+  preview_config.active = false;
+}
+
+void VidInputCore::set_stream_config (unsigned width, unsigned height, unsigned fps)
+{
+  PWaitAndSignal m(var_mutex);
+
+  PTRACE(4, "VidInputCore\tSetting new stream config: " << width << "x" << height << "/" << fps);
+  // We do not support switching of framerate or resolution within a stream
+  // since many endpoints will probably have problems with that. Also, it would add
+  // a lot of complexity due to the capabilities exchange. Thus these values will 
+  // not be used until the next start_stream.
+
+  if (!stream_config.active) {
+    stream_config.width = width;
+    stream_config.height = height;
+    stream_config.fps = fps;
+  }
+}
+
+void VidInputCore::start_stream ()
+{
+  PWaitAndSignal m(var_mutex);
+
+  PTRACE(4, "VidInputCore\tStarting stream " << stream_config.width << "x" << stream_config.height << "/" << stream_config.fps);
+  if (preview_config.active && !stream_config.active) {
+    preview_manager.stop();
+    if ( preview_config.width != stream_config.width ||
+         preview_config.height != stream_config.height ||
+         preview_config.fps != stream_config.fps ) 
+    {
+      internal_close();
+      internal_open(stream_config.width, stream_config.height, stream_config.fps);
+    }
+  }
+
+  if (!preview_config.active && !stream_config.active) {
+    internal_open(stream_config.width, stream_config.height, stream_config.fps);
+  }
+
+  stream_config.active = true;
+}
+
+void VidInputCore::stop_stream ()
+{
+  PWaitAndSignal m(var_mutex);
+
+  PTRACE(4, "VidInputCore\tStopping Stream");
+  if (preview_config.active && stream_config.active) {
+    if ( preview_config.width != stream_config.width ||
+         preview_config.height != stream_config.height ||
+         preview_config.fps != stream_config.fps ) 
+    {
+      internal_close();
+      internal_open(preview_config.width, preview_config.height, preview_config.fps);
+    }
+    preview_manager.start(preview_config.width, preview_config.height);
+  }
+
+  if (!preview_config.active && stream_config.active) {
+    internal_close();
+  }
+
+  stream_config.active = false;
+}
+
+void VidInputCore::get_frame_data (unsigned & width,
+                                   unsigned & height,
+                                   char *data)
+{
+  PWaitAndSignal m(var_mutex);
+
+  if (current_manager)
+    current_manager->get_frame_data(width, height, data);
+}
+
+void VidInputCore::set_colour (unsigned colour)
+{
+  PWaitAndSignal m(var_mutex);
+
+  for (std::set<VidInputManager *>::iterator iter = managers.begin ();
+       iter != managers.end ();
+       iter++) {
+    (*iter)->set_colour (colour);
+  }
+}
+
+void VidInputCore::set_brightness (unsigned brightness)
+{
+  PWaitAndSignal m(var_mutex);
+
+  for (std::set<VidInputManager *>::iterator iter = managers.begin ();
+       iter != managers.end ();
+       iter++) {
+    (*iter)->set_brightness (brightness);
+  }
+}
+
+void VidInputCore::set_whiteness  (unsigned whiteness)
+{
+  PWaitAndSignal m(var_mutex);
+
+  for (std::set<VidInputManager *>::iterator iter = managers.begin ();
+       iter != managers.end ();
+       iter++) {
+    (*iter)->set_whiteness (whiteness);
+  }
+}
+
+void VidInputCore::set_contrast   (unsigned contrast)
+{
+  PWaitAndSignal m(var_mutex);
+
+  for (std::set<VidInputManager *>::iterator iter = managers.begin ();
+       iter != managers.end ();
+       iter++) {
+    (*iter)->set_contrast (contrast);
+  }
+}
+
+void VidInputCore::on_error (VidInputErrorCodes error_code, VidInputManager *manager)
+{
+  error.emit (*manager, error_code);
+}
+
+void VidInputCore::on_vidinputdevice_added (VidInputDevice vidinput_device, VidInputManager *manager)
+{
+  vidinputdevice_added.emit (*manager, vidinput_device);
+}
+
+void VidInputCore::on_vidinputdevice_removed (VidInputDevice vidinput_device, VidInputManager *manager)
+{
+  vidinputdevice_removed.emit (*manager, vidinput_device);
+}
+
+void VidInputCore::internal_open (unsigned width, unsigned height, unsigned fps)
+{
+  PTRACE(4, "VidInputCore\tOpening device with " << width << "x" << height << "/" << fps );
+
+  if (current_manager && !current_manager->open(width, height, fps)) {
+
+    PTRACE(3, "VidInputCore\tFalling back to " << FALLBACK_DEVICE_TYPE << "/" << FALLBACK_DEVICE_SOURCE << "/" << FALLBACK_DEVICE_DEVICE);
+    VidInputDevice vidinput_device;
+    vidinput_device.type = FALLBACK_DEVICE_TYPE;
+    vidinput_device.source = FALLBACK_DEVICE_SOURCE;
+    vidinput_device.device = FALLBACK_DEVICE_DEVICE;
+
+    internal_set_device(vidinput_device, current_channel, current_format);
+    if (current_manager)
+      current_manager->open(width, height, fps);
+  }
+}
+
+void VidInputCore::internal_set_device (const VidInputDevice & vidinput_device, int channel, VideoFormat format)
+{
+  current_manager = NULL;
+  for (std::set<VidInputManager *>::iterator iter = managers.begin ();
+       iter != managers.end ();
+       iter++) {
+     if ((*iter)->set_vidinput_device (vidinput_device, channel, format)) {
+       current_manager = (*iter);
+     }
+  }
+
+  // If the desired manager could not be found,
+  // we se the default device. The default device
+  // MUST ALWAYS be loaded and openable
+  if (current_manager) {
+    current_device  = vidinput_device;
+  }
+  else {
+
+    PTRACE(1, "VidInputCore\tTried to set unexisting device " << vidinput_device.type << "/" << vidinput_device.source << "/" << vidinput_device.device);
+    PTRACE(1, "VidInputCore\tFalling back to " << FALLBACK_DEVICE_TYPE << "/" << FALLBACK_DEVICE_SOURCE << "/" << FALLBACK_DEVICE_DEVICE);
+    current_device.type = FALLBACK_DEVICE_TYPE;
+    current_device.source = FALLBACK_DEVICE_SOURCE;
+    current_device.device = FALLBACK_DEVICE_DEVICE;
+
+    for (std::set<VidInputManager *>::iterator iter = managers.begin ();
+         iter != managers.end ();
+         iter++) {
+       if ((*iter)->set_vidinput_device (current_device, channel, format)) {
+         current_manager = (*iter);
+       }
+    }
+  }
+
+  current_channel = channel;
+  current_format  = format;
+}
+
+void VidInputCore::internal_close()
+{
+  PTRACE(4, "VidInputCore\tClosing current device");
+  if (current_manager)
+    current_manager->close();
+}

Added: trunk/lib/engine/vidinput/skel/vidinput-core.h
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/skel/vidinput-core.h	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,209 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+
+ * This program is free software; you can  redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ *                         vidinput-core.h  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Matthias Schneider
+ *   copyright            : (c) 2008 by Matthias Schneider
+ *   description          : Declaration of the interface of a vidinput core.
+ *                          A vidinput core manages VidInputManagers.
+ *
+ */
+
+#ifndef __VIDINPUT_CORE_H__
+#define __VIDINPUT_CORE_H__
+
+#include "services.h"
+#include "display-core.h"
+#include "vidinput-gmconf-bridge.h"
+#include "vidinput-info.h"
+
+#include <sigc++/sigc++.h>
+#include <glib.h>
+
+#include "ptbuildopts.h"
+#include "ptlib.h"
+
+namespace Ekiga
+{
+  typedef struct DeviceConfig {
+    bool active;
+    unsigned width;
+    unsigned height;
+    unsigned fps;
+  };
+
+  class VidInputManager;
+  class VidInputCore;
+				      
+  class PreviewManager : public PThread
+  {
+    PCLASSINFO(PreviewManager, PThread);
+  
+  public:
+    PreviewManager(VidInputCore& _vidinput_core, DisplayCore& _display_core);
+    ~PreviewManager();
+    virtual void start(unsigned width, unsigned height);
+    virtual void stop();
+  
+  protected:
+    void Main (void);
+    bool stop_thread;
+    char* frame;
+    PMutex quit_mutex;     /* To exit */
+    PSyncPoint thread_sync_point;
+    VidInputCore& vidinput_core;
+    DisplayCore& display_core;
+  };
+
+/**
+ * @defgroup vidinput Video VidInput
+ * @{
+ */
+
+
+
+  /** Core object for the video vidinput support
+   */
+  class VidInputCore
+    : public Service
+    {
+
+  public:
+
+      /* The constructor
+      */
+      VidInputCore (DisplayCore& _display_core);
+
+      /* The destructor
+      */
+      ~VidInputCore ();
+
+      void setup_conf_bridge();
+
+      /*** Service Implementation ***/
+
+      /** Returns the name of the service.
+       * @return The service name.
+       */
+      const std::string get_name () const
+        { return "vidinput-core"; }
+
+
+      /** Returns the description of the service.
+       * @return The service description.
+       */
+      const std::string get_description () const
+        { return "\tVidInput Core managing VidInput Manager objects"; }
+
+
+      /** Adds a VidInputManager to the VidInputCore service.
+       * @param The manager to be added.
+       */
+       void add_manager (VidInputManager &manager);
+
+      /** Triggers a callback for all Ekiga::VidInputManager sources of the
+       * VidInputCore service.
+       */
+       void visit_managers (sigc::slot<bool, VidInputManager &> visitor);
+
+      /** This signal is emitted when a Ekiga::VidInputManager has been
+       * added to the VidInputCore Service.
+       */
+       sigc::signal<void, VidInputManager &> manager_added;
+
+
+      void get_vidinput_devices(std::vector <VidInputDevice> & vidinput_devices);
+
+      void set_vidinput_device(const VidInputDevice & vidinput_device, int channel, VideoFormat format);
+      
+      /* To transmit a user specified image, pass a pointer to a raw YUV image*/      
+      void set_image_data (unsigned width, unsigned height, const char* data);
+
+      /*** VidInput Management ***/                 
+
+      void set_preview_config (unsigned width, unsigned height, unsigned fps);
+      
+      void start_preview ();
+
+      void stop_preview ();
+
+      void set_stream_config (unsigned width, unsigned height, unsigned fps);
+
+      void start_stream ();
+
+      void stop_stream ();
+
+      void get_frame_data (unsigned & width,
+                           unsigned & height,
+                           char *data);
+
+
+      void set_colour     (unsigned colour);
+      void set_brightness (unsigned brightness);
+      void set_whiteness  (unsigned whiteness);
+      void set_contrast   (unsigned contrast);
+
+      /*** VidInput Related Signals ***/
+      
+      /** See vidinput-manager.h for the API
+       */
+      sigc::signal<void, VidInputManager &, VidInputErrorCodes> error;
+      sigc::signal<void, VidInputManager &, VidInputDevice> vidinputdevice_added;
+      sigc::signal<void, VidInputManager &, VidInputDevice> vidinputdevice_removed;
+
+  private:
+      void on_error (VidInputErrorCodes error_code, VidInputManager *manager);
+      void on_vidinputdevice_added (VidInputDevice vidinput_device, VidInputManager *manager);
+      void on_vidinputdevice_removed (VidInputDevice vidinput_device, VidInputManager *manager);
+
+      void internal_open (unsigned width, unsigned height, unsigned fps);
+      void internal_close();
+      void internal_set_device (const VidInputDevice & vidinput_device, int channel, VideoFormat format);
+
+      std::set<VidInputManager *> managers;
+
+      DeviceConfig preview_config;
+      DeviceConfig stream_config;
+
+      VidInputManager* current_manager;
+      VidInputDevice desired_device;
+      VidInputDevice current_device;
+      Ekiga::VideoFormat current_format;
+      int current_channel;
+
+      PMutex var_mutex;      /* To protect variables that are read and written */
+
+      PreviewManager preview_manager;
+      VidInputCoreConfBridge* vidinput_core_conf_bridge;
+    };
+/**
+ * @}
+ */
+};
+
+#endif

Added: trunk/lib/engine/vidinput/skel/vidinput-gmconf-bridge.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/skel/vidinput-gmconf-bridge.cpp	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,104 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+
+ * This program is free software; you can  redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ *                         vidinput-core.cpp  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Matthias Schneider
+ *   copyright            : (c) 2008 by Matthias Schneider
+ *   description          : declaration of the interface of a vidinput core.
+ *                          A vidinput core manages VidInputManagers.
+ *
+ */
+
+#include "config.h"
+
+#include "vidinput-gmconf-bridge.h"
+#include "vidinput-core.h"
+
+#define VIDEO_DEVICES_KEY "/apps/" PACKAGE_NAME "/devices/video/"
+#define VIDEO_CODECS_KEY  "/apps/" PACKAGE_NAME "/codecs/video/"
+
+using namespace Ekiga;
+
+VidInputCoreConfBridge::VidInputCoreConfBridge (Ekiga::Service & _service)
+ : Ekiga::ConfBridge (_service)
+{
+  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_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"); 
+  load (keys);
+}
+
+void VidInputCoreConfBridge::on_property_changed (std::string key, GmConfEntry *entry)
+{
+  VidInputCore & vidinput_core = (VidInputCore &) service;
+
+  if ( (key == VIDEO_DEVICES_KEY "size") ||
+       (key == VIDEO_DEVICES_KEY "max_frame_rate") ) {
+
+    PTRACE(4, "VidInputCoreConfBridge\tUpdating preview size and fps");
+    vidinput_core.set_preview_config (VideoSizes[gm_conf_get_int (VIDEO_DEVICES_KEY "size")].width,
+                                      VideoSizes[gm_conf_get_int (VIDEO_DEVICES_KEY "size")].height,
+                                      gm_conf_get_int (VIDEO_CODECS_KEY "max_frame_rate"));
+  }
+  else if ( (key == VIDEO_DEVICES_KEY "input_device") ||
+            (key == VIDEO_DEVICES_KEY "plugin") ||
+            (key == VIDEO_DEVICES_KEY "channel") ||
+            (key == VIDEO_DEVICES_KEY "format") ) {
+
+    PTRACE(4, "VidInputCoreConfBridge\tUpdating device");
+    std::string type_source = gm_conf_get_string (VIDEO_DEVICES_KEY "plugin");
+    VidInputDevice vidinput_device;
+
+    vidinput_device.type   = type_source.substr ( 0, type_source.find_first_of("/"));
+    vidinput_device.source = type_source.substr ( type_source.find_first_of("/") + 1, type_source.size() - 1 );
+    vidinput_device.device = gm_conf_get_string (VIDEO_DEVICES_KEY "input_device");
+    vidinput_core.set_vidinput_device (vidinput_device,
+                                       gm_conf_get_int (VIDEO_DEVICES_KEY "channel"),
+                                       (VideoFormat) gm_conf_get_int (VIDEO_DEVICES_KEY "format"));
+  }
+  else if (key == VIDEO_DEVICES_KEY "enable_preview") {
+
+    PTRACE(4, "VidInputCoreConfBridge\tUpdating preview");
+    if (gm_conf_get_bool ( VIDEO_DEVICES_KEY "enable_preview"))
+        vidinput_core.start_preview(); 
+      else
+        vidinput_core.stop_preview();
+  }
+  else if (key == VIDEO_DEVICES_KEY "image") {
+    PTRACE(4, "VidInputCoreConfBridge\tUpdating image");
+  }
+}
+

Added: trunk/lib/engine/vidinput/skel/vidinput-gmconf-bridge.h
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/skel/vidinput-gmconf-bridge.h	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,57 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+
+ * This program is free software; you can  redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ *                         vidinput-core.h  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Matthias Schneider
+ *   copyright            : (c) 2008 by Matthias Schneider
+ *   description          : Declaration of the interface of a vidinput core.
+ *                          A vidinput core manages VidInputManagers.
+ *
+ */
+
+#ifndef __VIDINPUT_GMCONF_BRIDGE_H__
+#define __VIDINPUT_GMCONF_BRIDGE_H__
+
+#include "services.h"
+#include "gmconf-bridge.h"
+
+namespace Ekiga
+{
+  class VidInputCoreConfBridge
+    : public Ekiga::ConfBridge
+  {
+  public:
+
+    VidInputCoreConfBridge (Ekiga::Service & service);
+
+    void on_property_changed (std::string key, GmConfEntry *value);
+  };
+
+};
+
+#endif

Added: trunk/lib/engine/vidinput/skel/vidinput-info.h
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/skel/vidinput-info.h	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,108 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+
+ * This program is free software; you can  redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ *                         vidinput-core.h  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Matthias Schneider
+ *   copyright            : (c) 2008 by Matthias Schneider
+ *   description          : Declaration of the interface of a vidinput core.
+ *                          A vidinput core manages VidInputManagers.
+ *
+ */
+
+#ifndef __VIDINPUT_INFO_H__
+#define __VIDINPUT_INFO_H__
+
+#include "services.h"
+#include "display-core.h"
+#include "gmconf-bridge.h"
+
+#include <sigc++/sigc++.h>
+#include <set>
+#include <map>
+
+#include <glib.h>
+
+#include "ptbuildopts.h"
+#include "ptlib.h"
+
+#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
+
+namespace Ekiga
+{
+#define NB_VIDEO_SIZES 5
+
+  const static struct { 
+    int width; 
+    int height; 
+  } 
+  VideoSizes[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 },
+  };
+  
+  enum VideoFormat {
+    PAL,
+    NTSC,
+    SECAM,
+    Auto,
+    NumVideoFormats
+  };
+
+  typedef struct VidInputDevice {
+    std::string type;
+    std::string source;
+    std::string device;
+  };
+
+  enum VidInputErrorCodes {
+    ERR_NONE = 0,
+    ERR_DEVICE,
+    ERR_FORMAT,
+    ERR_CHANNEL,
+    ERR_COLOUR,
+    ERR_FPS,
+    ERR_SCALE
+  };
+				      
+};
+
+#endif

Added: trunk/lib/engine/vidinput/skel/vidinput-manager.h
==============================================================================
--- (empty file)
+++ trunk/lib/engine/vidinput/skel/vidinput-manager.h	Wed Feb 20 19:09:59 2008
@@ -0,0 +1,122 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+
+ * This program is free software; you can  redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ *                         vidinput-manager.h  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Matthias Schneider
+ *   copyright            : (c) 2008 by Matthias Schneider
+ *   description          : Declaration of the interface of a vidinput manager
+ *                          implementation backend.
+ *
+ */
+
+
+#ifndef __VIDINPUT_MANAGER_H__
+#define __VIDINPUT_MANAGER_H__
+
+#include "vidinput-core.h"
+
+namespace Ekiga
+{
+
+/**
+ * @addtogroup vidinput
+ * @{
+ */
+
+  typedef struct ManagerState {
+    bool opened;
+    unsigned width;
+    unsigned height;
+    unsigned fps;
+    VidInputDevice vidinput_device;
+    VideoFormat format;
+    int channel;
+    int colour;
+    int whiteness;
+    int brightness;
+    int contrast;
+  };
+  
+
+  class VidInputManager
+    {
+
+  public:
+
+      /* The constructor
+       */
+      VidInputManager () {}
+
+      /* The destructor
+       */
+      ~VidInputManager () {}
+
+
+      /*                 
+       * VIDINOUT MANAGEMENT 
+       */               
+
+      /** Create a call based on the remote uri given as parameter
+       * @param uri  an uri
+       * @return     true if a Ekiga::Call could be created
+       */
+
+      virtual void get_vidinput_devices (std::vector <VidInputDevice> & vidinput_devices) = 0;
+
+      virtual bool set_vidinput_device (const VidInputDevice & vidinput_device, int channel, VideoFormat format) = 0;
+
+      virtual void set_image_data (unsigned /* width */, unsigned /* height */, const char* /*data*/ ) {};
+
+      virtual bool open (unsigned width, unsigned height, unsigned fps) = 0;
+
+      virtual void get_frame_data (unsigned & width,
+                           unsigned & height,
+                           char *data) = 0;
+
+      virtual void close() {};
+
+
+      virtual void set_colour     (unsigned /* colour     */ ) {};
+      virtual void set_brightness (unsigned /* brightness */ ) {};
+      virtual void set_whiteness  (unsigned /* whiteness  */ ) {};
+      virtual void set_contrast   (unsigned /* contrast   */ ) {};
+
+      sigc::signal<void, VidInputErrorCodes> error;
+      sigc::signal<void, VidInputDevice> vidinputdevice_added;
+      sigc::signal<void, VidInputDevice> vidinputdevice_removed;
+
+  protected:  
+      ManagerState current_state;
+  };
+/**
+ * @}
+ */
+
+};
+
+#endif



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