mpv-player / mpv-examples

📚
235 stars 77 forks source link

Qt example does not work with the current release #62

Closed marcusbritanicus closed 5 months ago

marcusbritanicus commented 5 months ago

Description of the issue When we compile the example (qt) and run it with the current release of mpv/libmpv (0.38.0), the video is not rendered on the designated surface. Instead, a full instance of mpv is spawned, and the video is played in the mpv instance.

Steps to reproduce

  1. Compile and run the example given here.
  2. Open a video file.
  3. A full MPV instance is spawned

Expected behaviour The video is displayed inside the qt application on the designated QWidget.

Video demo of the problem

https://github.com/mpv-player/mpv-examples/assets/3350667/f7013748-cd54-466d-a537-c64b9a89b440

Qt Version 6.7.0

*MPV Version mpv v0.38.0 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects built on Apr 18 2024 14:22:21 libplacebo version: v6.338.2 FFmpeg version: n6.1.1 FFmpeg library versions: libavutil 58.29.100 libavcodec 60.31.102 libavformat 60.16.100 libswscale 7.5.100 libavfilter 9.12.100 libswresample 4.12.100

sfan5 commented 5 months ago

Window embedding via wid (as the example does) is not supported on Wayland.

marcusbritanicus commented 5 months ago

It does not work when I run it as an Xwayland client either using ./qtexample -platform xcb

marcusbritanicus commented 5 months ago

I would also like to add that I have been using libmpv for QtGreet. It was working perfectly fine on Wayland until the most recent update.

kasper93 commented 5 months ago

You have to explicit set vo to libmpv now. Qt example should be updated to reflect that.

See: https://github.com/mpv-player/mpv/blob/d61d2946653a33d961ef029b6f73c3a20b26f9eb/DOCS/client-api-changes.rst

--- mpv 0.38.0 ---
2.3    - partially revert the changes from API version 1.27, remove libmpv as
         the default VO and move it to the bottom of the auto-probing order.
         This restores the prior behavior on all platforms other than macOS,
         but still auto selects libmpv/cocoa-cb on macOS if it was built with
         support for cocoa-cb.

Related discussion for complaint letters https://github.com/mpv-player/mpv/discussions/13974

marcusbritanicus commented 5 months ago

@kasper93 Would this be the right way to do it?

mpv_set_option_string( mpv, "vo", "libmpv" );
sfan5 commented 5 months ago

You said you ran the "qt" example. It does not use the render API and does not need vo=libmpv, in fact it stops working if you do that.

The QtGreet code you linked uses the render API.

marcusbritanicus commented 5 months ago

@sfan5 Yes. I mainly meant the example. I am also facing identical issues with QtGreet. I added vo=libmpv to the example code to test. It solved the problem of mpv starting (i.e. it no longer starts). But the video, as a matter of fact, is not rendered at all.

Secondly, I added vo=libmpv to QtGreet code, and now it works perfectly. I used the qt-opengl example code for it when vo=libmpv wasn't there.

Anyways, thanks a lot for the quick response and resolutions. It worked out for me in ways we both did not expect.

Edit: Do note that I am running the example code as XWayland client: ./qtexample -platform xcb