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
7QT_BEGIN_NAMESPACE
8
9QFFmpegVideoSink::QFFmpegVideoSink(QVideoSink *sink)
10 : QPlatformVideoSink(sink)
11{
12}
13
14void QFFmpegVideoSink::setRhi(QRhi *rhi)
15{
16 if (m_rhi == rhi)
17 return;
18 m_rhi = rhi;
19 textureConverter = QFFmpeg::TextureConverter(rhi);
20 emit rhiChanged(rhi);
21}
22
23void QFFmpegVideoSink::setVideoFrame(const QVideoFrame &frame)
24{
25 auto *buffer = dynamic_cast<QFFmpegVideoBuffer *>(QVideoFramePrivate::hwBuffer(frame));
26 if (buffer)
27 buffer->setTextureConverter(textureConverter);
28
29 QPlatformVideoSink::setVideoFrame(frame);
30}
31
32QT_END_NAMESPACE
33
34#include "moc_qffmpegvideosink_p.cpp"
35

source code of qtmultimedia/src/plugins/multimedia/ffmpeg/qffmpegvideosink.cpp