Commit 68286730 authored by Philippe Gorley's avatar Philippe Gorley Committed by Philippe Gorley

video: correctly set device params on switching input

Change-Id: I98191862609b3534c060e9c88d4935a534cf6cc8
parent bd383806
......@@ -475,7 +475,7 @@ VideoInput::initFile(std::string path)
RING_WARN("Guessing file type for %s", path.c_str());
}
return true;
return false;
}
std::shared_future<DeviceParams>
......@@ -520,27 +520,25 @@ VideoInput::switchInput(const std::string& resource)
const auto suffix = resource.substr(pos + sep.size());
bool valid = false;
bool ready = false;
if (prefix == DRing::Media::VideoProtocolPrefix::CAMERA) {
/* Video4Linux2 */
valid = initCamera(suffix);
ready = initCamera(suffix);
} else if (prefix == DRing::Media::VideoProtocolPrefix::DISPLAY) {
/* X11 display name */
#ifndef _WIN32
valid = initX11(suffix);
ready = initX11(suffix);
#else
valid = initGdiGrab(suffix);
ready = initGdiGrab(suffix);
#endif
} else if (prefix == DRing::Media::VideoProtocolPrefix::FILE) {
/* Pathname */
valid = initFile(suffix);
ready = initFile(suffix);
}
// Unsupported MRL or failed initialization
if (not valid) {
RING_ERR("Failed to init input for MRL '%s'\n", resource.c_str());
return {};
if (ready) {
foundDecOpts(decOpts_);
}
switchPending_ = true;
......
......@@ -112,6 +112,7 @@ private:
void createDecoder();
void deleteDecoder();
// true if decOpts_ is ready to use, false if using promise/future
bool initCamera(const std::string& device);
bool initX11(std::string display);
bool initFile(std::string path);
......
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