[vlc-devel] [PATCH 10/18] libvlc: let the OpenGL host app change the opaque data used for the session
Steve Lhomme
robux4 at ycbcr.xyz
Tue Feb 4 16:26:05 CET 2020
The host may only allocate the opaque structure when a session happens.
---
doc/libvlc/QtGL/qtvlcwidget.cpp | 8 ++++----
doc/libvlc/sdl_opengl_player.cpp | 8 ++++----
include/vlc/libvlc_media_player.h | 6 ++++--
modules/video_output/vgl.c | 2 +-
4 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/doc/libvlc/QtGL/qtvlcwidget.cpp b/doc/libvlc/QtGL/qtvlcwidget.cpp
index 108d0f7a5d7..8c8cd1224e7 100644
--- a/doc/libvlc/QtGL/qtvlcwidget.cpp
+++ b/doc/libvlc/QtGL/qtvlcwidget.cpp
@@ -64,14 +64,14 @@ public:
}
// This callback is called during initialisation.
- static bool setup(void* data)
+ static bool setup(void** data)
{
if (!QOpenGLContext::supportsThreadedOpenGL())
return false;
- VLCVideo* that = static_cast<VLCVideo*>(data);
- that->m_width = 0;
- that->m_height = 0;
+ VLCVideo** that = static_cast<VLCVideo**>(data);
+ (*that)->m_width = 0;
+ (*that)->m_height = 0;
return true;
}
diff --git a/doc/libvlc/sdl_opengl_player.cpp b/doc/libvlc/sdl_opengl_player.cpp
index 5b4577baa58..c5558b7cd65 100644
--- a/doc/libvlc/sdl_opengl_player.cpp
+++ b/doc/libvlc/sdl_opengl_player.cpp
@@ -160,11 +160,11 @@ public:
}
// This callback is called during initialisation.
- static bool setup(void* data)
+ static bool setup(void** data)
{
- VLCVideo* that = static_cast<VLCVideo*>(data);
- that->m_width = 0;
- that->m_height = 0;
+ VLCVideo** that = static_cast<VLCVideo**>(data);
+ (*that)->m_width = 0;
+ (*that)->m_height = 0;
return true;
}
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index a327d0cd503..99530383832 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -506,11 +506,13 @@ void libvlc_video_set_format_callbacks( libvlc_media_player_t *mp,
/**
* Callback prototype called to initialize user data.
*
- * \param opaque private pointer passed to the @a libvlc_video_set_output_callbacks() [IN]
+ * \param opaque private pointer passed to the @a libvlc_video_set_output_callbacks()
+ * on input. The callback can change this value on output to be
+ * passed to all the other callbacks set on @a libvlc_video_set_output_callbacks(). [IN/OUT]
* \return true on success
* \version LibVLC 4.0.0 or later
*/
-typedef bool (*libvlc_video_setup_cb)(void* opaque);
+typedef bool (*libvlc_video_setup_cb)(void** opaque);
/**
diff --git a/modules/video_output/vgl.c b/modules/video_output/vgl.c
index ee00b1f859f..e2f3c23414e 100644
--- a/modules/video_output/vgl.c
+++ b/modules/video_output/vgl.c
@@ -141,7 +141,7 @@ static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
gl->destroy = Close;
if( sys->setupCb )
- if( !sys->setupCb(sys->opaque) )
+ if( !sys->setupCb(&sys->opaque) )
{
msg_Err( gl, "user setup failed" );
return VLC_EGENERIC;
--
2.17.1
More information about the vlc-devel
mailing list