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

Romain Vimont git at videolan.org
Mon Mar 22 14:54:33 UTC 2021


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Tue Mar  2 09:22:24 2021 +0100| [23f392cb9f657e466b1860f4cfc15c4b294d0f7f] | committer: Alexandre Janniaux

opengl: use union for on- and off-screen fields

Signed-off-by: Alexandre Janniaux <ajanni at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=23f392cb9f657e466b1860f4cfc15c4b294d0f7f
---

 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..7c86a63d9b 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 */
+            void (*swap)(vlc_gl_t *);
+
+            struct vout_window_t *surface;
+        };
+        struct { /* off-screen */
+            picture_t *(*swap_offscreen)(vlc_gl_t *);
+
+            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;
+        };
+    };
 
     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 *);
 



More information about the vlc-commits mailing list