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 TimeController &tc, QVideoSink *sink)
14 : Renderer(tc), m_sink(sink)
15{
16}
17
18void SubtitleRenderer::setOutput(QVideoSink *sink, bool cleanPrevSink)
19{
20 setOutputInternal(m_sink, sink, [=](QVideoSink *prev) {
21 if (!prev)
22 return;
23
24 if (sink)
25 sink->setSubtitleText(prev->subtitleText());
26
27 if (cleanPrevSink)
28 prev->setSubtitleText({});
29 });
30}
31
33{
34 if (m_sink)
35 m_sink->setSubtitleText({});
36}
37
39{
40 if (m_sink)
41 m_sink->setSubtitleText(frame.isValid() ? frame.text() : QString());
42
43 return {};
44}
45
46} // namespace QFFmpeg
47
48QT_END_NAMESPACE
49
50#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