Bug 145735 - qt6: Support video playback in Impress presentations on Wayland
Summary: qt6: Support video playback in Impress presentations on Wayland
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
7.3.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Michael Weghorn
URL:
Whiteboard: target:24.8.0 target:24.2.4
Keywords:
: 147687 (view as bug list)
Depends on:
Blocks: Wayland Qt6
  Show dependency treegraph
 
Reported: 2021-11-17 13:27 UTC by Michael Weghorn
Modified: 2024-05-24 16:19 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Video of behavior with qt6 xcb (4.81 MB, video/x-matroska)
2024-05-17 14:37 UTC, Michael Weghorn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Weghorn 2021-11-17 13:27:10 UTC
see tdf#125219 for qt5/kf5

Steps to reproduce

0) Use qt6 VCL plugin in a Plasma Wayland session
1) open a presentation containing a video in Impress (e.g. attachment 145517 [details] from bug 120452)
2) start slide show by pressing F5

As of now, video is not shown properly. qt5/kf5 use GStreamer's "qwidget5videosink", but that one is not available for Qt 6 and will probably not be ported for qt6. From commit message of the commit that introduced the qt6 VCL plugin:

> commit 88d57cf241209ffec9eaed3e523942ab51af6db6
> Author: Michael Weghorn <m.weghorn@posteo.de>
> Date:   Wed Sep 29 11:09:51 2021 +0200
> 
>     qt6: Add a qt6 VCL plugin
>     
>     [...]
> 
>     6) There's currently no Qt 6 video sink for GStreamer.
>     As of today, qt-gstreamer is unmaintained and there is no Qt 6 version.
>     The project's README [2] says:
>     
>     > 0. Maintenance Notice
>     > ---------------------
>     >
>     > This code is unmaintained. You can use it at your own risk.
>     >
>     > If you want to integrate video display in your QML-based UI,
>     > you should consider using 'qmlglsink', from gst-plugins-good.
>     > This is a well supported video sink that uses the generic
>     > gstreamer-gl stack and is in many ways superior to 'qtquick2videosink'
>     > that is provided by qt-gstreamer. You can use this code as an example:
>     > https://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/examples/qt/qmlsink
>     >
>     > If you are not interested in using QML in your UI, then you
>     > may use one of the other elements provided by this module
>     > (see below). If you do that, it would be helpful to let us
>     > know that this code is still useful to you. We may consider
>     > adding these elements in one of the core gstreamer modules.
>     >
>     > If you are here for the Qt-style bindings, I'm sorry to disappoint you.
>     > The alternative is to use the C API, or the GStreamermm C++ API.
>     > Qt-style bindings are cool, but unfortunately they are very hard
>     > to maintain because they are written by hand. If you are interested
>     > in continuing this project, you are welcome to implement a
>     > generator for them, probably based on GObject-Introspection.
>     > I am happy to provide directions if you want to pursue such a thing.
>     
>     Therefore, the Qt video sink handling is qt5-only and the
>     corresponding handling for GOBJECT (used for the GStreamer
>     video sink handling) was not taken over for qt6.
>     
>     This presumably means that video playback in Impress presentations
>     does not work when using qt6 with they Qt Wayland plugin,
>     s. tdf#125219 for the corresponding bug for qt5/kf5.
>     (I did not build the qtwayland module to actually test this, though.
>     Video playback with the Qt xcb plugin in a Wayland session works.)
>     
>     [1] https://doc-snapshots.qt.io/qt6-dev/extras-changes-qt6.html
>     [2] https://cgit.freedesktop.org/gstreamer/qt-gstreamer/tree/README
Comment 1 Michael Weghorn 2021-11-17 13:31:37 UTC
2 potential ways forward:

1) Add support for GStreamer's waylandsink, similar to how this commit did for gtk3:

    commit 9d18bc40416b651340804f44ba5fae65f3bbbcfa
    Author: Caolán McNamara <caolanm@redhat.com>
    Date:   Thu May 23 17:09:51 2019 +0100

        tdf#125271 under wayland without gtksink, try waylandsink

