[vlc-commits] libvlc: let the OpenGL host app tell libvlc its rendering area changed
Steve Lhomme
git at videolan.org
Mon Feb 10 09:07:08 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Feb 4 15:31:42 2020 +0100| [7aafa1e9144b0ae152c899f678dd993953b16ff0] | committer: Steve Lhomme
libvlc: let the OpenGL host app tell libvlc its rendering area changed
VLC adjusts the text rendering based on the rendering area size, so we should
be able to adapt to changes in the host app.
This is using the wextern dummy window, like it's done with D3D callbacks. The
callback is given to the host app when the window is enabled and reset when the
window is disabled.
Not sure how it's supposed to be done with Android but given it uses a
regular window, it probably reports size changes already.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7aafa1e9144b0ae152c899f678dd993953b16ff0
---
doc/libvlc/QtGL/qtvlcwidget.cpp | 2 +-
doc/libvlc/sdl_opengl_player.cpp | 2 +-
include/vlc/libvlc_media_player.h | 2 ++
lib/media_player.c | 4 +++-
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/doc/libvlc/QtGL/qtvlcwidget.cpp b/doc/libvlc/QtGL/qtvlcwidget.cpp
index 276f1fcdc0..db48bb571e 100644
--- a/doc/libvlc/QtGL/qtvlcwidget.cpp
+++ b/doc/libvlc/QtGL/qtvlcwidget.cpp
@@ -171,7 +171,7 @@ bool QtVLCWidget::playMedia(const char* url)
// Define the opengl rendering callbacks
libvlc_video_set_output_callbacks(m_mp, libvlc_video_engine_opengl,
- VLCVideo::setup, VLCVideo::cleanup, VLCVideo::resizeRenderTextures, VLCVideo::swap,
+ VLCVideo::setup, VLCVideo::cleanup, nullptr, VLCVideo::resizeRenderTextures, VLCVideo::swap,
VLCVideo::make_current, VLCVideo::get_proc_address,
mVLC);
diff --git a/doc/libvlc/sdl_opengl_player.cpp b/doc/libvlc/sdl_opengl_player.cpp
index 3378091152..f40fca99e2 100644
--- a/doc/libvlc/sdl_opengl_player.cpp
+++ b/doc/libvlc/sdl_opengl_player.cpp
@@ -80,7 +80,7 @@ public:
}
// Define the opengl rendering callbacks
libvlc_video_set_output_callbacks(m_mp, libvlc_video_engine_opengl,
- setup, cleanup, resize, swap,
+ setup, cleanup, nullptr, resize, swap,
make_current, get_proc_address,
this);
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 0dd8877d9a..1c990d2bb3 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -705,6 +705,7 @@ typedef void( *libvlc_video_output_set_resize_cb )( void *opaque,
* \param engine the GPU engine to use
* \param setup_cb callback called to initialize user data
* \param cleanup_cb callback called to clean up user data
+ * \param resize_cb callback to set the resize callback
* \param update_output_cb callback to get the rendering format of the host (cannot be NULL)
* \param swap_cb callback called after rendering a video frame (cannot be NULL)
* \param makeCurrent_cb callback called to enter/leave the opengl context (cannot be NULL for \ref libvlc_video_engine_opengl and for \ref libvlc_video_engine_gles2)
@@ -720,6 +721,7 @@ bool libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
libvlc_video_engine_t engine,
libvlc_video_output_setup_cb setup_cb,
libvlc_video_output_cleanup_cb cleanup_cb,
+ libvlc_video_output_set_resize_cb resize_cb,
libvlc_video_update_output_cb update_output_cb,
libvlc_video_swap_cb swap_cb,
libvlc_video_makeCurrent_cb makeCurrent_cb,
diff --git a/lib/media_player.c b/lib/media_player.c
index 6d621a100d..f487907740 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -1036,6 +1036,7 @@ bool libvlc_video_set_output_callbacks(libvlc_media_player_t *mp,
libvlc_video_engine_t engine,
libvlc_video_output_setup_cb setup_cb,
libvlc_video_output_cleanup_cb cleanup_cb,
+ libvlc_video_output_set_resize_cb resize_cb,
libvlc_video_update_output_cb update_output_cb,
libvlc_video_swap_cb swap_cb,
libvlc_video_makeCurrent_cb makeCurrent_cb,
@@ -1046,7 +1047,7 @@ bool libvlc_video_set_output_callbacks(libvlc_media_player_t *mp,
//use the default android window
var_SetString( mp, "window", "");
#else
- var_SetString( mp, "window", "wdummy");
+ var_SetString( mp, "window", "wextern");
#endif
if( engine == libvlc_video_engine_gles2 )
@@ -1065,6 +1066,7 @@ bool libvlc_video_set_output_callbacks(libvlc_media_player_t *mp,
var_SetAddress( mp, "vout-cb-opaque", opaque );
var_SetAddress( mp, "vout-cb-setup", setup_cb );
var_SetAddress( mp, "vout-cb-cleanup", cleanup_cb );
+ var_SetAddress( mp, "vout-cb-resize-cb", resize_cb );
var_SetAddress( mp, "vout-cb-update-output", update_output_cb );
var_SetAddress( mp, "vout-cb-swap", swap_cb );
var_SetAddress( mp, "vout-cb-get-proc-address", getProcAddress_cb );
More information about the vlc-commits
mailing list