office-gobmx/avmedia/source/qt6/gstwindow.cxx
Michael Weghorn 441d8ed9be tdf#145735 avmedia qt: Use QtMultimedia for Qt 6 media playback
Similar to the way that GTK 4's native facilities for
video playback are used for the gtk4 VCL plugin, initially
added in commit

        commit d0a527ec09
        Author: Caolán McNamara <caolanm@redhat.com>
        Date:   Thu Feb 10 12:55:18 2022 +0000

            first cut at using Gtk4 built in video playback

, implement media playback using QtMultimedia for the
Qt 6 based VCL plugins (qt6/kf6) via a new service
"com.sun.star.comp.avmedia.Manager_Qt".

Video playback with the mechanism used for qt5 no
longer works with qt6, as "qwidget5videosink"
that gets used on Wayland for qt5 wasn't ported
to Qt 6 and is unmaintained, s. the commit message of

        commit 88d57cf241
        Author: Michael Weghorn <m.weghorn@posteo.de>
        Date:   Wed Sep 29 11:09:51 2021 +0200

            qt6: Add a qt6 VCL plugin

for more details. Additionally, this also doesn't work
properly any more on X11/with the xcb Qt QPA platform, see
tdf#145735 comment 7.

Instead of using GStreamer directly, let Qt handle
the low-level stuff by using the QtMultimedia module [1]
instead.

This adds a new dependency on QtMultimedia.
For building, this requires installing the Qt 6 QtMultimedia
development headers (e.g. package `qt6-multimedia-dev`
on current Debian testing).

Except for WASM, the use of QtMultimedia is enabled by
default when building with autogen options `--enable-qt6`
or `--enable-kf6`, but can explicitly be disabled using
`--disable-qt6-multimedia`.

In tests with the qt6 VCL plugin on Debian testing, with a
sample presentation containing an embedded
video, attachment 145517 from tdf#120452, video playback
generally works for both, the xcb and the wayland
Qt QPA platforms:

* Video and audio are played as expected on the external
  screen in presentation mode when using the presenter
  console
* Video and audio playback work in non-presentation
  mode by clicking on the video and using the controls
  in the Impress sidebar (play, pause,...).

However, the following issues were observed with
the current implementation:

* There's an odd frame/margin around the video.
* 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.)
* At least on Wayland (issue not observed with
  QT_QPA_PLATFORM=xcb so far), when using the presenter
  console,   video playback in the presenter console (i.e. on the
  non-presentation screen) is unreliable: The video
  sometimes shows, but sometimes doesn't. At least the
  (more important) one on the presentation screen was
  reliably shown in my tests, however.

Tested with git dev versions of qtbase
(as of commit 8d5e7d50d8dbf1ad79bd8ff9f6ef6028eba481c9),
qtwayland (as of commit 6f0ebd916f176f6fbe35af28caeb52b62768ac94)
and qtmultimedia (as of commit
264b7e8d7d5683252102b5e5149685c8b8a70c2d).

[1] https://doc.qt.io/qt-6/qtmultimedia-index.html

Change-Id: I29c3c7ded01c61b49b192fa5c313d8a92c942185
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167869
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-05-21 17:28:04 +02:00

12 lines
433 B
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "../gstreamer/gstwindow.cxx"
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */