liVLC4 / OpenGL callbacks

This forum is about all development around libVLC.
FL53
Blank Cone
Blank Cone
Posts: 39
Joined: 09 Mar 2018 17:58

liVLC4 / OpenGL callbacks

Postby FL53 » 23 Nov 2022 12:45

Hi,

I updated my software using the last build of VLC (using the openGL callback with libVLC 4). When I try to load a video here is the returned log ( click me !), can someone help me to solve this issue ?
Regards,

chubinou
Developer
Developer
Posts: 521
Joined: 23 Jul 2015 15:19

Re: liVLC4 / OpenGL callbacks

Postby chubinou » 23 Nov 2022 14:11

can you post your code related to the usage of the OpenGL callback?

FL53
Blank Cone
Blank Cone
Posts: 39
Joined: 09 Mar 2018 17:58

Re: liVLC4 / OpenGL callbacks

Postby FL53 » 24 Nov 2022 23:32

Not really, it is integrated in a software which is not so simple to reduce in size. But ... VLC code is purely the gl callback sample in the SDK. I created a project in VS2019 with the sample of VLC : download me ;). The app is crashing as soon as media is asked to be played (media loading is OK)

Tell me if I'm wrong but the only ressources needed near to the EXE in Windows are libvlc.dll/libvlccore.dll/axvlc.dll and [hrtfs] [plugins] directories ? locale is for language and skins for player UI style (both should not be needed needed when using libVLC without the VLC UI). About [lua] and [NSIS] directories .. I don't know :)
I did copies of DLL / directories needed in post build events to make it easier to recompile & test : 2 file to test testDbg which is trying to open the file with program compiled in debug mode, test.bat to test the release version.

I hope you can help me.
Regards

chubinou
Developer
Developer
Posts: 521
Joined: 23 Jul 2015 15:19

Re: liVLC4 / OpenGL callbacks

Postby chubinou » 28 Nov 2022 14:01

the needed resources are

