From 53b9a46feb8d643befc91957f44000122edd4e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Fri, 3 May 2019 19:14:17 +0200 Subject: [PATCH] TakeSourceScreenshot: direct file save --- src/WSRequestHandler_Sources.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/WSRequestHandler_Sources.cpp b/src/WSRequestHandler_Sources.cpp index 1382f30a..a92b15ff 100644 --- a/src/WSRequestHandler_Sources.cpp +++ b/src/WSRequestHandler_Sources.cpp @@ -1345,6 +1345,7 @@ HandlerResponse WSRequestHandler::HandleSetSourceFilterSettings(WSRequestHandler * * @param {String} `sourceName` Source name * @param {String} `pictureFormat` Format of the encoded picture. Can be "png", "jpg", "jpeg" or "bmp" (or any other value supported by Qt's Image module) +* @param {String (optional)} `saveToFilePath` Full file path (file extension included) where the captured image is to be saved. Can be in a format different from `pictureFormat`. * @param {int (optional)} `width` Screenshot width. Defaults to the source's base width. * @param {int (optional)} `height` Screenshot height. Defaults to the source's base height. * @@ -1454,6 +1455,11 @@ HandlerResponse WSRequestHandler::HandleTakeSourceScreenshot(WSRequestHandler* r sourceImage.save(&buffer, pictureFormat); buffer.close(); + if (req->hasField("saveToFilePath")) { + QString imageFilePath = obs_data_get_string(req->data, "saveToFilePath"); + sourceImage.save(imageFilePath); + } + QString imgBase64(encodedImgBytes.toBase64()); imgBase64.prepend( QString("data:image/%1;base64,").arg(pictureFormat)