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
,
std
::
shared_ptr
<
QPipeWireInstance
>
instance
)
18
:
QPlatformSurfaceCapture
(
std
::
move
(
initialSource
)),
m_instance
(
std
::
move
(
instance
))
19
{
20
Q_ASSERT
(
m_instance
);
21
}
22
23
QPipeWireCapture
::~
QPipeWireCapture
() =
default
;
24
25
std
::
unique_ptr
<
QPipeWireCapture
>
QPipeWireCapture
::
create
(
Source
initialSource
)
26
{
27
auto
instance
=
QPipeWireInstance
::
instance
();
28
if
(!
instance
)
29
return
nullptr
;
30
31
if
(!
instance
->
hasScreenCastPortal
())
32
return
nullptr
;
33
34
return
std
::
make_unique
<
QPipeWireCapture
>(
std
::
move
(
initialSource
),
std
::
move
(
instance
));
35
}
36
37
QVideoFrameFormat
QPipeWireCapture
::
frameFormat
()
const
38
{
39
if
(
m_helper
)
40
return
m_helper
->
frameFormat
();
41
42
return
QVideoFrameFormat
();
43
}
44
45
bool
QPipeWireCapture
::
setActiveInternal
(
bool
active
)
46
{
47
// Initialize helper, keep alive between captures
48
if
(!
m_helper
)
49
m_helper
=
std
::
make_unique
<
QPipeWireCaptureHelper
>(*
this
,
m_instance
);
50
51
Q_ASSERT
(
m_instance
->
hasScreenCastPortal
());
52
53
m_helper
->
setFrameRate
(
frameRate
().
value_or
(
DefaultCaptureFrameRate
));
54
55
if
(
active
)
56
m_helper
->
start
();
57
else
58
m_helper
->
stop
();
59
60
return
true
;
61
}
62
63
}
// namespace QtPipeWire
64
65
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