forked from qt-creator/qt-creator
ScreenRecorder: Add setting for capturing the mouse cursor
This adds a boolean setting for capturing the mouse cursor which is by default true. macOS would otherwise not capture it by default. Change-Id: Ic70eb4c70e1be8c452ff32ef6c54f072ccc31caa Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -322,6 +322,7 @@ QStringList RecordWidget::ffmpegParameters(const ClipInfo &clipInfo) const
|
|||||||
Internal::settings().recordSettings();
|
Internal::settings().recordSettings();
|
||||||
const QString frameRateStr = QString::number(rS.frameRate);
|
const QString frameRateStr = QString::number(rS.frameRate);
|
||||||
const QString screenIdStr = QString::number(rS.screenId);
|
const QString screenIdStr = QString::number(rS.screenId);
|
||||||
|
const QString captureCursorStr = Internal::settings().captureCursor() ? "1" : "0";
|
||||||
QStringList videoGrabParams;
|
QStringList videoGrabParams;
|
||||||
// see http://trac.ffmpeg.org/wiki/Capture/Desktop
|
// see http://trac.ffmpeg.org/wiki/Capture/Desktop
|
||||||
switch (HostOsInfo::hostOs()) {
|
switch (HostOsInfo::hostOs()) {
|
||||||
@@ -334,6 +335,7 @@ QStringList RecordWidget::ffmpegParameters(const ClipInfo &clipInfo) const
|
|||||||
? screen->size() * screen->devicePixelRatio()
|
? screen->size() * screen->devicePixelRatio()
|
||||||
: rS.cropRect.size());
|
: rS.cropRect.size());
|
||||||
videoGrabParams.append({"-f", "x11grab"});
|
videoGrabParams.append({"-f", "x11grab"});
|
||||||
|
videoGrabParams.append({"-draw_mouse", captureCursorStr});
|
||||||
videoGrabParams.append({"-framerate", frameRateStr});
|
videoGrabParams.append({"-framerate", frameRateStr});
|
||||||
videoGrabParams.append({"-video_size", videoSize});
|
videoGrabParams.append({"-video_size", videoSize});
|
||||||
videoGrabParams.append({"-i", QString("%1+%2,%3").arg(x11display)
|
videoGrabParams.append({"-i", QString("%1+%2,%3").arg(x11display)
|
||||||
@@ -348,6 +350,7 @@ QStringList RecordWidget::ffmpegParameters(const ClipInfo &clipInfo) const
|
|||||||
.arg(rS.cropRect.y()));
|
.arg(rS.cropRect.y()));
|
||||||
}
|
}
|
||||||
filter.append(":framerate=" + frameRateStr);
|
filter.append(":framerate=" + frameRateStr);
|
||||||
|
filter.append(":draw_mouse=" + captureCursorStr);
|
||||||
filter.append(",hwdownload");
|
filter.append(",hwdownload");
|
||||||
filter.append(",format=bgra");
|
filter.append(",format=bgra");
|
||||||
videoGrabParams = {
|
videoGrabParams = {
|
||||||
@@ -359,6 +362,7 @@ QStringList RecordWidget::ffmpegParameters(const ClipInfo &clipInfo) const
|
|||||||
case OsTypeMac: {
|
case OsTypeMac: {
|
||||||
videoGrabParams = {
|
videoGrabParams = {
|
||||||
"-f", "avfoundation",
|
"-f", "avfoundation",
|
||||||
|
"-capture_cursor", captureCursorStr,
|
||||||
"-framerate", frameRateStr,
|
"-framerate", frameRateStr,
|
||||||
"-pixel_format", "bgr0",
|
"-pixel_format", "bgr0",
|
||||||
"-i", QString("Capture screen %1:none").arg(rS.screenId),
|
"-i", QString("Capture screen %1:none").arg(rS.screenId),
|
||||||
|
|||||||
@@ -67,6 +67,11 @@ ScreenRecorderSettings::ScreenRecorderSettings()
|
|||||||
ffprobeTool.setDefaultValue(ffprobeDefault.toUserOutput());
|
ffprobeTool.setDefaultValue(ffprobeDefault.toUserOutput());
|
||||||
ffprobeTool.setLabelText(Tr::tr("ffprobe tool:"));
|
ffprobeTool.setLabelText(Tr::tr("ffprobe tool:"));
|
||||||
|
|
||||||
|
captureCursor.setSettingsKey("CaptureCursor");
|
||||||
|
captureCursor.setDefaultValue(true);
|
||||||
|
captureCursor.setLabel(Tr::tr("Capture the mouse cursor"));
|
||||||
|
captureCursor.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox);
|
||||||
|
|
||||||
enableFileSizeLimit.setSettingsKey("EnableFileSizeLimit");
|
enableFileSizeLimit.setSettingsKey("EnableFileSizeLimit");
|
||||||
enableFileSizeLimit.setDefaultValue(true);
|
enableFileSizeLimit.setDefaultValue(true);
|
||||||
enableFileSizeLimit.setLabel(Tr::tr("Size limit for intermediate output file"));
|
enableFileSizeLimit.setLabel(Tr::tr("Size limit for intermediate output file"));
|
||||||
@@ -145,6 +150,7 @@ ScreenRecorderSettings::ScreenRecorderSettings()
|
|||||||
Group {
|
Group {
|
||||||
title(Tr::tr("Record settings")),
|
title(Tr::tr("Record settings")),
|
||||||
Column {
|
Column {
|
||||||
|
captureCursor,
|
||||||
Row { enableFileSizeLimit, fileSizeLimit, st },
|
Row { enableFileSizeLimit, fileSizeLimit, st },
|
||||||
Row { enableRtBuffer, rtBufferSize, st },
|
Row { enableRtBuffer, rtBufferSize, st },
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,10 +5,6 @@
|
|||||||
|
|
||||||
#include <utils/aspects.h>
|
#include <utils/aspects.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QScreen;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace ScreenRecorder::Internal {
|
namespace ScreenRecorder::Internal {
|
||||||
|
|
||||||
class ScreenRecorderSettings : public Utils::AspectContainer
|
class ScreenRecorderSettings : public Utils::AspectContainer
|
||||||
@@ -30,6 +26,7 @@ public:
|
|||||||
// Visible in Settings page
|
// Visible in Settings page
|
||||||
Utils::FilePathAspect ffmpegTool{this};
|
Utils::FilePathAspect ffmpegTool{this};
|
||||||
Utils::FilePathAspect ffprobeTool{this};
|
Utils::FilePathAspect ffprobeTool{this};
|
||||||
|
Utils::BoolAspect captureCursor{this};
|
||||||
Utils::BoolAspect enableFileSizeLimit{this};
|
Utils::BoolAspect enableFileSizeLimit{this};
|
||||||
Utils::IntegerAspect fileSizeLimit{this}; // in MB
|
Utils::IntegerAspect fileSizeLimit{this}; // in MB
|
||||||
Utils::BoolAspect enableRtBuffer{this};
|
Utils::BoolAspect enableRtBuffer{this};
|
||||||
|
|||||||
Reference in New Issue
Block a user