ekiga r6097 - in trunk: . lib/engine lib/engine/vidinput/mlogo lib/engine/vidinput/ptlib lib/engine/vidinput/skel
- From: mschneid svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r6097 - in trunk: . lib/engine lib/engine/vidinput/mlogo lib/engine/vidinput/ptlib lib/engine/vidinput/skel
- Date: Sun, 30 Mar 2008 19:19:08 +0100 (BST)
Author: mschneid
Date: Sun Mar 30 19:19:07 2008
New Revision: 6097
URL: http://svn.gnome.org/viewvc/ekiga?rev=6097&view=rev
Log:
Add support for adding and removing video input devices.
Modified:
trunk/ChangeLog
trunk/lib/engine/engine.cpp
trunk/lib/engine/vidinput/mlogo/Makefile.am
trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.cpp
trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.h
trunk/lib/engine/vidinput/ptlib/Makefile.am
trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.cpp
trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.h
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-manager.h
Modified: trunk/lib/engine/engine.cpp
==============================================================================
--- trunk/lib/engine/engine.cpp (original)
+++ trunk/lib/engine/engine.cpp Sun Mar 30 19:19:07 2008
@@ -100,7 +100,7 @@
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);
+ Ekiga::VidInputCore *vidinput_core = new Ekiga::VidInputCore(*runtime, *display_core);
Ekiga::HalCore *hal_core = new Ekiga::HalCore;
Modified: trunk/lib/engine/vidinput/mlogo/Makefile.am
==============================================================================
--- trunk/lib/engine/vidinput/mlogo/Makefile.am (original)
+++ trunk/lib/engine/vidinput/mlogo/Makefile.am Sun Mar 30 19:19:07 2008
@@ -11,7 +11,8 @@
-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
+ -I$(top_srcdir)/lib/engine/vidinput/mlogo \
+ -I$(top_srcdir)/lib/engine/hal/skel
libgmvidinput_mlogo_la_SOURCES = \
$(vidinput_dir)/vidinput-manager-mlogo.h \
Modified: trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.cpp
==============================================================================
--- trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.cpp (original)
+++ trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.cpp Sun Mar 30 19:19:07 2008
@@ -185,3 +185,8 @@
dstFrame += dstWidth;
}
}
+
+bool GMVidInputManager_mlogo::has_device (const std::string & /*source*/, const std::string & /*device*/, unsigned /*capabilities*/, Ekiga::VidInputDevice & /*vidinput_device*/)
+{
+ return false;
+}
Modified: trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.h
==============================================================================
--- trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.h (original)
+++ trunk/lib/engine/vidinput/mlogo/vidinput-manager-mlogo.h Sun Mar 30 19:19:07 2008
@@ -83,6 +83,8 @@
unsigned & height,
char *data);
+ virtual bool has_device (const std::string & source, const std::string & device, unsigned capabilities, Ekiga::VidInputDevice & vidinput_device);
+
protected:
void CopyYUVArea (const char* srcFrame,
unsigned srcWidth,
Modified: trunk/lib/engine/vidinput/ptlib/Makefile.am
==============================================================================
--- trunk/lib/engine/vidinput/ptlib/Makefile.am (original)
+++ trunk/lib/engine/vidinput/ptlib/Makefile.am Sun Mar 30 19:19:07 2008
@@ -10,7 +10,8 @@
-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
+ -I$(top_srcdir)/lib/engine/vidinput/ptlib \
+ -I$(top_srcdir)/lib/engine/hal/skel
libgmvidinput_ptlib_la_SOURCES = \
$(vidinput_dir)/vidinput-manager-ptlib.h \
Modified: trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.cpp
==============================================================================
--- trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.cpp (original)
+++ trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.cpp Sun Mar 30 19:19:07 2008
@@ -205,3 +205,23 @@
if (input_device)
input_device->SetContrast(contrast << 8);
}
+
+bool GMVidInputManager_ptlib::has_device(const std::string & source, const std::string & device, unsigned capabilities, Ekiga::VidInputDevice & vidinput_device)
+{
+ if (source == "video4linux") {
+ if (capabilities & 0x01) {
+ vidinput_device.type = DEVICE_TYPE;
+ vidinput_device.source = "V4L";
+ vidinput_device.device = device;
+ return true;
+ }
+ if (capabilities & 0x02) {
+ vidinput_device.type = DEVICE_TYPE;
+ vidinput_device.source = "V4L2";
+ vidinput_device.device = device;
+ return true;
+ }
+ return false;
+ }
+ return false;
+}
Modified: trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.h
==============================================================================
--- trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.h (original)
+++ trunk/lib/engine/vidinput/ptlib/vidinput-manager-ptlib.h Sun Mar 30 19:19:07 2008
@@ -86,6 +86,7 @@
virtual void set_whiteness (unsigned whiteness );
virtual void set_contrast (unsigned contrast );
+ virtual bool has_device (const std::string & source, const std::string & device, unsigned capabilities, Ekiga::VidInputDevice & vidinput_device);
protected:
Ekiga::ServiceCore & core;
Ekiga::Runtime & runtime;
Modified: trunk/lib/engine/vidinput/skel/Makefile.am
==============================================================================
--- trunk/lib/engine/vidinput/skel/Makefile.am (original)
+++ trunk/lib/engine/vidinput/skel/Makefile.am Sun Mar 30 19:19:07 2008
@@ -9,7 +9,8 @@
-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/skel \
+ -I$(top_srcdir)/lib/engine/hal/skel
libgmvidinput_la_SOURCES = \
$(vidinput_dir)/vidinput-manager.h \
Modified: trunk/lib/engine/vidinput/skel/vidinput-core.cpp
==============================================================================
--- trunk/lib/engine/vidinput/skel/vidinput-core.cpp (original)
+++ trunk/lib/engine/vidinput/skel/vidinput-core.cpp Sun Mar 30 19:19:07 2008
@@ -114,8 +114,9 @@
}
}
-VidInputCore::VidInputCore (DisplayCore& _display_core)
-: preview_manager(*this, _display_core)
+VidInputCore::VidInputCore (Ekiga::Runtime & _runtime, DisplayCore& _display_core)
+: runtime (_runtime),
+ preview_manager(*this, _display_core)
{
PWaitAndSignal m(var_mutex);
@@ -159,8 +160,6 @@
manager_added.emit (manager);
manager.vidinputdevice_error.connect (sigc::bind (sigc::mem_fun (this, &VidInputCore::on_vidinputdevice_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));
manager.vidinputdevice_opened.connect (sigc::bind (sigc::mem_fun (this, &VidInputCore::on_vidinputdevice_opened), &manager));
manager.vidinputdevice_closed.connect (sigc::bind (sigc::mem_fun (this, &VidInputCore::on_vidinputdevice_closed), &manager));
}
@@ -384,29 +383,19 @@
current_manager->set_contrast (contrast);
}
-void VidInputCore::on_vidinputdevice_error (VidInputDevice & vidinput_device, VidInputErrorCodes error_code, VidInputManager *manager)
+void VidInputCore::on_vidinputdevice_error (VidInputDevice vidinput_device, VidInputErrorCodes error_code, VidInputManager *manager)
{
vidinputdevice_error.emit (*manager, vidinput_device, 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::on_vidinputdevice_opened (VidInputDevice & vidinput_device,
- VidInputConfig & vidinput_config,
+void VidInputCore::on_vidinputdevice_opened (VidInputDevice vidinput_device,
+ VidInputConfig vidinput_config,
VidInputManager *manager)
{
vidinputdevice_opened.emit (*manager, vidinput_device, vidinput_config);
}
-void VidInputCore::on_vidinputdevice_closed (VidInputDevice & vidinput_device, VidInputManager *manager)
+void VidInputCore::on_vidinputdevice_closed (VidInputDevice vidinput_device, VidInputManager *manager)
{
vidinputdevice_closed.emit (*manager, vidinput_device);
}
@@ -473,3 +462,36 @@
if (current_manager)
current_manager->close();
}
+
+void VidInputCore::add_device (std::string & source, std::string & device, unsigned capabilities, HalManager* /*manager*/)
+{
+ PTRACE(0, "VidInputCore\tAdding Device");
+ VidInputDevice vidinput_device;
+ for (std::set<VidInputManager *>::iterator iter = managers.begin ();
+ iter != managers.end ();
+ iter++) {
+ if ((*iter)->has_device (source, device, capabilities, vidinput_device)) {
+
+ if ( ( desired_device.type == vidinput_device.type ) &&
+ ( desired_device.source == vidinput_device.source ) &&
+ ( desired_device.device == vidinput_device.device ) ) {
+ set_vidinput_device(desired_device, current_channel, current_format);
+ }
+
+ runtime.run_in_main (sigc::bind (vidinputdevice_added.make_slot (), vidinput_device));
+ }
+ }
+}
+
+void VidInputCore::remove_device (std::string & source, std::string & device, unsigned capabilities, HalManager* /*manager*/)
+{
+ PTRACE(0, "VidInputCore\tRemoving Device");
+ VidInputDevice vidinput_device;
+ for (std::set<VidInputManager *>::iterator iter = managers.begin ();
+ iter != managers.end ();
+ iter++) {
+ if ((*iter)->has_device (source, device, capabilities, vidinput_device)) {
+ runtime.run_in_main (sigc::bind (vidinputdevice_removed.make_slot (), vidinput_device));
+ }
+ }
+}
Modified: trunk/lib/engine/vidinput/skel/vidinput-core.h
==============================================================================
--- trunk/lib/engine/vidinput/skel/vidinput-core.h (original)
+++ trunk/lib/engine/vidinput/skel/vidinput-core.h Sun Mar 30 19:19:07 2008
@@ -38,12 +38,15 @@
#define __VIDINPUT_CORE_H__
#include "services.h"
+#include "runtime.h"
#include "display-core.h"
+#include "hal-core.h"
#include "vidinput-gmconf-bridge.h"
#include "vidinput-info.h"
#include <sigc++/sigc++.h>
#include <glib.h>
+#include <set>
#include "ptbuildopts.h"
#include "ptlib.h"
@@ -97,7 +100,7 @@
/* The constructor
*/
- VidInputCore (DisplayCore& _display_core);
+ VidInputCore (Ekiga::Runtime & _runtime, DisplayCore& _display_core);
/* The destructor
*/
@@ -168,24 +171,25 @@
void set_whiteness (unsigned whiteness);
void set_contrast (unsigned contrast);
+ void add_device (std::string & source, std::string & device, unsigned capabilities, HalManager* manager);
+ void remove_device (std::string & source, std::string & device, unsigned capabilities, HalManager* manager);
+
/*** VidInput Related Signals ***/
/** See vidinput-manager.h for the API
*/
sigc::signal<void, VidInputManager &, VidInputDevice &, VidInputErrorCodes> vidinputdevice_error;
- sigc::signal<void, VidInputManager &, VidInputDevice &> vidinputdevice_added;
- sigc::signal<void, VidInputManager &, VidInputDevice &> vidinputdevice_removed;
+ sigc::signal<void, VidInputDevice> vidinputdevice_added;
+ sigc::signal<void, VidInputDevice> vidinputdevice_removed;
sigc::signal<void, VidInputManager &, VidInputDevice &, VidInputConfig&> vidinputdevice_opened;
sigc::signal<void, VidInputManager &, VidInputDevice &> vidinputdevice_closed;
private:
- void on_vidinputdevice_error (VidInputDevice & vidinput_device, VidInputErrorCodes error_code, VidInputManager *manager);
- void on_vidinputdevice_added (VidInputDevice & vidinput_device, VidInputManager *manager);
- void on_vidinputdevice_removed (VidInputDevice & vidinput_device, VidInputManager *manager);
- void on_vidinputdevice_opened (VidInputDevice & vidinput_device,
- VidInputConfig & vidinput_config,
+ void on_vidinputdevice_error (VidInputDevice vidinput_device, VidInputErrorCodes error_code, VidInputManager *manager);
+ void on_vidinputdevice_opened (VidInputDevice vidinput_device,
+ VidInputConfig vidinput_config,
VidInputManager *manager);
- void on_vidinputdevice_closed (VidInputDevice & vidinput_device, VidInputManager *manager);
+ void on_vidinputdevice_closed (VidInputDevice vidinput_device, VidInputManager *manager);
void internal_open (unsigned width, unsigned height, unsigned fps);
void internal_close();
@@ -193,6 +197,8 @@
std::set<VidInputManager *> managers;
+ Ekiga::Runtime & runtime;
+
DeviceConfig preview_config;
DeviceConfig stream_config;
Modified: trunk/lib/engine/vidinput/skel/vidinput-manager.h
==============================================================================
--- trunk/lib/engine/vidinput/skel/vidinput-manager.h (original)
+++ trunk/lib/engine/vidinput/skel/vidinput-manager.h Sun Mar 30 19:19:07 2008
@@ -102,11 +102,13 @@
virtual void set_whiteness (unsigned /* whiteness */ ) {};
virtual void set_contrast (unsigned /* contrast */ ) {};
- sigc::signal<void, VidInputDevice&, VidInputErrorCodes> vidinputdevice_error;
- sigc::signal<void, VidInputDevice&> vidinputdevice_added;
- sigc::signal<void, VidInputDevice&> vidinputdevice_removed;
- sigc::signal<void, VidInputDevice&, VidInputConfig&> vidinputdevice_opened;
- sigc::signal<void, VidInputDevice&> vidinputdevice_closed;
+ virtual bool has_device (const std::string & source, const std::string & device, unsigned capabilities, VidInputDevice & vidinput_device) = 0;
+
+ sigc::signal<void, VidInputDevice, VidInputErrorCodes> vidinputdevice_error;
+ sigc::signal<void, VidInputDevice> vidinputdevice_added;
+ sigc::signal<void, VidInputDevice> vidinputdevice_removed;
+ sigc::signal<void, VidInputDevice, VidInputConfig> vidinputdevice_opened;
+ sigc::signal<void, VidInputDevice> vidinputdevice_closed;
protected:
ManagerState current_state;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]