VLC 4.0 OpenGL shared context

This forum is about all development around libVLC.
neosettler
Cone that earned his stripes
Cone that earned his stripes
Posts: 107
Joined: 18 Dec 2012 17:44

VLC 4.0 OpenGL shared context

Postby neosettler » 26 Oct 2019 20:41

Greetings,

I'm in the midst of rendering directly to an OpenGL texture buffer using libvlc_video_set_output_callbacks (VLC 4.0 beta) implementation. The way my API is setup, I use QT for GUI while VLC is implemented in an external dynamic library (dll). Since the main OpenGL context is create by QT and that VLC is unawarded of QT, I'm unable to switch context (within VLC callbacks) as QT and VLC contexts are on different threads. I'm clearly facing a design problem but I'm not sure how to solve this. I'm open to suggestion or maybe some example to chew on would be nice.

Thank you,

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: VLC 4.0 OpenGL shared context

Postby mfkl » 28 Oct 2019 04:11

https://github.com/videolan/vlc/blob/master/doc/libvlc/sdl_opengl_player.cpp
https://mfkl.github.io

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

Re: VLC 4.0 OpenGL shared context

Postby chubinou » 28 Oct 2019 14:11

Hi,

rather this sample https://code.videolan.org/videolan/vlc/tree/master/doc/libvlc/QtGL
which shows how to use libvlc_video_set_output_callbacks with Qt.

unidan
Developer
Developer
Posts: 1493
Joined: 25 Mar 2018 01:00

Re: VLC 4.0 OpenGL shared context

Postby unidan » 28 Oct 2019 17:20

Basically, libVLC is a multimedia pipeline that doesn't get synchronization input from your app (because you shouldn't have to handle that). But your app is probably not synchronized by VLC pipeline. So you have to do the synchronization between both of them yourself like in the QtGL example. As your application might be rendering frame at a different speed than VLC, you need triple buffering to achieve clock syncing without glitches between the two clock domains.
The other solution is to slave your application into VLC's pipeline, thus enforce the framerate of your application, but without filtering in VLC it might be different than 60 fps for example so I would advise against for now.

onelistme
New Cone
New Cone
Posts: 8
Joined: 26 Dec 2020 14:07

Re: VLC 4.0 OpenGL shared context

Postby onelistme » 27 Dec 2020 05:35

I try this example, however it not works well as expect. Here is more informaiotn https://forum.videolan.org/viewtopic.php?f=14&t=155928
Is there more inforamation about this example.

unidan
Developer
Developer
Posts: 1493
Joined: 25 Mar 2018 01:00

Re: VLC 4.0 OpenGL shared context

Postby unidan » 03 Feb 2021 09:01

Hi, I'll suggest that we move to the other topic you opened then. ;)


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 13 guests