[vlc-commits] opengl: converter: merge rgba and yuv init functions

Thomas Guillem git at videolan.org
Thu Feb 2 09:52:49 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb  1 16:21:13 2017 +0100| [3306c8c43b8bc8b15a8b15d63423b7efd5ad7fe9] | committer: Thomas Guillem

opengl: converter: merge rgba and yuv init functions

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

 modules/video_output/opengl/converters.c  | 31 +++++++++----------------------
 modules/video_output/opengl/internal.h    |  8 +++-----
 modules/video_output/opengl/vout_helper.c |  5 ++---
 3 files changed, 14 insertions(+), 30 deletions(-)

diff --git a/modules/video_output/opengl/converters.c b/modules/video_output/opengl/converters.c
index f424453..6ad3661 100644
--- a/modules/video_output/opengl/converters.c
+++ b/modules/video_output/opengl/converters.c
@@ -771,27 +771,8 @@ common_init(opengl_tex_converter_t *tc)
 }
 
 GLuint
-opengl_tex_converter_rgba_init(const video_format_t *fmt,
-                               opengl_tex_converter_t *tc)
-{
-    GLuint fragment_shader =
-        opengl_fragment_shader_init(tc, GL_TEXTURE_2D, fmt->i_chroma,
-                                   COLOR_SPACE_UNDEF);
-    if (fragment_shader == 0)
-        return 0;
-
-    if (common_init(tc) != VLC_SUCCESS)
-    {
-        tc->api->DeleteShader(fragment_shader);
-        return 0;
-    }
-
-    return fragment_shader;
-}
-
-GLuint
-opengl_tex_converter_yuv_init(const video_format_t *fmt,
-                              opengl_tex_converter_t *tc)
+opengl_tex_converter_generic_init(const video_format_t *fmt,
+                                  opengl_tex_converter_t *tc)
 {
     GLuint fragment_shader = 0;
     if (vlc_fourcc_IsYUV(fmt->i_chroma))
@@ -813,7 +794,13 @@ opengl_tex_converter_yuv_init(const video_format_t *fmt,
             return 0;
     }
     else
-        return 0;
+    {
+        fragment_shader =
+            opengl_fragment_shader_init(tc, GL_TEXTURE_2D, fmt->i_chroma,
+                                       COLOR_SPACE_UNDEF);
+        if (fragment_shader == 0)
+            return 0;
+    }
 
     if (common_init(tc) != VLC_SUCCESS)
     {
diff --git a/modules/video_output/opengl/internal.h b/modules/video_output/opengl/internal.h
index 237322a..ef56324 100644
--- a/modules/video_output/opengl/internal.h
+++ b/modules/video_output/opengl/internal.h
@@ -306,11 +306,9 @@ opengl_fragment_shader_init(opengl_tex_converter_t *tc, GLenum tex_target,
                             vlc_fourcc_t chroma, video_color_space_t yuv_space);
 
 extern GLuint
-opengl_tex_converter_rgba_init(const video_format_t *,
-                               opengl_tex_converter_t *);
-extern GLuint
-opengl_tex_converter_yuv_init(const video_format_t *,
-                              opengl_tex_converter_t *);
+opengl_tex_converter_generic_init(const video_format_t *,
+                                  opengl_tex_converter_t *);
+
 extern GLuint
 opengl_tex_converter_xyz12_init(const video_format_t *,
                                 opengl_tex_converter_t *);
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index 65c8054..e3b3ae5 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -50,9 +50,8 @@
 
 static opengl_tex_converter_init_cb opengl_tex_converter_init_cbs[] =
 {
-    opengl_tex_converter_yuv_init,
+    opengl_tex_converter_generic_init,
     opengl_tex_converter_xyz12_init,
-    opengl_tex_converter_rgba_init,
 #ifdef __ANDROID__
     opengl_tex_converter_anop_init,
 #endif
@@ -555,7 +554,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     };
 
     /* RGBA is needed for subpictures or for non YUV pictures */
-    sub_fragment_shader = opengl_tex_converter_rgba_init(&vgl->fmt, &sub_tex_conv);
+    sub_fragment_shader = opengl_tex_converter_generic_init(&vgl->fmt, &sub_tex_conv);
     if (sub_fragment_shader == 0)
     {
         msg_Err(gl, "RGBA shader failed");



More information about the vlc-commits mailing list