summaryrefslogtreecommitdiffstats
path: root/src/plugins/multimedia/ffmpeg/qffmpegvideosink.cpp
blob: ec99d8dd25b39f799eae42a0ccf4709a777244cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qffmpegvideosink_p.h>
#include <qffmpegvideobuffer_p.h>

QT_BEGIN_NAMESPACE

QFFmpegVideoSink::QFFmpegVideoSink(QVideoSink *sink)
    : QPlatformVideoSink(sink)
{
}

void QFFmpegVideoSink::setRhi(QRhi *rhi)
{
    if (m_rhi == rhi)
        return;
    m_rhi = rhi;
    textureConverter = QFFmpeg::TextureConverter(rhi);
    emit rhiChanged(rhi);
}

void QFFmpegVideoSink::setVideoFrame(const QVideoFrame &frame)
{
    auto *buffer = dynamic_cast<QFFmpegVideoBuffer *>(frame.videoBuffer());
    if (buffer)
        buffer->setTextureConverter(textureConverter);

    QPlatformVideoSink::setVideoFrame(frame);
}

QT_END_NAMESPACE

#include "moc_qffmpegvideosink_p.cpp"