GUI embedding for Wayland
Right now, the mpv window can be embedded inside of a foreign window on the following platforms: x11, win32, cocoa.
Just wayland is missing.
Ideally, this would work via --wid, and no changes would be required for our qtexample. Though I'm not sure if this is possible.
I think @giselher did some work into this direction, but I'm not sure about its current state. I'm creating this issue to track/communicate this.
Hi, sorry that I have been on radio silence for a while. I was quite busy, but I still intend to finish embedding.
I don't know where we want to go with this though. Maybe we can render in an opengl window or buffer without the need for a nested compositor, but I don't know how feasible that is.
I'm glad you're back!
This issue isn't terrible high-priority, but it would be nice if it would work eventually.
I don't know where we want to go with this though. Maybe we can render in an opengl window or buffer without the need for a nested compositor, but I don't know how feasible that is.
It should probably go by what GUI toolkits are doing or planning to do. For example this (amazingly) works on all other platforms. I'm probably being naive here, and have no idea whether it could work this way on wayland.
It should probably go by what GUI toolkits are doing or planning to do. For example this (amazingly) works on all other platforms. I'm probably being naive here, and have no idea whether it could work this way on wayland.
I will try this soon, but I can't image what a WinID will be under wayland. Maybe a wl_display pointer?
I can't image what a WinID will be under wayland. Maybe a wl_display pointer?
Who knows. Maybe it's not even implemented.
well i hope this is finished soon... - i use smplayer, and having a external window rendered for mpv in wayland is a pain.
Seems unlikely. It's not even clear whether Wayland can support this kind of embedding. I'm tending towards saying that programs which embed mpv should use the opengl-cb API. (Of course smplayer can't do that, because it's backwards and attemps to coerce mpv into pretending to support a mplayer slave-mode-like protocol.)
The Wayland way to do that is for the host app to implement a small embedded compositor, and forward the surface as a sub-surface. There is a GTK+-based proof-of-concept available here.
Sure (I heard that before), but I already decided that opengl-cb embedding is better.
Hi, I'm a little confused on why this still open. Are there plans to make the --wid option to work with wayland by doing some work "under the hood" inside mpv?
Commit 8d8d4c5cb1 should add support for this. In theory setting the parent to mpv xdg_toplevel should work. Then you can use the xdg interface to manipulate its position, gravity, anchoring, etc.
Sorry, but xdg_toplevel.set_parent() does not support placement in any way.
Also, I am not familiar with mpv internals, but does mpv creates its own Wayland connection? If so, you cannot pass xdg_toplevels around, each connection is a separate client sharing no namespace.
If mpv does not create its own connection, then embedding should be done using a subsurface, with mpv giving a wl_surface to the parent.
If mpv creates its own connection, you need to use xdg-foreign, and then mpv cannot create an xdg_surface. And placement is not supported either, one would need to extend xdg-forgein (or create a new protocol) to allow subsurface creation, I guess.
Seems quite a lot more complicated than I thought it would be. If there's any real interest I'll investigate.
Definitely for me, as my gui to mpv is written in Gambas and i don't think there is a way to display anything from mpv inside the main ui other than embedding his window, or using Xwayland, of course
I would have thought the xdg interface object would have provided access to the wayland connection for mpv to use.
If it doesn't work, it should be removed again.
Not that I have much confidence in the architectural awereness of someone who uses Gambas.
Sorry?
You're experiencing prejudice against BASIC programmers.
Well, Gambas looks to be worse than that: BASIC meets Java meets GNU. Quite revolting.
@sardemff7: https://github.com/atomnuker/mpv/commit/dc59f993222792b595393ed64021f35bdc6a67ec This would add support for the new xdg-foreign-v2 protocol. Its currently only supported by kde git master. Do you think this is sufficient now?
Hello everybody,
I know this is a very old issue report, but I wanted to ask, whether it would be possible to make wayland-embedding in libmpv possible, too? This would be great!!! The vlc guys think about this, too (see here ;-) a function as mpv_set_wl_surface or similar would be great. Rendering through OpenGL doesn't work for me and a simpler alternative in Wayland would be very important!
Thanks in advance,
Max