Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qpipewire_screencapture.cpp
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
include
"qpipewire_screencapture_p.h"
5
6
#
include
<
QtMultimedia
/
private
/
qpipewire_screencapturehelper_p
.
h
>
7
#
include
<
QtMultimedia
/
private
/
qpipewire_instance_p
.
h
>
8
9
#
include
<
utility
>
10
11
QT_BEGIN_NAMESPACE
12
13
using
namespace
Qt::StringLiterals;
14
15
namespace
QtPipeWire
{
16
17
QPipeWireCapture
::
QPipeWireCapture
(
Source
initialSource
)
18
:
QPlatformSurfaceCapture
(
std
::
move
(
initialSource
))
19
{
20
}
21
22
QPipeWireCapture
::~
QPipeWireCapture
() =
default
;
23
24
bool
QPipeWireCapture
::
isSupported
()
25
{
26
if
(!
QPipeWireInstance
::
isLoaded
())
27
return
false
;
28
29
return
QPipeWireCaptureHelper
::
isSupported
();
30
}
31
32
QVideoFrameFormat
QPipeWireCapture
::
frameFormat
()
const
33
{
34
if
(
m_helper
)
35
return
m_helper
->
frameFormat
();
36
37
return
QVideoFrameFormat
();
38
}
39
40
bool
QPipeWireCapture
::
setActiveInternal
(
bool
active
)
41
{
42
// Initialize helper, keep alive between captures
43
if
(!
m_helper
)
44
m_helper
=
std
::
make_unique
<
QPipeWireCaptureHelper
>(*
this
);
45
46
if
(!
QPipeWireCaptureHelper
::
isSupported
()) {
47
updateError
(
QPlatformSurfaceCapture
::
Error
::
InternalError
,
48
u"There is no ScreenCast service available in org.freedesktop.portal!"_s);
49
return
false
;
50
}
51
52
m_helper
->
setFrameRate
(
frameRate
().
value_or
(
DefaultCaptureFrameRate
));
53
54
if
(
active
)
55
m_helper
->
start
();
56
else
57
m_helper
->
stop
();
58
59
return
true
;
60
}
61
62
}
// namespace QtPipeWire
63
64
QT_END_NAMESPACE
QtPipeWire
Definition
qpipewire_async_support.cpp:10
qtmultimedia
src
multimedia
pipewire
qpipewire_screencapture.cpp
Generated on
for Qt by
1.16.1