Page 1 of 1

LibVLC Sample Code - SDL1.2 works, SDL2 doesn't (Video example included)

Posted: 19 Feb 2019 00:35
by Domarius
I'm trying to get the SDL2 sample code to work. I can get audio, but the window renders blank. But the SDL 1.2 sample works fine. Here's what I've discovered so far
  • I am using the SDL 2.0 version linked here, the one halfway down the page
  • I changed the 2 #include "SDL/..." entries to be #include "SDL2/..." otherwise it would not compile - which I find strange, shouldn't the SDL2 example refer to SDL2 already?
  • I commented out "--no-audio" so that I could get sound
  • As a test, I tried the SDL1.2 sample, and got it to work (after using the -fpermissive compiler flag) and I get a window with a video moving in a circle, and a black square on top, so everything works fine in that version.
So this seems to be something with SDL2 not rendering the view properly in the SDL2 sample. I had to change the #include, which seems suspicious, could it have something to do with that?

Here is a 2 minute video showing the issue clearly: https://youtu.be/sn14v-4qrrE (Might want to enable 1080p to see the text clearly)

Re: LibVLC Sample Code - SDL1.2 works, SDL2 doesn't (Video example included)

Posted: 19 Feb 2019 10:03
by chubinou
Hi,

I tried to compile the SDL2 example, I just had to change the include header as you did (s/SDL/SDL2/) and things worked as expected. something must be wrong with your environment.

I compile with the following command line

Code: Select all

g++ test.c $(pkg-config --cflags --libs libvlc sdl2)

Re: LibVLC Sample Code - SDL1.2 works, SDL2 doesn't (Video example included)

Posted: 20 Feb 2019 18:14
by Domarius
Ok thank you. I'll do some more research. I compiled with that command line, and got the same result. I re-installed SDL2 for the umpteenth time with "sudo apt-get install libsdl2-dev" and it always finishes with "0 to upgrade, 0 to newly install, 0 to remove and 155 not to upgrade." I'll try posting this on Unix Stack Exchange or something. Thanks again.