2) Maybe it makes sense to take a look whether implementing an own XPlayer using Qt's own video/media framework [1] makes sense, which uses GStreamer internally. The waylandsink approach e.g. has the drawback that Qt private API is needed to get a handle to the Wayland surface.

[1] https://doc.qt.io/qt-5/videooverview.html
Comment 2 Roman Kuznetsov 2021-11-18 19:40:24 UTC
(In reply to Michael Weghorn from comment #1)
> 2) Maybe it makes sense to take a look whether implementing an own XPlayer
> using Qt's own video/media framework [1] makes sense, which uses GStreamer
> internally. The waylandsink approach e.g. has the drawback that Qt private
> API is needed to get a handle to the Wayland surface.
> 
> [1] https://doc.qt.io/qt-5/videooverview.html

May be just revert deleted VLC embedded feature https://gerrit.libreoffice.org/c/core/+/108283 and to complete its implementing?
Comment 3 Michael Weghorn 2021-11-19 06:58:40 UTC
(In reply to Roman Kuznetsov from comment #2)
> May be just revert deleted VLC embedded feature
> https://gerrit.libreoffice.org/c/core/+/108283 and to complete its
> implementing?

Thanks, that might be another option to consider.
Comment 4 Jan-Marek Glogowski 2022-04-08 11:06:32 UTC
Caolan implemented a Gtk-based AV backend in

commit d0a527ec09516bc7215baf229adb90cd21ffa27a
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

Maybe we should switch to Qt Multimedia.

While playback works here in Impress presentation mode, playback in any component is broken. Qt Multimedia also uses GStreamer and should work better. Never tested Wayland.
Comment 5 Michael Weghorn 2022-11-06 19:39:33 UTC
Bug 147687 comment 2 says:

> OK, that's why. I'm on Fedora and the relevant package (qt5-gstreamer) was
> dropped after Fedora 30 on the basis that the source is no longer
> maintained. Is there an alternative that is still maintained?

So it *might* be worth considering to provide any solution created in the context of this ticket for qt5 as well (should that be reasonably simple).
Comment 6 Michael Weghorn 2022-11-06 19:46:43 UTC
*** Bug 147687 has been marked as a duplicate of this bug. ***
Comment 7 Michael Weghorn 2024-05-17 14:37:35 UTC
Created attachment 194177 [details]
Video of behavior with qt6 xcb

It turns out that at least with current qtbase (dev branch as of 70a2e7f32b9f9ce19d1538f14fbde7b0d1e77ffd), video playback with qt6 doesn't even work with the xcb Qt QPA plugin, i.e. on X11, s. attached screencast:

Audio works, but Impress is unresponsive and only a black screen is shown instead of the video when starting the presentation.

Most likely related: tdf#160565

Version: 24.8.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 7c25b9c2a0770a66c18b4cd2f5d09d47fa7e057e
CPU threads: 32; OS: Linux 6.7; UI render: default; VCL: qt6 (cairo+xcb)
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: CL threaded
Comment 8 Commit Notification 2024-05-18 04:56:30 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2f4103da5625a9b90eb41d5c767a248a8d0b4255

tdf#160565 tdf#145735 qt: Avoid native window handles for Qt 6

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2024-05-18 13:18:34 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/9497be2e668c19aedc588588bf9dfed9338afe54

tdf#160565 tdf#145735 qt: Avoid native window handles for Qt 6

It will be available in 24.2.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2024-05-21 15:28:33 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/441d8ed9be0e7f831b455a69b8688dcb79a8bc00

tdf#145735 avmedia qt: Use QtMultimedia for Qt 6 media playback

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2024-05-24 16:18:22 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/81c94af71206013cb200f5612bc3bd61c799cf83

tdf#145735 qt: Set margins for video widget/layout to 0

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2024-05-24 16:19:24 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/79644440bd204bdecb73522c1eda6c101c40edda

tdf#145735 qt avmedia: Return video resolution for preferred win size

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.