[vlc-commits] [Git][videolan/vlc][master] 4 commits: opengl: reorder interop functions

Romain Vimont (@rom1v) gitlab at videolan.org
Sat Aug 28 16:18:01 UTC 2021



Romain Vimont pushed to branch master at VideoLAN / VLC


Commits:
967e96ae by Romain Vimont at 2021-08-28T16:07:02+00:00
opengl: reorder interop functions

This will allow to reference opengl_interop_init_impl without forward
declaration.

- - - - -
010ee857 by Romain Vimont at 2021-08-28T16:07:02+00:00
opengl: make opengl_interop_init_impl static

It is only used from interop.c.

- - - - -
7621d23e by Romain Vimont at 2021-08-28T16:07:02+00:00
opengl: remove useless includes of internal.h

- - - - -
5237d080 by Romain Vimont at 2021-08-28T16:07:02+00:00
opengl: rename internal.h to interop_sw.h

The header internal.h is really a header for interop_sw.c.

- - - - -


9 changed files:

- modules/hw/nvdec/nvdec_gl.c
- modules/video_output/opengl/Makefile.am
- modules/video_output/opengl/interop.c
- modules/video_output/opengl/interop_sw.c
- modules/video_output/opengl/internal.h → modules/video_output/opengl/interop_sw.h
- modules/video_output/opengl/interop_vdpau.c
- modules/video_output/opengl/renderer.c
- modules/video_output/opengl/sampler.c
- modules/video_output/opengl/vout_helper.c


Changes:

=====================================
modules/hw/nvdec/nvdec_gl.c
=====================================
@@ -35,7 +35,6 @@
 
 #include "nvdec_fmt.h"
 
-#include "../../video_output/opengl/internal.h"
 #include "../../video_output/opengl/interop.h"
 
 // glew.h conflicts with glext.h, but also makes glext.h unnecessary.


=====================================
modules/video_output/opengl/Makefile.am
=====================================
@@ -10,9 +10,9 @@ OPENGL_COMMONSOURCES = \
        video_output/opengl/gl_util.c \
        video_output/opengl/gl_util.h \
        video_output/opengl/interop.h \
-       video_output/opengl/internal.h \
        video_output/opengl/interop.c \
        video_output/opengl/interop_sw.c \
+       video_output/opengl/interop_sw.h \
        video_output/opengl/sampler.c \
        video_output/opengl/sampler.h \
        video_output/opengl/sampler_priv.h


=====================================
modules/video_output/opengl/interop.c
=====================================
@@ -25,97 +25,11 @@
 #include <vlc_common.h>
 #include <vlc_modules.h>
 
+#include "gl_api.h"
 #include "interop.h"
-#include "internal.h"
+#include "interop_sw.h"
 #include "vout_helper.h"
 
