[ekiga/ds-gsettings] VideoInputCore: Dropped configuration bridge and moved more keys.



commit 7ec1493b0bcae126b4fceeef7c68b712d9c6249a
Author: Damien Sandras <dsandras beip be>
Date:   Sun May 5 18:16:20 2013 +0200

    VideoInputCore: Dropped configuration bridge and moved more keys.

 lib/Makefile.am                                    |    4 +-
 lib/engine/engine.cpp                              |    1 -
 lib/engine/videoinput/videoinput-core.cpp          |   39 ++++-----
 lib/engine/videoinput/videoinput-core.h            |    6 --
 lib/engine/videoinput/videoinput-gmconf-bridge.cpp |   87 --------------------
 lib/engine/videoinput/videoinput-gmconf-bridge.h   |   62 --------------
 6 files changed, 20 insertions(+), 179 deletions(-)
---
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 59c5671..450bea3 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -353,9 +353,7 @@ libekiga_la_SOURCES += \
        $(engine_dir)/videoinput/videoinput-manager.h \
        $(engine_dir)/videoinput/videoinput-info.h \
        $(engine_dir)/videoinput/videoinput-core.h \
-       $(engine_dir)/videoinput/videoinput-core.cpp \
-       $(engine_dir)/videoinput/videoinput-gmconf-bridge.h \
-       $(engine_dir)/videoinput/videoinput-gmconf-bridge.cpp
+       $(engine_dir)/videoinput/videoinput-core.cpp
 
 ##
 # Sources of the audio output stack
