opengl: expose GenTextures() and DelTextures()
authorRomain Vimont <rom1v@videolabs.io>
Tue, 21 Jan 2020 12:47:57 +0000 (13:47 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 13 Feb 2020 22:11:21 +0000 (23:11 +0100)
These util functions will be called from other files.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/video_output/opengl/interop.h
modules/video_output/opengl/vout_helper.c

index aea0d8e..ab054ee 100644 (file)
@@ -164,6 +164,15 @@ vlc_gl_interop_New(struct vlc_gl_t *gl, const opengl_vtable_t *vt,
 void
 vlc_gl_interop_Delete(struct vlc_gl_interop *interop);
 
+int
+vlc_gl_interop_GenerateTextures(const struct vlc_gl_interop *interop,
+                                const GLsizei *tex_width,
+                                const GLsizei *tex_height, GLuint *textures);
+
+void
+vlc_gl_interop_DeleteTextures(const struct vlc_gl_interop *interop,
+                              GLuint *textures);
+
 static inline int
 opengl_interop_init(struct vlc_gl_interop *interop, GLenum tex_target,
                     vlc_fourcc_t chroma, video_color_space_t yuv_space)
index 8a461a3..39b8edb 100644 (file)
@@ -311,10 +311,10 @@ static GLuint BuildVertexShader(const opengl_tex_converter_t *tc,
     return shader;
 }
 
-static int
-GenTextures(const struct vlc_gl_interop *interop,
-            const GLsizei *tex_width, const GLsizei *tex_height,
-            GLuint *textures)
+int
+vlc_gl_interop_GenerateTextures(const struct vlc_gl_interop *interop,
+                                const GLsizei *tex_width,
+                                const GLsizei *tex_height, GLuint *textures)
 {
     interop->vt->GenTextures(interop->tex_count, textures);
 
@@ -347,8 +347,9 @@ GenTextures(const struct vlc_gl_interop *interop,
     return VLC_SUCCESS;
 }
 
-static void
-DelTextures(const struct vlc_gl_interop *interop, GLuint *textures)
+void
+vlc_gl_interop_DeleteTextures(const struct vlc_gl_interop *interop,
+                              GLuint *textures)
 {
     interop->vt->DeleteTextures(interop->tex_count, textures);
     memset(textures, 0, interop->tex_count * sizeof(GLuint));
@@ -790,8 +791,9 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
 
     if (!interop->handle_texs_gen)
     {
-        ret = GenTextures(vgl->prgm->tc->interop, vgl->tex_width, vgl->tex_height,
-                          vgl->texture);
+        ret = vlc_gl_interop_GenerateTextures(vgl->prgm->tc->interop,
+                                              vgl->tex_width, vgl->tex_height,
+                                              vgl->texture);
         if (ret != VLC_SUCCESS)
         {
             vout_display_opengl_Delete(vgl);
@@ -1013,7 +1015,9 @@ vout_display_opengl_PrepareSubPicture(vout_display_opengl_t *vgl,
             if (!glr->texture)
             {
                 /* Could not recycle a previous texture, generate a new one. */
-                int ret = GenTextures(interop, &glr->width, &glr->height, &glr->texture);
+                int ret = vlc_gl_interop_GenerateTextures(interop, &glr->width,
+                                                          &glr->height,
+                                                          &glr->texture);
                 if (ret != VLC_SUCCESS)
                     break;
             }
@@ -1035,7 +1039,7 @@ vout_display_opengl_PrepareSubPicture(vout_display_opengl_t *vgl,
 
     for (int i = 0; i < last_count; i++) {
         if (last[i].texture)
-            DelTextures(interop, &last[i].texture);
+            vlc_gl_interop_DeleteTextures(interop, &last[i].texture);
     }
     free(last);