-struct vlc_gl_interop *
-vlc_gl_interop_New(struct vlc_gl_t *gl, const struct vlc_gl_api *api,
-                   vlc_video_context *context, const video_format_t *fmt)
-{
-    struct vlc_gl_interop *interop = vlc_object_create(gl, sizeof(*interop));
-    if (!interop)
-        return NULL;
-
-    interop->init = opengl_interop_init_impl;
-    interop->ops = NULL;
-    interop->fmt_out = interop->fmt_in = *fmt;
-    /* this is the only allocated field, and we don't need it */
-    interop->fmt_out.p_palette = interop->fmt_in.p_palette = NULL;
-
-    interop->gl = gl;
-    interop->api = api;
-    interop->vt = &api->vt;
-
-    const vlc_chroma_description_t *desc =
-        vlc_fourcc_GetChromaDescription(fmt->i_chroma);
-
-    if (desc == NULL)
-    {
-        vlc_object_delete(interop);
-        return NULL;
-    }
-
-    if (desc->plane_count == 0)
-    {
-        /* Opaque chroma: load a module to handle it */
-        interop->vctx = context;
-        interop->module = module_need_var(interop, "glinterop", "glinterop");
-        if (interop->module == NULL)
-            goto error;
-    }
-    else
-    {
-        /* No opengl interop module found: use a generic interop. */
-        int ret = opengl_interop_generic_init(interop, true);
-        if (ret != VLC_SUCCESS)
-            goto error;
-    }
-
-    return interop;
-
-error:
-    vlc_object_delete(interop);
-    return NULL;
-}
-
-struct vlc_gl_interop *
-vlc_gl_interop_NewForSubpictures(struct vlc_gl_t *gl,
-                                 const struct vlc_gl_api *api)
-{
-    struct vlc_gl_interop *interop = vlc_object_create(gl, sizeof(*interop));
-    if (!interop)
-        return NULL;
-
-    interop->init = opengl_interop_init_impl;
-    interop->ops = NULL;
-    interop->gl = gl;
-    interop->api = api;
-    interop->vt = &api->vt;
-
-    video_format_Init(&interop->fmt_in, VLC_CODEC_RGB32);
-    interop->fmt_out = interop->fmt_in;
-
-    int ret = opengl_interop_generic_init(interop, false);
-    if (ret != VLC_SUCCESS)
-    {
-        vlc_object_delete(interop);
-        return NULL;
-    }
-
-    return interop;
-}
-
-void
-vlc_gl_interop_Delete(struct vlc_gl_interop *interop)
-{
-    if (interop->ops && interop->ops->close)
-        interop->ops->close(interop);
-    if (interop->module)
-        module_unneed(interop, interop->module);
-    vlc_object_delete(interop);
-}
-
 int
 vlc_gl_interop_GenerateTextures(const struct vlc_gl_interop *interop,
                                 const GLsizei *tex_width,
@@ -394,7 +308,7 @@ interop_xyz12_init(struct vlc_gl_interop *interop)
     };
 }
 