* libvlc.dll
* libvlccore.dll
* plugins (some may be removed to match your requirements, for instance you probably don't need the qt interface)

you don't need theses
* axvlc.dll -> activeX plugin
* hrtfs -> this is used by the binaural specialization plugin (it's unlikely you need it)
* lua -> this provides some access plugins, mainly things related to internet services (youtube for instace)

> libvlc_video_set_output_callbacks(m_mp, libvlc_video_engine_opengl

are you using opengl or opengles ?

some people are reporting issues with the SDL sample on windows (maybe some things are not initialized properly on SDL side), can you try the QtGL sample to see if you have the same issue.

FL53
Blank Cone
Blank Cone
Posts: 39
Joined: 09 Mar 2018 17:58

Re: liVLC4 / OpenGL callbacks

Postby FL53 » 29 Nov 2022 11:55

Thanks. I will clean my project so.
I use OpenGL ( libvlc_video_engine_opengl ) and I won't have time to try QtGL sample :'( ... GL callbacks changed since last time I used to develop with them : I may try an older release of the VLC4.0.0 SDK and give you a feedback on this.

BTW I get the assertion "Assertion failed: !"GL_INVALID_ENUM", file /builds/videolan/vlc/extras/package/win32/../../../modules/video_output/opengl/vout_helper.c, line 150" if I try to loadMedia using "path" or "url" and then try to play.

FL53
Blank Cone
Blank Cone
Posts: 39
Joined: 09 Mar 2018 17:58

Re: liVLC4 / OpenGL callbacks

Postby FL53 » 30 Nov 2022 09:55

I made some other tests ... it seems the shared context is not working in the sample (I already had issues first time I used gl callback it with SDL2 / Windows ).
In resize method the textures & FBO are not created !
Any clues about the way to fix this ?
I am really annoyed since all my SDL2 app is already developed and only VLC video player in app is not working :'(

[EDIT] This message was sent when testing with previous VLC release (and previous SDL2 release too). GL context is well shared since I can see now the textures & FBO IDs in VLC class. It is more an issue while trying to play . I think I have got it ! I post a new message and it may be useful to update the sample in the repo ;)

FL53
Blank Cone
Blank Cone
Posts: 39
Joined: 09 Mar 2018 17:58

Re: liVLC4 / OpenGL callbacks

Postby FL53 » 30 Nov 2022 14:22

SOLUTION FOUND !

So ... looking at the sample I could find these points :

- no SDL_init was called at start (we may call SDL_Init(SDL_INIT_VIDEO); at start )
- another SDL_GL_SetAttribute must be called : SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
- after creating the VLC instance in main we must call : SDL_GL_MakeCurrent(wnd, glc);

and that's it !

I hope it can help others ...

FL53
Blank Cone
Blank Cone
Posts: 39
Joined: 09 Mar 2018 17:58

Re: liVLC4 / OpenGL callbacks

Postby FL53 » 01 Dec 2022 15:49

Another issue with GL callbacks :) ... If I set the VLC instance using a huge windows (let's say 2x4K window extended on 2 screens) some crashes occur. Only solution found is to create a little window (1x1 resolution :) ) to instanciate VLC.
Is there another way to do it a cleaner way so the app is using only 1 window ?

chubinou
Developer
Developer
Posts: 521
Joined: 23 Jul 2015 15:19

Re: liVLC4 / OpenGL callbacks

Postby chubinou » 01 Dec 2022 17:12

- no SDL_init was called at start (we may call SDL_Init(SDL_INIT_VIDEO); at start )
- another SDL_GL_SetAttribute must be called : SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
- after creating the VLC instance in main we must call : SDL_GL_MakeCurrent(wnd, glc);
thanks for taking the time to investigate the issue, I'll update the sample accordingly

> If I set the VLC instance using a huge windows (let's say 2x4K window extended on 2 screens) some crashes occur. Only solution found is to create a little window (1x1 resolution :) ) to instanciate VLC.

hum strange, does it also happens in VLC if you set the video output to OpenGL ? (preference > video > output)

FL53
Blank Cone
Blank Cone
Posts: 39
Joined: 09 Mar 2018 17:58

Re: liVLC4 / OpenGL callbacks

Postby FL53 » 02 Dec 2022 12:09

I will try that but it may be difficult to reproduce with VLC since it is when I release & load media player when changing the media played in OpenGL ... BTW changing the media (releasing media player & media / creating a media player setting it a new media) is generating execption on libwaveout_plugin. I don't know if this is something related to gl callbacks (I don't think so) so I will open a new thread for that.

FL53
Blank Cone
Blank Cone
Posts: 39
Joined: 09 Mar 2018 17:58

Re: liVLC4 / OpenGL callbacks

Postby FL53 » 05 Dec 2022 09:43

I tried using VLC directly modifying the preferences but .. VLC is resizing the window to only 1 display before loading I think :) so I cannot try loading a media when VLC window is extended to both screens. I will try to update quickly the visual studio sample I did to mimic the issue (for VGL output & libwaveoutput_plugin).

chubinou
Developer
Developer
Posts: 521
Joined: 23 Jul 2015 15:19

Re: liVLC4 / OpenGL callbacks

Postby chubinou » 05 Dec 2022 10:31

> I don't know if this is something related to gl callbacks

That's unlikely, waveout is an audio output. Note that you probably don't actually use this module (people event wanted to remove it recently ), though a stacktrack (if you have it) would be welcomed.

> VLC is resizing the window to only 1 display before loading I think

maybe you still have the "resize interface to video size" checked. If you don't "integrate video in interface" it will destroy and recreate the window between each videos.

you may try to start VLC like this:

./vlc.exe --width 7680 --height 2160 -I dummy -V gl whatever.mp4

for me it, it didn't yield an interesting result as the window created was limited by my screen resolution, I don't know if that's a limitation from windows or if that's something in our code, I didn't find anything obvious in our code

> I will try to update quickly the visual studio sample I did to mimic the issue

thanks

FL53
Blank Cone
Blank Cone
Posts: 39
Joined: 09 Mar 2018 17:58

Re: liVLC4 / OpenGL callbacks

Postby FL53 » 05 Dec 2022 18:50

trying the command line, when killing VLC I get an assertion
Assertion Failed !

Program: ...
File: /builds/videolan/vlc/extras/package/win32/..../wgl.c
Line: 286

Expression: winDC != NULL

And same with 640x480 resolution !
BTW : I'm using vlc.exe in the dev SDK directory


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 10 guests