This commit adds a new getSettingsFor() method to the VideoPreferences
and VideoControls classes. This method will be used to get settings for
a video input without altering the default configuration.

Refs: #40807
---
 daemon/src/client/dbus/video_controls.cpp |  5 +++++
 daemon/src/client/video_controls.h        |  3 +++
 daemon/src/video/video_preferences.cpp    | 13 +++++++++----
 daemon/src/video/video_preferences.h      |  1 +
 4 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/daemon/src/client/dbus/video_controls.cpp 
b/daemon/src/client/dbus/video_controls.cpp
index ed6953a..f2b65ea 100644
--- a/daemon/src/client/dbus/video_controls.cpp
+++ b/daemon/src/client/dbus/video_controls.cpp
@@ -153,6 +153,11 @@ VideoControls::setActiveDeviceRate(const std::string &rate)
 }
 
 std::map<std::string, std::string>
+VideoControls::getSettingsFor(const std::string& device) {
+    return videoPreference_.getSettingsFor(device);
+}
+
+std::map<std::string, std::string>
 VideoControls::getSettings() {
     return videoPreference_.getSettings();
 }
diff --git a/daemon/src/client/video_controls.h 
b/daemon/src/client/video_controls.h
index 0a5fc88..eb081ef 100644
--- a/daemon/src/client/video_controls.h
+++ b/daemon/src/client/video_controls.h
@@ -93,6 +93,9 @@ class VideoControls : public 
org::sflphone::SFLphone::VideoControls_adaptor,
         getDeviceRateList(const std::string &dev, const std::string &channel, 
const std::string &size);
 
         std::map<std::string, std::string>
+        getSettingsFor(const std::string& device);
+
+        std::map<std::string, std::string>
         getSettings();
 
         void
diff --git a/daemon/src/video/video_preferences.cpp 
b/daemon/src/video/video_preferences.cpp
index 332a885..ec6484a 100644
--- a/daemon/src/video/video_preferences.cpp
+++ b/daemon/src/video/video_preferences.cpp
@@ -43,13 +43,13 @@ VideoPreference::VideoPreference() :
     v4l2_list_->start();
 }
 
-std::map<std::string, std::string> VideoPreference::getSettings()
+std::map<std::string, std::string> VideoPreference::getSettingsFor(const 
std::string& device)
 {
     std::map<std::string, std::string> args;
-    if (not device_.empty()) {
-        args["input"] = v4l2_list_->getDeviceNode(device_);
+    if (not device.empty()) {
+        args["input"] = v4l2_list_->getDeviceNode(device);
         std::stringstream ss;
-        ss << v4l2_list_->getChannelNum(device_, channel_);
+        ss << v4l2_list_->getChannelNum(device, channel_);
         args["channel"] = ss.str();
         args["video_size"] = size_;
         size_t x_pos = size_.find("x");
@@ -61,6 +61,11 @@ std::map<std::string, std::string> 
VideoPreference::getSettings()
     return args;
 }
 
+std::map<std::string, std::string> VideoPreference::getSettings()
+{
+       return getSettingsFor(device_);
+}
+
 void VideoPreference::serialize(Conf::YamlEmitter &emitter)
 {
     Conf::MappingNode preferencemap(NULL);
diff --git a/daemon/src/video/video_preferences.h 
b/daemon/src/video/video_preferences.h
index 620b1f8..9ab36de 100644
--- a/daemon/src/video/video_preferences.h
+++ b/daemon/src/video/video_preferences.h
@@ -58,6 +58,7 @@ class VideoPreference : public Serializable
 
         virtual void unserialize(const Conf::YamlNode &map);
 
+        std::map<std::string, std::string> getSettingsFor(const std::string& 
device);
         std::map<std::string, std::string> getSettings();
 
         std::string getDevice() const {
-- 
1.8.5.4

_______________________________________________
SFLphone mailing list
[email protected]
http://lists.savoirfairelinux.net/mailman/listinfo/sflphone

Reply via email to