Commit eb8afef9 authored by Alexandre Lision's avatar Alexandre Lision

video: expose prefixes

Tuleap: #267
Change-Id: I3ba4d7bcb051e87820a3ff321daf0c74f57d4bf8
parent 87a37130
......@@ -24,6 +24,16 @@ namespace DRing {
namespace Media {
// Supported MRL schemes
namespace VideoProtocolPrefix {
constexpr static const char* NONE = "";
constexpr static const char* DISPLAY = "display";
constexpr static const char* FILE = "file";
constexpr static const char* CAMERA = "camera";
constexpr static const char* SEPARATOR = "://";
}
namespace Details {
constexpr static char MEDIA_TYPE_AUDIO[] = "MEDIA_TYPE_AUDIO";
......
......@@ -21,6 +21,7 @@
#include <unistd.h> // for sleep
#include "test_video_input.h"
#include "video_input.h"
#include "media_const.h"
#include <map>
#include <string>
......@@ -28,7 +29,8 @@ namespace ring { namespace video { namespace test {
void VideoInputTest::testInput()
{
std::string resource = "display://" + std::string(getenv("DISPLAY") ? : ":0.0");
static const std::string sep = DRing::Media::VideoProtocolPrefix::SEPARATOR;
std::string resource = DRing::Media::VideoProtocolPrefix::DISPLAY + sep + std::string(getenv("DISPLAY") ? : ":0.0");
VideoInput video;
video.switchInput(resource);
usleep(10000);
......
......@@ -29,6 +29,7 @@
#pragma GCC diagnostic pop
#include "manager.h"
#include "media_const.h"
#include "client/videomanager.h"
#include "client/ring_signal.h"
#include "config/yamlparser.h"
......@@ -101,7 +102,8 @@ VideoDeviceMonitor::getMRLForDefaultDevice() const
const auto it = findDeviceByName(defaultDevice_);
if(it == std::end(devices_))
return {};
return "camera://" + it->getSettings().name;
static const std::string sep = DRing::Media::VideoProtocolPrefix::SEPARATOR;
return DRing::Media::VideoProtocolPrefix::CAMERA + sep + it->getSettings().name;
}
void
......
......@@ -26,6 +26,7 @@
#include "video_input.h"
#include "media_decoder.h"
#include "media_const.h"
#include "manager.h"
#include "client/videomanager.h"
#include "sinkclient.h"
......@@ -310,7 +311,7 @@ VideoInput::switchInput(const std::string& resource)
}
// Supported MRL schemes
static const std::string sep = "://";
static const std::string sep = DRing::Media::VideoProtocolPrefix::SEPARATOR;
const auto pos = resource.find(sep);
if (pos == std::string::npos)
......@@ -324,17 +325,17 @@ VideoInput::switchInput(const std::string& resource)
bool valid = false;
if (prefix == "camera") {
if (prefix == DRing::Media::VideoProtocolPrefix::CAMERA) {
/* Video4Linux2 */
valid = initCamera(suffix);
} else if (prefix == "display") {
} else if (prefix == DRing::Media::VideoProtocolPrefix::DISPLAY) {
/* X11 display name */
#ifndef _WIN32
valid = initX11(suffix);
#else
valid = initGdiGrab(suffix);
#endif
} else if (prefix == "file") {
} else if (prefix == DRing::Media::VideoProtocolPrefix::FILE) {
/* Pathname */
valid = initFile(suffix);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment