LibVLC, X11, Fullscreen and Keyboard Input - A bug, a workaround and a custom player program

This forum is about all development around libVLC.
fossette
Blank Cone
Blank Cone
Posts: 12
Joined: 06 Apr 2019 16:26
Operating System: FreeBSD
Contact:

LibVLC, X11, Fullscreen and Keyboard Input - A bug, a workaround and a custom player program

Postby fossette » 06 Apr 2019 18:36

First off, let me raise my hat to all the VLC developers out there. :D I always been a fan of VLC since v1.0.0 for WIN32. :lol: Now that I have this idea of a custom app in my mind and kind of know how I can create it, I'm excited to share it with anyone interested when it's ready.

LibVLC Features discussions throughout this forum
I read many times in this forum that if someone uses LibVLC, the best way to get app features is to hook it to a parent X11 window using libvlc_media_player_set_xwindow(). Well, let me kindly disagree with those who think so. There's already a tonne of work invested into LibVLC. Why not use it to the fullest? 8) So, features that would be interesting to have is Get the X11 window ID (if LibVLC created it), take care of the FULLSCREEN feature (I know it's a tough one, but read further down) and provide a callback feature for keyboard entries.

But what about me?
Well, VLC has now become a huge system, and it's very difficult for me to understand how it all works. So many languages/systems/packages. I'm at a complete loss. Let me tell you, VLC developers are saints. I'm currently using VLC 2.2.8 under FreeBSD 11.2. This error is listed in the standard output:

Code: Select all

[000000080b640450] avcodec decoder: Using NVIDIA VDPAU Driver Shared Library 390.87 Tue Aug 21 15:52:44 PDT 2018 for hardware decoding. [0000000821033050] xcb_window window error: bad X11 window 0x03c00001
I believe it occurs while my program does a sleep(1); and the LibVLC thread loads the video. After that, I can pause/play/stop the video, but it runs from LibVLC's own window, not the one I provided using libvlc_media_player_set_xwindow(). Now dear developers, don't waste time on this because it's obviously not your latest VLC version.

My lame attempt at building VLC
I downloaded VLC v3.0.6 and tried to compile it. I got a few puzzling compiling errors, google was my friend. But in the end, it would never run, big system, lots of dependencies and version conflicts in system paths. I don't know how to address those, and don't want to break my system by deleting some files that I'm not supposed to. I'll just work around the issues as they present themselves. And when a newer VLC version is available under FreeBSD, I'll test it again.

FULLSCREEN Tip!!!
I'm using an old X11 window manager, one that doesn't recognise the X11 Window Hints obviously. Step 1 is to search for the X11 window that LibVLC has created in the X11 window tree. Step 2, run these functions:

Code: Select all

XMoveResizeWindow(pX11Display, wVlc, 0, 0, screenwidth, screenheight); XTranslateCoordinates(pX11Display, wVlc, wRoot, 0, 0, &x, &y, &w2); if (x > 0 || y > 0) XMoveWindow(pX11Display, wVlc, -x, -y);
I'll test this later under a Gnome Linux if this still works.

What's next for me?
I need to figure out a way to capture the keyboard entries, and then I'll publish the program on my GitHub account for those interested in a quick shortcut. I'll reply back when it's ready or any questions/comments you may have.
:D
https://github.com/fossette

fossette
Blank Cone
Blank Cone
Posts: 12
Joined: 06 Apr 2019 16:26
Operating System: FreeBSD
Contact:

Re: LibVLC, X11, Fullscreen and Keyboard Input - A bug, a workaround and a custom player program

Postby fossette » 30 May 2019 10:10

fsplayer - X11 Fullscreen Video Player Using LibVLC

The app is ready! :D It's a frontend to LibVLC that plays a video fullscreen under UNIX/LINUX. It's based on X11, so it's not limited to a specific window manager (WM). C Language programmers who want a LibVLC sample program should find fsplayer of use too. Here's the source code:

https://github.com/fossette/fsplayer

A goal I have is to demonstrate that the thread/window automatically created by LibVLC is useful to users, and it would be preferable that its features be maintained/enhanced. First, the window-id of the window created by LibVLC should be made available to the caller. The libvlc_media_player_get_xwindow() function could very well be used if called before its SET function. Regarding libvlc_set_fullscreen(), the fullscreen feature, it's a tricky issue, but not an impossible task. Here's a specific source code that has a broader range among WMs:

https://github.com/fossette/x11fstest

And to prevent odd glitches, it would be preferable to have access to the LibVLC window BEFORE the libvlc_media_player_play() function is called. Finally, it would be more efficient to have access to keyboard input from the LibVLC window itself. In fsplayer's case, as a workaround, another window is created. It tracks the focus of the LibVLC window to gain control of the keyboard input.

Tests

fsplayer runs fine under FreeBSD 11.2 using libvlc 3.0.6, libX11 1.6.7 and qvwm 1.1.12_2015 (an old-school WM).

fsplayer failed under Debian 10 using libvlc 3.0.6, libX11 1.6.7 and Gnome 3.30.2. It seems that the LibVLC window is not created following the libvlc_media_player_play() call. However, I hear the audio track being played. Even more strange, VLC 3.0.6 plays the video just fine. It's as if VLC doesn't call LibVLC. :lol: Unfortunately, I'm not in a position to build the latest LibVLC release to help isolate the problem, so I'll test this again when Debian release a new LibVLC package.
Last edited by fossette on 30 May 2019 10:26, edited 1 time in total.

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: LibVLC, X11, Fullscreen and Keyboard Input - A bug, a workaround and a custom player program

Postby Rémi Denis-Courmont » 30 May 2019 10:24

Before libvlc_media_player_play(), LibVLC does not have a window, so obviously it cannot provide it. Your request is self-contradictory.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

fossette
Blank Cone
Blank Cone
Posts: 12
Joined: 06 Apr 2019 16:26
Operating System: FreeBSD
Contact:

Re: LibVLC, X11, Fullscreen and Keyboard Input - A bug, a workaround and a custom player program

Postby fossette » 30 May 2019 10:29

Before libvlc_media_player_play(), LibVLC does not have a window, so obviously it cannot provide it. Your request is self-contradictory.
What if the LibVLC window could also be created by a call to libvlc_media_player_pause()?

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: LibVLC, X11, Fullscreen and Keyboard Input - A bug, a workaround and a custom player program

Postby Rémi Denis-Courmont » 30 May 2019 13:55

No. We are not going to redesign the whole pipeline just to accomodate your unusual API expectations.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

fossette
Blank Cone
Blank Cone
Posts: 12
Joined: 06 Apr 2019 16:26
Operating System: FreeBSD
Contact:

Re: LibVLC, X11, Fullscreen and Keyboard Input - A bug, a workaround and a custom player program

Postby fossette » 30 May 2019 19:58

No. We are not going to redesign the whole pipeline just to accomodate your unusual API expectations.
No problem! I understand! You guys have plenty on your plates. 8) Someday, I might be in a much better position & skilled enough to contribute to the VLC development. But in the meantime, the only thing I can do is design workarounds for stuff that I want and suggest improvements for those interested.

:D


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 27 guests