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

Rémi Denis-Courmont remi at remlab.net
Tue Mar 2 07:53:57 UTC 2021


Hi,

Keeping same offset for the swap callbacks would make devugging a little less confusing, probably.

Le 2 mars 2021 09:15:16 GMT+02:00, Romain Vimont <rom1v at videolabs.io> a écrit :
>---
> 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
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20210302/9168e4df/attachment.html>


More information about the vlc-devel mailing list