[vlc-devel] [PATCH 07/21] libvlc: let the OpenGL host refuse a source format if it can't handle it

Steve Lhomme robux4 at ycbcr.xyz
Wed Feb 5 16:13:15 CET 2020


Changing internal resources may fail and we shouldn't try to render with this
format.
---
 doc/libvlc/QtGL/qtvlcwidget.cpp   | 4 +++-
 doc/libvlc/sdl_opengl_player.cpp  | 4 +++-
 include/vlc/libvlc_media_player.h | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/doc/libvlc/QtGL/qtvlcwidget.cpp b/doc/libvlc/QtGL/qtvlcwidget.cpp
index b1bf535e398..22483efc7c5 100644
--- a/doc/libvlc/QtGL/qtvlcwidget.cpp
+++ b/doc/libvlc/QtGL/qtvlcwidget.cpp
@@ -38,7 +38,7 @@ public:
     }
 
     /// this callback will create the surfaces and FBO used by VLC to perform its rendering
-    static void resizeRenderTextures(void* data, const libvlc_video_render_cfg_t *cfg,
+    static bool resizeRenderTextures(void* data, const libvlc_video_render_cfg_t *cfg,
                                      libvlc_video_output_cfg_t *render_cfg)
     {
        VLCVideo* that = static_cast<VLCVideo*>(data);
@@ -59,6 +59,8 @@ public:
         render_cfg->colorspace = libvlc_video_colorspace_BT709;
         render_cfg->primaries  = libvlc_video_primaries_BT709;
         render_cfg->transfer   = libvlc_video_transfer_func_SRGB;
+
+        return true;
     }
 
     // This callback is called during initialisation.
diff --git a/doc/libvlc/sdl_opengl_player.cpp b/doc/libvlc/sdl_opengl_player.cpp
index 6b25f8d3f29..6e067ccba00 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, const libvlc_video_render_cfg_t *cfg,
+    static bool resize(void* data, const libvlc_video_render_cfg_t *cfg,
                        libvlc_video_output_cfg_t *render_cfg)
     {
         VLCVideo* that = static_cast<VLCVideo*>(data);
@@ -155,6 +155,8 @@ public:
         render_cfg->colorspace = libvlc_video_colorspace_BT709;
         render_cfg->primaries  = libvlc_video_primaries_BT709;
         render_cfg->transfer   = libvlc_video_transfer_func_SRGB;
+
+        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 975779c5ca9..095b562e690 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -553,7 +553,7 @@ typedef struct
  * \param output configuration describing with how the rendering is setup [OUT]
  * \version LibVLC 4.0.0 or later
  */
-typedef void (*libvlc_video_update_output_cb)(void* opaque, const libvlc_video_render_cfg_t *cfg,
+typedef bool (*libvlc_video_update_output_cb)(void* opaque, const libvlc_video_render_cfg_t *cfg,
                                               libvlc_video_output_cfg_t *output );
 
 
-- 
2.17.1



More information about the vlc-devel mailing list