[vlc-devel] [PATCH 1/9] libvlc: add a bool return value to the resize callback

Steve Lhomme robux4 at ycbcr.xyz
Fri Jan 18 14:58:57 CET 2019


For some reason it may be impossible to the host to provide a context with the
given size.

The error is ignored for OpenGL.
---
 doc/libvlc/sdl_opengl_player.cpp  | 5 +++--
 include/vlc/libvlc_media_player.h | 2 +-
 modules/video_output/vgl.c        | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/doc/libvlc/sdl_opengl_player.cpp b/doc/libvlc/sdl_opengl_player.cpp
index d34b99b268..dabc430bdd 100644
--- a/doc/libvlc/sdl_opengl_player.cpp
+++ b/doc/libvlc/sdl_opengl_player.cpp
@@ -116,7 +116,7 @@ public:
     }
 
     /// this callback will create the surfaces and FBO used by VLC to perform its rendering
-    static void resize(void* data, unsigned width, unsigned height)
+    static bool resize(void* data, unsigned width, unsigned height)
     {
         VLCVideo* that = static_cast<VLCVideo*>(data);
         if (width != that->m_width || height != that->m_height)
@@ -141,13 +141,14 @@ public:
         GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
 
         if (status != GL_FRAMEBUFFER_COMPLETE) {
-            return;
+            return false;
         }
 
         that->m_width = width;
         that->m_height = height;
 
         glBindFramebuffer(GL_FRAMEBUFFER, that->m_fbo[that->m_idx_render]);
+        return true;
     }
 
     // This callback is called during initialisation.
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index c85e17eb79..b4a3417883 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -447,7 +447,7 @@ typedef void (*libvlc_video_cleanup_cb)(void* opaque);
  * \param height video height in pixel [IN]
  * \version LibVLC 4.0.0 or later
  */
-typedef void (*libvlc_video_update_output_cb)(void* opaque, unsigned width, unsigned height);
+typedef bool (*libvlc_video_update_output_cb)(void* opaque, unsigned width, unsigned height);
 
 
 /**
diff --git a/modules/video_output/vgl.c b/modules/video_output/vgl.c
index 3617a096a0..7079985d2a 100644
--- a/modules/video_output/vgl.c
+++ b/modules/video_output/vgl.c
@@ -33,7 +33,7 @@ struct vout_display_sys_t
 {
     void (*cleanupCb)(void* opaque);
     bool (*setupCb)(void* opaque);
-    void (*resizeCb)(void* opaque, unsigned, unsigned);
+    bool (*resizeCb)(void* opaque, unsigned, unsigned);
     void (*swapCb)(void* opaque);
     bool (*makeCurrentCb)(void* opaque, bool);
     void* (*getProcAddressCb)(void* opaque, const char *name);
-- 
2.17.1



More information about the vlc-devel mailing list