---
 daemon/src/video/video_input.cpp       | 10 ++++++++++
 daemon/src/video/video_preferences.cpp | 13 +++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/daemon/src/video/video_input.cpp b/daemon/src/video/video_input.cpp
index 1de4ba1..62cec65 100644
--- a/daemon/src/video/video_input.cpp
+++ b/daemon/src/video/video_input.cpp
@@ -65,16 +65,26 @@ bool VideoInput::setup()
 {
     // it's a v4l device if starting with /dev/video
     static const char * const V4L_PATH = "/dev/video";
+    static const char * const X11_DISPLAY = ":0";
 
     string format_str;
     string input = args_["input"];
 
     decoder_ = new VideoDecoder();
 
+    /* video4linux2 specific */
     if (args_["input"].find(V4L_PATH) != std::string::npos) {
         DEBUG("Using v4l2 format");
         format_str = "video4linux2";
     }
+
+    /* x11 specific */
+    else if (args_["input"].find(X11_DISPLAY) != std::string::npos) {
+        DEBUG("Using x11grab format");
+        format_str = "x11grab";
+    }
+
+    /* common settings */
     if (!args_["framerate"].empty())
         decoder_->setOption("framerate", args_["framerate"].c_str());
     if (!args_["video_size"].empty())
diff --git a/daemon/src/video/video_preferences.cpp 
b/daemon/src/video/video_preferences.cpp
index 332a885..5aee976 100644
--- a/daemon/src/video/video_preferences.cpp
+++ b/daemon/src/video/video_preferences.cpp
@@ -46,7 +46,12 @@ VideoPreference::VideoPreference() :
 std::map<std::string, std::string> VideoPreference::getSettings()
 {
     std::map<std::string, std::string> args;
-    if (not device_.empty()) {
+
+    if (device_.empty()) {
+        // TODO do we care?
+    } else if (device_ == "X11") {
+        args["input"] = ":0";
+    } else {
         args["input"] = v4l2_list_->getDeviceNode(device_);
         std::stringstream ss;
         ss << v4l2_list_->getChannelNum(device_, channel_);
@@ -88,7 +93,11 @@ void VideoPreference::unserialize(const Conf::YamlNode &map)
 
 std::vector<std::string>
 VideoPreference::getDeviceList() {
-    return v4l2_list_->getDeviceList();
+
+    // FIXME: this should be hidden
+    auto result(v4l2_list_->getDeviceList());
+    result.push_back("X11");
+    return result;
 }
 
 std::vector<std::string>
-- 
1.8.5.4

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

Reply via email to