-int
+static int
 opengl_interop_init_impl(struct vlc_gl_interop *interop, GLenum tex_target,
                          vlc_fourcc_t chroma, video_color_space_t yuv_space)
 {
@@ -420,3 +334,90 @@ opengl_interop_init_impl(struct vlc_gl_interop *interop, GLenum tex_target,
 
     return interop_rgb_base_init(interop, tex_target, chroma);
 }
+
+struct vlc_gl_interop *
+vlc_gl_interop_New(struct vlc_gl_t *gl, const struct vlc_gl_api *api,
+                   vlc_video_context *context, const video_format_t *fmt)
+{
+    struct vlc_gl_interop *interop = vlc_object_create(gl, sizeof(*interop));
+    if (!interop)
+        return NULL;
+
+    interop->init = opengl_interop_init_impl;
+    interop->ops = NULL;
+    interop->fmt_out = interop->fmt_in = *fmt;
+    /* this is the only allocated field, and we don't need it */
+    interop->fmt_out.p_palette = interop->fmt_in.p_palette = NULL;
+
+    interop->gl = gl;
+    interop->api = api;
+    interop->vt = &api->vt;
+
+    const vlc_chroma_description_t *desc =
+        vlc_fourcc_GetChromaDescription(fmt->i_chroma);
+
+    if (desc == NULL)
+    {
+        vlc_object_delete(interop);
+        return NULL;
+    }
+
+    if (desc->plane_count == 0)
+    {
+        /* Opaque chroma: load a module to handle it */
+        interop->vctx = context;
+        interop->module = module_need_var(interop, "glinterop", "glinterop");
+        if (interop->module == NULL)
+            goto error;
+    }
+    else
+    {
+        /* No opengl interop module found: use a generic interop. */
+        int ret = opengl_interop_generic_init(interop, true);
+        if (ret != VLC_SUCCESS)
+            goto error;
+    }
+
+    return interop;
+
+error:
+    vlc_object_delete(interop);
+    return NULL;
+}
+
+struct vlc_gl_interop *
+vlc_gl_interop_NewForSubpictures(struct vlc_gl_t *gl,
+                                 const struct vlc_gl_api *api)
+{
+    struct vlc_gl_interop *interop = vlc_object_create(gl, sizeof(*interop));
+    if (!interop)
+        return NULL;
+
+    interop->init = opengl_interop_init_impl;
+    interop->ops = NULL;
+    interop->gl = gl;
+    interop->api = api;
+    interop->vt = &api->vt;
+
+    video_format_Init(&interop->fmt_in, VLC_CODEC_RGB32);
+    interop->fmt_out = interop->fmt_in;
+
+    int ret = opengl_interop_generic_init(interop, false);
+    if (ret != VLC_SUCCESS)
+    {
+        vlc_object_delete(interop);
+        return NULL;
+    }
+
+    return interop;
+}
+
+void
+vlc_gl_interop_Delete(struct vlc_gl_interop *interop)
+{
+    if (interop->ops && interop->ops->close)
+        interop->ops->close(interop);
+    if (interop->module)
+        module_unneed(interop, interop->module);
+    vlc_object_delete(interop);
+}


=====================================
modules/video_output/opengl/interop_sw.c
=====================================
@@ -26,9 +26,10 @@
 #include <limits.h>
 #include <stdlib.h>
 
+#include "interop_sw.h"
+
 #include <vlc_common.h>
 #include "gl_api.h"
-#include "internal.h"
 
 #define PBO_DISPLAY_COUNT 2 /* Double buffering */
 typedef struct


=====================================
modules/video_output/opengl/internal.h → modules/video_output/opengl/interop_sw.h
=====================================
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * internal.h: OpenGL internal header
+ * interop_sw.h: OpenGL internal header
  *****************************************************************************
  * Copyright (C) 2017 VLC authors and VideoLAN
  *
@@ -18,15 +18,10 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#ifndef VLC_OPENGL_INTERNAL_H
-#define VLC_OPENGL_INTERNAL_H
+#ifndef VLC_OPENGL_INTEROP_SW_H
+#define VLC_OPENGL_INTEROP_SW_H
 
 #include "interop.h"
-#include "renderer.h"
-
-int
-opengl_interop_init_impl(struct vlc_gl_interop *interop, GLenum tex_target,
-                         vlc_fourcc_t chroma, video_color_space_t yuv_space);
 
 int
 opengl_interop_generic_init(struct vlc_gl_interop *interop, bool);


=====================================
modules/video_output/opengl/interop_vdpau.c
=====================================
@@ -37,7 +37,6 @@
 
 #include "gl_api.h"
 #include "../../hw/vdpau/vlc_vdpau.h"
-#include "internal.h"
 #include "interop.h"
 
 #define INTEROP_CALL(fct, ...) \


=====================================
modules/video_output/opengl/renderer.c
=====================================
@@ -39,7 +39,6 @@
 
 #include "filter.h"
 #include "gl_util.h"
-#include "internal.h"
 #include "vout_helper.h"
 
 #define SPHERE_RADIUS 1.f


=====================================
modules/video_output/opengl/sampler.c
=====================================
@@ -37,7 +37,6 @@
 #include "gl_api.h"
 #include "gl_common.h"
 #include "gl_util.h"
-#include "internal.h"
 #include "interop.h"
 
 struct vlc_gl_sampler_priv {


=====================================
modules/video_output/opengl/vout_helper.c
=====================================
@@ -44,7 +44,6 @@
 #include "gl_api.h"
 #include "gl_util.h"
 #include "vout_helper.h"
-#include "internal.h"
 #include "renderer.h"
 #include "sampler.h"
 #include "sampler_priv.h"



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cc077850b2805c59c06de46c18afabe0afa85ce0...5237d080a4da68f35e010067c682f19c12eb657b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cc077850b2805c59c06de46c18afabe0afa85ce0...5237d080a4da68f35e010067c682f19c12eb657b
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list