Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qffmpegsubtitlerenderer.cpp
Go to the documentation of this file.
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
4#include "playbackengine/qffmpegsubtitlerenderer_p.h"
5
6#include "qvideosink.h"
7#include "qdebug.h"
8
10
11namespace QFFmpeg {
12
13SubtitleRenderer::SubtitleRenderer(const PlaybackEngineObjectID &id, const TimeController &tc,
14 QVideoSink *sink)
15 : Renderer(id, tc), m_sink(sink)
16{
17}
18
19void SubtitleRenderer::setOutput(QVideoSink *sink, bool cleanPrevSink)
20{
21 setOutputInternal(m_sink, sink, [=](QVideoSink *prev) {
22 if (!prev)
23 return;
24
25 if (sink)
26 sink->setSubtitleText(prev->subtitleText());
27
28 if (cleanPrevSink)
29 prev->setSubtitleText({});
30 });
31}
32
34{
35 if (m_sink)
36 m_sink->setSubtitleText({});
37}
38
40{
41 if (m_sink)
42 m_sink->setSubtitleText(frame.isValid() ? frame.text() : QString());
43
44 return {};
45}
46
47} // namespace QFFmpeg
48
49QT_END_NAMESPACE
50
51#include "moc_qffmpegsubtitlerenderer_p.cpp"
RenderingResult renderInternal(Frame frame) override
void setOutput(QVideoSink *sink, bool cleanPrevSink=false)
std::conditional_t< QT_FFMPEG_AVIO_WRITE_CONST, const uint8_t *, uint8_t * > AvioWriteBufferType
Combined button and popup list for selecting options.