Skip to content
Snippets Groups Projects
Commit ec376a01 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Adrien Béraud
Browse files

call: support screen sharing for macOS

Change-Id: I6737763f9920fbc1b32ee558980b4ef1daadaff8
parent 3e542c1f
No related branches found
No related tags found
No related merge requests found
......@@ -430,6 +430,31 @@ VideoInput::initX11(std::string display)
return true;
}
bool
VideoInput::initAVFoundation(const std::string& display)
{
size_t space = display.find(' ');
clearOptions();
decOpts_.format = "avfoundation";
decOpts_.input = "Capture screen 0";
decOpts_.framerate = 30;
if (space != std::string::npos) {
std::istringstream iss(display.substr(space + 1));
char sep;
unsigned w, h;
iss >> w >> sep >> h;
decOpts_.width = round2pow(w, 3);
decOpts_.height = round2pow(h, 3);
} else {
decOpts_.width = default_grab_width;
decOpts_.height = default_grab_height;
}
return true;
}
bool
VideoInput::initGdiGrab(std::string params)
{
......@@ -535,10 +560,12 @@ VideoInput::switchInput(const std::string& resource)
ready = initCamera(suffix);
} else if (prefix == DRing::Media::VideoProtocolPrefix::DISPLAY) {
/* X11 display name */
#ifndef _WIN32
ready = initX11(suffix);
#else
#ifdef __APPLE__
ready = initAVFoundation(suffix);
#elif defined(_WIN32)
ready = initGdiGrab(suffix);
#else
ready = initX11(suffix);
#endif
} else if (prefix == DRing::Media::VideoProtocolPrefix::FILE) {
/* Pathname */
......
......@@ -118,6 +118,7 @@ private:
// true if decOpts_ is ready to use, false if using promise/future
bool initCamera(const std::string& device);
bool initX11(std::string display);
bool initAVFoundation(const std::string& display);
bool initFile(std::string path);
bool initGdiGrab(std::string params);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment