Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qpipewire_videostream_p.h
Go to the documentation of this file.
1
// Copyright (C) 2026 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
#
ifndef
QPIPEWIRE_VIDEOSTREAM_P_H
5
#
define
QPIPEWIRE_VIDEOSTREAM_P_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
QtMultimedia
/
private
/
qpipewire_cameracontextmanager_p
.
h
>
19
#
include
<
QtMultimedia
/
private
/
qtmultimediaglobal_p
.
h
>
20
#
include
<
QtMultimedia
/
qvideoframe
.
h
>
21
#
include
<
QtMultimedia
/
qvideoframeformat
.
h
>
22
#
include
<
QtCore
/
qbytearray
.
h
>
23
#
include
<
QtCore
/
qmutex
.
h
>
24
#
include
<
QtCore
/
qobject
.
h
>
25
#
include
<
QtCore
/
qsize
.
h
>
26
27
#
include
<
bitset
>
28
#
include
<
optional
>
29
30
#
include
<
spa
/
buffer
/
buffer
.
h
>
31
#
include
<
spa
/
param
/
video
/
format
.
h
>
32
33
#
include
<
pipewire
/
version
.
h
>
34
35
// DMABUF negotiation needs SPA_FORMAT_VIDEO_modifier/SPA_VIDEO_FLAG_MODIFIER(_FIXATION_REQUIRED)
36
// and SPA_PARAM_BUFFERS_dataType, none of which older libspa headers declare.
37
#
if
QT_CONFIG
(
linux_dmabuf
)
&&
PW_CHECK_VERSION
(
0
,
3
,
76
)
38
#
define
QT_PIPEWIRE_HAS_DMABUF_CAMERA
1
39
#
else
40
#
define
QT_PIPEWIRE_HAS_DMABUF_CAMERA
0
41
#
endif
42
43
QT_BEGIN_NAMESPACE
44
45
namespace
QtPipeWire
{
46
47
using
BufferDataTypes
=
std
::
bitset
<
SPA_DATA_DmaBuf
+ 1>;
48
49
class
Q_MULTIMEDIA_EXPORT
QPipeWireVideoStream
:
public
QObject
50
{
51
Q_OBJECT
52
53
public
:
54
QPipeWireVideoStream
(
QCameraContextManager
&
context
,
QByteArray
targetObject
,
55
QVideoFrameFormat
::
PixelFormat
requestedPixelFormat
,
QSize
requestedSize
,
56
qreal
requestedFrameRate
);
57
~
QPipeWireVideoStream
()
override
;
58
59
Q_DISABLE_COPY_MOVE
(
QPipeWireVideoStream
)
60
61
bool
start
();
62
63
QVideoFrameFormat
frameFormat
()
const
;
64
65
Q_SIGNALS
:
66
void
newVideoFrame
(
const
QVideoFrame
&
frame
);
67
void
errorOccurred
(
const
QString
&
errorString
);
68
69
private
:
70
void
onStateChanged
(
pw_stream_state
old
,
pw_stream_state
state
,
const
char
*
error
);
71
void
onParamChanged
(
uint32_t
id
,
const
spa_pod
*
param
);
72
void
onProcess
();
73
74
#
if
QT_PIPEWIRE_HAS_DMABUF_CAMERA
75
// Answers a SPA_VIDEO_FLAG_MODIFIER_FIXATION_REQUIRED request with the one
76
// modifier we can read, which makes the server send a fixated format.
77
void
confirmDmaBufModifier
(
spa_video_format
,
spa_rectangle
);
78
#
endif
79
80
static
const
pw_stream_events
&
streamEvents
();
81
82
QCameraContextManager
&
m_context
;
83
const
QByteArray
m_targetObject
;
84
const
QVideoFrameFormat
::
PixelFormat
m_requestedPixelFormat
;
85
const
QSize
m_requestedSize
;
86
const
qreal
m_requestedFrameRate
;
87
88
PwStreamHandle
m_stream
;
89
spa_hook
m_streamListener
{};
90
91
mutable
QMutex
m_formatMutex
;
92
QVideoFrameFormat
m_frameFormat
;
93
94
// Only meaningful on the event loop thread. A DMABUF buffer is only read when
95
// its layout is known: a compressed byte stream, or raw with a linear modifier.
96
bool
m_dmaBufReadable
=
false
;
97
BufferDataTypes
m_bufferDataTypes
;
98
};
99
100
}
// namespace QtPipeWire
101
102
QT_END_NAMESPACE
103
104
#
endif
// QPIPEWIRE_VIDEOSTREAM_P_H
QtPipeWire::QPipeWireVideoStream
Definition
qpipewire_videostream_p.h:50
QtPipeWire
Definition
qpipewire_async_support.cpp:10
QtPipeWire::Q_STATIC_LOGGING_CATEGORY
Q_STATIC_LOGGING_CATEGORY(lcPipewireAudioSink, "qt.multimedia.pipewire.audiosink")
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
__has_include
#define __has_include(x)
Definition
qcompilerdetection.h:459
QT_PIPEWIRE_HAS_DMABUF_CAMERA
#define QT_PIPEWIRE_HAS_DMABUF_CAMERA
Definition
qpipewire_videostream_p.h:40
qtmultimedia
src
multimedia
pipewire
qpipewire_videostream_p.h
Generated on
for Qt by
1.18.0