From a948e1f95581a7fb3b64b379cc96feabb887c03d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Mon, 23 Mar 2015 12:03:46 -0400
Subject: [PATCH] use a common camera:// prefix for video input

Refs #69017

Change-Id: Iab0a6d49221d1a14e5e563e1747ea5a1dd5aff22
---
 bin/dbus/videomanager-introspec.xml      | 2 +-
 src/media/video/video_device_monitor.cpp | 4 +---
 src/media/video/video_input.cpp          | 5 +----
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/bin/dbus/videomanager-introspec.xml b/bin/dbus/videomanager-introspec.xml
index 4e6fcc2a9f..56cea15485 100644
--- a/bin/dbus/videomanager-introspec.xml
+++ b/bin/dbus/videomanager-introspec.xml
@@ -60,7 +60,7 @@
                     A media resource locator (MRL).
                     Currently, the following are supported:
                     <ul>
-                        <li>v4l2://DEVICE</li>
+                        <li>camera://DEVICE</li>
                         <li>display://DISPLAY_NAME[ WIDTHxHEIGHT]</li>
                         <li>file://IMAGE_PATH</li>
                     </ul>
diff --git a/src/media/video/video_device_monitor.cpp b/src/media/video/video_device_monitor.cpp
index 8e9dcbf050..f8fdc07d39 100644
--- a/src/media/video/video_device_monitor.cpp
+++ b/src/media/video/video_device_monitor.cpp
@@ -108,9 +108,7 @@ VideoDeviceMonitor::getMRLForDefaultDevice() const
     const auto it = findDeviceByName(defaultDevice_);
     if(it == std::end(devices_))
         return {};
-
-    auto prefix = it->getDeviceParams().format;
-    return prefix + "://" + it->getSettings().name;
+    return "camera://" + it->getSettings().name;
 }
 
 void
diff --git a/src/media/video/video_input.cpp b/src/media/video/video_input.cpp
index e76aec132d..5cae5b9b08 100644
--- a/src/media/video/video_input.cpp
+++ b/src/media/video/video_input.cpp
@@ -317,7 +317,7 @@ VideoInput::switchInput(const std::string& resource)
 
     bool valid = false;
 
-    if (prefix == "video4linux2") {
+    if (prefix == "camera") {
         /* Video4Linux2 */
         valid = initCamera(suffix);
     } else if (prefix == "display") {
@@ -326,9 +326,6 @@ VideoInput::switchInput(const std::string& resource)
     } else if (prefix == "file") {
         /* Pathname */
         valid = initFile(suffix);
-    } else if (prefix == "avfoundation") {
-        /* AVFoundation */
-        valid = initCamera(suffix);
     }
 
     // Unsupported MRL or failed initialization
-- 
GitLab