diff --git a/lib/engine/engine.cpp b/lib/engine/engine.cpp
index c6a3ab6..a0cd1b3 100644
--- a/lib/engine/engine.cpp
+++ b/lib/engine/engine.cpp
@@ -200,7 +200,6 @@ engine_init (Ekiga::ServiceCorePtr service_core,
    */
 
   videooutput_core->setup_conf_bridge();
-  videoinput_core->setup_conf_bridge ();
   videoinput_core->setup ("any");
   audioinput_core->setup ();
   audiooutput_core->setup ();
diff --git a/lib/engine/videoinput/videoinput-core.cpp b/lib/engine/videoinput/videoinput-core.cpp
index 717b7bb..6231333 100644
--- a/lib/engine/videoinput/videoinput-core.cpp
+++ b/lib/engine/videoinput/videoinput-core.cpp
@@ -177,7 +177,6 @@ VideoInputCore::VideoInputCore (Ekiga::ServiceCore & _core,
   desired_settings.contrast = 0;
 
   current_manager = NULL;
-  videoinput_core_conf_bridge = NULL;
   notification_core = core.get<Ekiga::NotificationCore> ("notification-core");
 
   device_settings = new Settings (VIDEO_DEVICES_SCHEMA);
@@ -188,9 +187,6 @@ VideoInputCore::~VideoInputCore ()
 {
   PWaitAndSignal m(core_mutex);
 
-  if (videoinput_core_conf_bridge)
-    delete videoinput_core_conf_bridge;
-
   preview_manager->quit ();
 
   for (std::set<VideoInputManager *>::iterator iter = managers.begin ();
@@ -204,17 +200,8 @@ VideoInputCore::~VideoInputCore ()
 }
 
 
-void VideoInputCore::setup_conf_bridge ()
-{
-  PWaitAndSignal m(core_mutex);
-
-  videoinput_core_conf_bridge = new VideoInputCoreConfBridge (*this);
-}
-
-
 void VideoInputCore::setup (std::string setting)
 {
-  std::cout << "dans setup " << setting << std::endl << std::flush;
   GSettings* settings = device_settings->get_g_settings ();
   VideoInputDevice device;
 
@@ -225,20 +212,29 @@ void VideoInputCore::setup (std::string setting)
     unsigned channel = g_settings_get_int (settings, "channel");
     device.SetFromString (device_string);
 
-    std::cout << "dans setup set device " << setting << " " << device_string << std::endl << std::flush;
     set_device (device, channel, (VideoInputFormat) video_format);
     g_free (device_string);
   }
 
+  /* Size and framerate */
+  if (setting == "any" || setting == "size" || setting == "max-frame-rate") {
+    unsigned size = g_settings_get_int (settings, "size");
+    unsigned max_frame_rate = g_settings_get_int (settings, "max-frame-rate");
+    if (size >= NB_VIDEO_SIZES) {
+      PTRACE(1, "VidInputCore\t" << "size out of range, ajusting to 0");
+      size = 0;
+    }
+    set_preview_config (VideoSizes[size].width,
+                        VideoSizes[size].height,
+                        max_frame_rate);
+  }
+
   /* Previenw */
   if (setting == "any" || setting == "enable-preview") {
-    std::cout << "dans setup " << setting << std::endl << std::flush;
     if (g_settings_get_boolean (settings, "enable-preview")) {
-      std::cout << "start " << std::endl << std::flush;
       start_preview ();
     }
     else {
-      std::cout << "stop " << std::endl << std::flush;
       stop_preview ();
     }
   }
@@ -290,7 +286,6 @@ void VideoInputCore::get_devices (std::vector <VideoInputDevice> & devices)
 void VideoInputCore::set_device(const VideoInputDevice & _device, int channel, VideoInputFormat format)
 {
   PWaitAndSignal m(core_mutex);
-  std::cout << "dans set_device" << std::endl << std::flush;
   VideoInputDevice device;
 
   /* Check if device exists */
@@ -305,7 +300,7 @@ void VideoInputCore::set_device(const VideoInputDevice & _device, int channel, V
       break;
     }
   }
-  PTRACE(4, "VidInputCoreConfBridge\tUpdating device");
+  PTRACE(4, "VidInputCoreConf\tUpdating device");
 
   if (found)
     device = _device;
@@ -322,7 +317,7 @@ void VideoInputCore::set_device(const VideoInputDevice & _device, int channel, V
   }
 
   if (format >= VI_FORMAT_MAX) {
-    PTRACE(1, "VidInputCoreConfBridge\t" << VIDEO_DEVICES_KEY "format" << " out of range, ajusting to 3");
+    PTRACE(1, "VidInputCoreConf\tformat out of range, ajusting to 3");
     format = (VideoInputFormat) 3;
   }
 
@@ -390,6 +385,10 @@ void VideoInputCore::set_preview_config (unsigned width, unsigned height, unsign
 
   VideoDeviceConfig new_preview_config(width, height, fps);
 
+  if ( fps < 1 || fps > 30 ) {
+    PTRACE(1, "VidInputCore\tmax-frame-rate out of range, ajusting to 30");
+    fps = 30;
+  }
   PTRACE(4, "VidInputCore\tSetting new preview config: " << new_preview_config);
   // 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
diff --git a/lib/engine/videoinput/videoinput-core.h b/lib/engine/videoinput/videoinput-core.h
index de21651..07f74e5 100644
--- a/lib/engine/videoinput/videoinput-core.h
+++ b/lib/engine/videoinput/videoinput-core.h
@@ -43,7 +43,6 @@
 #include "hal-core.h"
 #include "notification-core.h"
 #include "videoinput-manager.h"
-#include "videoinput-gmconf-bridge.h"
 
 #include <boost/signals.hpp>
 #include <boost/bind.hpp>
@@ -115,10 +114,6 @@ namespace Ekiga
        */
       ~VideoInputCore ();
 
-      /** Set up gmconf bridge
-       */
-      void setup_conf_bridge();
-
       /** Set up settings
        */
       void setup (std::string setting);
@@ -445,7 +440,6 @@ private:
 
       Ekiga::ServiceCore & core;
       VideoPreviewManager* preview_manager;
-      VideoInputCoreConfBridge* videoinput_core_conf_bridge;
       boost::shared_ptr<Ekiga::NotificationCore> notification_core;
 
       Settings* device_settings;


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