- controlapi.cpp: make ScreenshotCGI() more configurable

This commit is contained in:
svenhoefer
2013-02-12 13:58:21 +01:00
parent 08fd651d60
commit 133740da14
2 changed files with 25 additions and 6 deletions

View File

@@ -1463,10 +1463,23 @@ void CControlAPI::ReloadPluginsCGI(CyhookHandler *hh)
void CControlAPI::ScreenshotCGI(CyhookHandler *hh)
{
CScreenShot * sc = new CScreenShot("/tmp/screenshot.png", (CScreenShot::screenshot_format_t)0 /*PNG*/);
sc->EnableOSD(true);
bool enableOSD = true;
bool enableVideo = true;
std::string filename = "screenshot";
if(hh->ParamList["osd"] == "0")
enableOSD = false;
if(hh->ParamList["video"] == "0")
enableVideo = false;
if(hh->ParamList["name"] != "")
filename = hh->ParamList["name"];
CScreenShot * sc = new CScreenShot("/tmp/" + filename + ".png", (CScreenShot::screenshot_format_t)0 /*PNG*/);
sc->EnableOSD(enableOSD);
sc->EnableVideo(enableVideo);
sc->Start();
hh->SendOk();
hh->SendOk(); // FIXME what if sc->Start() failed?
}
//-----------------------------------------------------------------------------