1
mirror of https://code.videolan.org/videolan/vlc synced 2024-09-24 20:48:52 +02:00

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.
This commit is contained in:
Steve Lhomme 2020-02-04 15:31:42 +01:00
parent 4fb49a07d0
commit 7aafa1e914
4 changed files with 7 additions and 3 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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,

View File

@ -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 );