summaryrefslogtreecommitdiff
path: root/avmedia/source
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-05-24 11:31:09 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-05-24 18:18:17 +0200
commit79644440bd204bdecb73522c1eda6c101c40edda (patch)
tree0c3325d441786b84f17ce6bcbaf0a39c5a6bdd95 /avmedia/source
parent81c94af71206013cb200f5612bc3bd61c799cf83 (diff)
tdf#145735 qt avmedia: Return video resolution for preferred win size
In `QtPlayer::getPreferredPlayerWindowSize`, retrieve the video resolution from the meta data and return that for the preferred window size if available, instead of always returning an empty rect. For the sample presentation referenced in tdf#145735, the size retrieved this way also matches what `GtkPlayer::getPreferredPlayerWindowSize` returns (720x400). As mentioned in commit 441d8ed9be0e7f831b455a69b8688dcb79a8bc00 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Mon May 20 16:25:09 2024 +0200 tdf#145735 avmedia qt: Use QtMultimedia for Qt 6 media playback , the behaviour without this was: > * In non-presentation mode, the placeholder > shown until the video gets started using the controls > in the sidebar is just an "audio icon", not a frame > from the actual video. (This might be related to the > fact that `QtPlayer::createFrameGrabber` currently > returns an empty reference.) With this in place, the placeholder is now a different icon, a "video icon" (but still not a frame from the actual video). Change-Id: I295abe6b7973fece3fcaf9a38af2602cb08610a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168013 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'avmedia/source')
-rw-r--r--avmedia/source/qt6/QtPlayer.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/avmedia/source/qt6/QtPlayer.cxx b/avmedia/source/qt6/QtPlayer.cxx
index 1ad675f37d5c..5f75394ff1a3 100644
--- a/avmedia/source/qt6/QtPlayer.cxx
+++ b/avmedia/source/qt6/QtPlayer.cxx
@@ -11,6 +11,7 @@
#include <QtCore/QUrl>
#include <QtMultimedia/QAudioOutput>
+#include <QtMultimedia/QMediaMetaData>
#include <QtMultimediaWidgets/QVideoWidget>
#include <QtWidgets/QLayout>
@@ -178,8 +179,16 @@ awt::Size SAL_CALL QtPlayer::getPreferredPlayerWindowSize()
{
osl::MutexGuard aGuard(m_aMutex);
- awt::Size aSize(0, 0);
- return aSize;
+ assert(m_xMediaPlayer);
+ const QMediaMetaData aMetaData = m_xMediaPlayer->metaData();
+ const QVariant aResolutionVariant = aMetaData.value(QMediaMetaData::Resolution);
+ if (aResolutionVariant.canConvert<QSize>())
+ {
+ const QSize aResolution = aResolutionVariant.value<QSize>();
+ return awt::Size(aResolution.width(), aResolution.height());
+ }
+
+ return awt::Size(0, 0);
}
uno::Reference<::media::XPlayerWindow>