summaryrefslogtreecommitdiffstats
path: root/src/multimedia
diff options
context:
space:
mode:
Diffstat (limited to 'src/multimedia')
-rw-r--r--src/multimedia/video/qvideotexturehelper.cpp7
-rw-r--r--src/multimedia/video/qvideotexturehelper_p.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/multimedia/video/qvideotexturehelper.cpp b/src/multimedia/video/qvideotexturehelper.cpp
index 27129c770..0f46c4805 100644
--- a/src/multimedia/video/qvideotexturehelper.cpp
+++ b/src/multimedia/video/qvideotexturehelper.cpp
@@ -505,12 +505,12 @@ int updateRhiTextures(QVideoFrame frame, QRhi *rhi, QRhiResourceUpdateBatch *res
return description->nplanes;
}
-void SubtitleLayout::updateFromVideoFrame(const QVideoFrame &frame)
+bool SubtitleLayout::updateFromVideoFrame(const QVideoFrame &frame)
{
auto text = frame.subtitleText();
text.replace(QLatin1Char('\n'), QChar::LineSeparator);
if (layout.text() == text && videoSize == frame.size())
- return;
+ return false;
videoSize = frame.size();
QFont font;
@@ -521,7 +521,7 @@ void SubtitleLayout::updateFromVideoFrame(const QVideoFrame &frame)
layout.setText(text);
if (text.isEmpty()) {
bounds = {};
- return;
+ return true;
}
layout.setFont(font);
QTextOption option;
@@ -557,6 +557,7 @@ void SubtitleLayout::updateFromVideoFrame(const QVideoFrame &frame)
textWidth += fontSize/4.;
bounds = QRectF((videoSize.width() - textWidth)/2., y, textWidth, height);
+ return true;
}
void SubtitleLayout::draw(QPainter *painter, const QRectF &videoRect) const
diff --git a/src/multimedia/video/qvideotexturehelper_p.h b/src/multimedia/video/qvideotexturehelper_p.h
index 261d55cf0..168ce8a86 100644
--- a/src/multimedia/video/qvideotexturehelper_p.h
+++ b/src/multimedia/video/qvideotexturehelper_p.h
@@ -107,7 +107,7 @@ struct Q_MULTIMEDIA_EXPORT SubtitleLayout
QRectF bounds;
QTextLayout layout;
- void updateFromVideoFrame(const QVideoFrame &frame);
+ bool updateFromVideoFrame(const QVideoFrame &frame);
void draw(QPainter *painter, const QRectF &videoRect) const;
QImage toImage() const;
};