Creating a x11 drawable window in a wxWidget

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
0xp1kachu
In need of some credit
In need of some credit
Posts: 5
Joined: Sat Jan 27, 2018 10:39 pm

Creating a x11 drawable window in a wxWidget

Post by 0xp1kachu » Sun Jan 28, 2018 12:19 am

Hello,

VLC uses X to display video in their example (https://github.com/videolan/vlc/blob/ma ... player.cpp).

The problem with this is that, whatever my application contains, VLC will draw on top of everything because it takes the whole X window as a drawable component (see https://www.videolan.org/developers/vlc ... 695147ba5b)

My question is: Is there a way to embed a X drawable component (like, recreating a window inside another one, or whatever less-scary-solution) in a wxWidget, so that I can pass VLC only part of my application, and have the video constrained in the widget's bounds ?

If not, has anybody managed to display a video on Linux using wxWidgets + VLC/AnotherLibraryThatIWouldHaveForgotten ?

User avatar
doublemax
Moderator
Moderator
Posts: 15069
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Creating a x11 drawable window in a wxWidget

Post by doublemax » Sun Jan 28, 2018 12:31 am

Code: Select all

libvlc_media_player_set_xwindow(media_player, GET_XID(this->player_widget));
Isn't that already what you're asking for?

I don't work under Linux, but under Windows VLC only draws into the window handle that i pass to the Windows equivalent of that function.
Use the source, Luke!

0xp1kachu
In need of some credit
In need of some credit
Posts: 5
Joined: Sat Jan 27, 2018 10:39 pm

Re: Creating a x11 drawable window in a wxWidget

Post by 0xp1kachu » Sun Jan 28, 2018 12:34 am

doublemax wrote:

Code: Select all

libvlc_media_player_set_xwindow(media_player, GET_XID(this->player_widget));
Isn't that already what you're asking for?
Well that's what I thought at first, but for some reason it doesn't work as expected (video all over the screen, even over the controls) :/

0xp1kachu
In need of some credit
In need of some credit
Posts: 5
Joined: Sat Jan 27, 2018 10:39 pm

Re: Creating a x11 drawable window in a wxWidget

Post by 0xp1kachu » Sun Jan 28, 2018 12:39 am

Also, to get the example to compile with the compilation command at the top of the file, I had to modify the following:

Code: Select all

// wx_player.cpp:14:32: fatal error: wx/gtk/win_gtk.h: No such file or directory
//    #include <wx/gtk/win_gtk.h>
#ifdef __WXGTK__
    #include <gdk/gdkx.h>
    #include <gtk/gtk.h>
    #include <wx/gtk/win_gtk.h>
    #define GET_XID(window) GDK_WINDOW_XWINDOW(GTK_PIZZA(window->m_wxwindow)->bin_window)
#endif
became

Code: Select all

#ifdef __WXGTK__
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#define GET_XID() GDK_WINDOW_XWINDOW(gtk_widget_get_window( (GtkWidget *) GetHandle() ))
#endif
Also,

Code: Select all

libvlc_media_player_set_xwindow(media_player, GET_XID(this->player_widget));
// became
libvlc_media_player_set_xwindow(media_player, GET_XID());

0xp1kachu
In need of some credit
In need of some credit
Posts: 5
Joined: Sat Jan 27, 2018 10:39 pm

Re: Creating a x11 drawable window in a wxWidget

Post by 0xp1kachu » Sun Jan 28, 2018 12:50 am

I also tried this for GET_XID:

Code: Select all

#define GET_XID(widget) GDK_WINDOW_XWINDOW(gtk_widget_get_window((GtkWidget*)widget->GetHandle()))
But this opens the video in another window, and I don't understand why...

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4361
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Creating a x11 drawable window in a wxWidget

Post by ONEEYEMAN » Mon Jan 29, 2018 3:48 pm

Hi,
AFAIK, the latest VLC is no longer use wxWidgets.
Did you try gstreamer? This is the way wxWidgets supports playing audio/video. Just check 'media' sample.

Thank you.

Post Reply