[vlc-commits] libvlc: return false if setting the vout callback fails
Steve Lhomme
git at videolan.org
Fri Jan 18 11:10:47 CET 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Nov 20 11:18:25 2018 +0100| [1b3be396a304d55469a92b76bc9154981ebb87ff] | committer: Steve Lhomme
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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1b3be396a304d55469a92b76bc9154981ebb87ff
---
include/vlc/libvlc_media_player.h | 3 ++-
lib/media_player.c | 7 +++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 8fa3abda6f..c85e17eb79 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -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,
diff --git a/lib/media_player.c b/lib/media_player.c
index 89ba10d638..4079efd4b0 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -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;
}
More information about the vlc-commits
mailing list