[vlc-devel] [PATCH] opengl: use union for on- and off-screen fields

Romain Vimont rom1v at videolabs.io
Tue Mar 2 07:15:16 UTC 2021


---
 include/vlc_opengl.h | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/include/vlc_opengl.h b/include/vlc_opengl.h
index f91f387bf7..6736940623 100644
--- a/include/vlc_opengl.h
+++ b/include/vlc_opengl.h
@@ -49,24 +49,30 @@ struct vlc_gl_t
 {
     struct vlc_object_t obj;
 
-    struct vlc_decoder_device *device;
-    struct vout_window_t *surface;
     module_t *module;
     void *sys;
 
-    vlc_fourcc_t offscreen_chroma_out;
-    struct vlc_video_context *offscreen_vctx_out;
-    /* Flag to indicate if the OpenGL implementation produces upside-down
-     * pictures */
-    bool offscreen_vflip;
+    union {
+        struct { /* on-screen */
+            struct vout_window_t *surface;
+
+            void (*swap)(vlc_gl_t *);
+        };
+        struct { /* off-screen */
+            struct vlc_decoder_device *device;
+            vlc_fourcc_t offscreen_chroma_out;
+            struct vlc_video_context *offscreen_vctx_out;
+            /* Flag to indicate if the OpenGL implementation produces upside-down
+             * pictures */
+            bool offscreen_vflip;
+
+            picture_t *(*swap_offscreen)(vlc_gl_t *);
+        };
+    };
 
     int  (*make_current)(vlc_gl_t *);
     void (*release_current)(vlc_gl_t *);
     void (*resize)(vlc_gl_t *, unsigned, unsigned);
-    union {
-        void (*swap)(vlc_gl_t *);
-        picture_t *(*swap_offscreen)(vlc_gl_t *);
-    };
     void*(*get_proc_address)(vlc_gl_t *, const char *);
     void (*destroy)(vlc_gl_t *);
 
-- 
2.30.1



More information about the vlc-devel mailing list