1 | // Copyright (C) 2021 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 | #include <qffmpegvideosink_p.h> |
4 | #include <qffmpegvideobuffer_p.h> |
5 | #include <private/qvideoframe_p.h> |
6 | |
7 | QT_BEGIN_NAMESPACE |
8 | |
9 | QFFmpegVideoSink::QFFmpegVideoSink(QVideoSink *sink) |
10 | : QPlatformVideoSink(sink) |
11 | { |
12 | } |
13 | |
14 | void QFFmpegVideoSink::setRhi(QRhi *rhi) |
15 | { |
16 | { |
17 | QMutexLocker guard{ &m_rhiMutex }; |
18 | if (m_rhi == rhi) |
19 | return; |
20 | m_rhi = rhi; |
21 | } |
22 | |
23 | emit rhiChanged(); |
24 | } |
25 | |
26 | void QFFmpegVideoSink::onVideoFrameChanged(const QVideoFrame &frame) |
27 | { |
28 | QMutexLocker guard { &m_rhiMutex }; |
29 | auto *buffer = QVideoFramePrivate::hwBuffer(frame); |
30 | if (buffer && m_rhi) |
31 | buffer->initTextureConverter(*m_rhi); |
32 | } |
33 | |
34 | QT_END_NAMESPACE |
35 | |
36 | #include "moc_qffmpegvideosink_p.cpp" |
37 |