libvlc: return false if setting the vout callback fails

The engine provide may have a wrong value or may not be supported on the
given platform/build.
This commit is contained in:
Steve Lhomme 2018-11-20 11:18:25 +01:00
parent 4ae7000264
commit 1b3be396a3
2 changed files with 7 additions and 3 deletions

View File

@ -504,10 +504,11 @@ typedef enum libvlc_video_engine_t {
* \param makeCurrent_cb callback called to enter/leave the opengl context (cannot be NULL)
* \param getProcAddress_cb opengl function loading callback (cannot be NULL)
* \param opaque private pointer passed to callbacks
* \libvlc_return_bool
* \version LibVLC 4.0.0 or later
*/
LIBVLC_API
void libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
int libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
libvlc_video_engine_t engine,
libvlc_video_setup_cb setup_cb,
libvlc_video_cleanup_cb cleanup_cb,

View File

@ -1160,7 +1160,7 @@ void libvlc_video_set_format( libvlc_media_player_t *mp, const char *chroma,
var_SetInteger( mp, "vmem-pitch", pitch );
}
void libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
int libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
libvlc_video_engine_t engine,
libvlc_video_setup_cb setup_cb,
libvlc_video_cleanup_cb cleanup_cb,
@ -1182,11 +1182,13 @@ void libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
var_SetString ( mp, "vout", "gles2" );
var_SetString ( mp, "gles2", "vgl" );
}
else
else if( engine == libvlc_video_engine_opengl )
{
var_SetString ( mp, "vout", "gl" );
var_SetString ( mp, "gl", "vgl");
}
else
return 0;
var_SetAddress( mp, "vout-cb-opaque", opaque );
var_SetAddress( mp, "vout-cb-setup", setup_cb );
@ -1195,6 +1197,7 @@ void libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
var_SetAddress( mp, "vout-cb-swap", swap_cb );
var_SetAddress( mp, "vout-cb-get-proc-address", getProcAddress_cb );
var_SetAddress( mp, "vout-cb-make-current", makeCurrent_cb );
return 1;
}