Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qplatformvideosink.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 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
6
8
9QPlatformVideoSink::QPlatformVideoSink(QVideoSink *parent) : QObject(parent), m_sink(parent) { }
10
12
14{
15 QMutexLocker locker(&m_mutex);
16 return m_nativeSize;
17}
18
20{
21 {
22 QMutexLocker locker(&m_mutex);
23 if (m_nativeSize == s)
24 return;
25 m_nativeSize = s;
26 }
27 emit m_sink->videoSizeChanged();
28}
29
31{
32 bool sizeChanged = false;
33
34 {
35 QMutexLocker locker(&m_mutex);
36 if (frame == m_currentVideoFrame)
37 return;
38 m_currentVideoFrame = frame;
39 m_currentVideoFrame.setSubtitleText(m_subtitleText);
40 const auto size = qRotatedFrameSize(frame);
41 if (size != m_nativeSize) {
42 m_nativeSize = size;
43 sizeChanged = true;
44 }
45 }
46
47 // emit signals outside the mutex to avoid deadlocks on the user side
48 if (sizeChanged)
49 emit m_sink->videoSizeChanged();
51}
52
54{
55 QMutexLocker locker(&m_mutex);
56 return m_currentVideoFrame;
57}
58
60{
61 {
62 QMutexLocker locker(&m_mutex);
63 if (m_subtitleText == subtitleText)
64 return;
65 m_subtitleText = subtitleText;
66 }
68}
69
71{
72 QMutexLocker locker(&m_mutex);
73 return m_subtitleText;
74}
75
77
78#include "moc_qplatformvideosink_p.cpp"
\inmodule QtCore
Definition qmutex.h:313
\inmodule QtCore
Definition qobject.h:103
QString subtitleText() const
void setSubtitleText(const QString &subtitleText)
virtual void setVideoFrame(const QVideoFrame &frame)
QVideoFrame currentVideoFrame() const
QPlatformVideoSink(QVideoSink *parent)
~QPlatformVideoSink() override
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QVideoFrame class represents a frame of video data.
Definition qvideoframe.h:27
void setSubtitleText(const QString &text)
Sets the subtitle text that should be rendered together with this video frame to text.
The QVideoSink class represents a generic sink for video data.
Definition qvideosink.h:22
void videoSizeChanged()
void subtitleTextChanged(const QString &subtitleText) QT6_ONLY(const)
void videoFrameChanged(const QVideoFrame &frame) QT6_ONLY(const)
Signals when the video frame changes.
Combined button and popup list for selecting options.
QSize qRotatedFrameSize(QSize size, int rotation)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLdouble s
[6]
Definition qopenglext.h:235
#define emit
QFrame frame
[0]