[vlc-commits] opengl: converter: add tc->handle_texs_gen

Thomas Guillem git at videolan.org
Thu Feb 16 14:34:09 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Feb 16 12:51:47 2017 +0100| [5fdb33e474ee6332f37030cc548de4d2a8094c1d] | committer: Thomas Guillem

opengl: converter: add tc->handle_texs_gen

Set it to true if textures are generated from pf_update(). This will be used
by the cvpx converter on ios that create textures for each picture upload.

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

 modules/video_output/opengl/internal.h    |  6 +++++-
 modules/video_output/opengl/vout_helper.c | 17 +++++++++++------
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/modules/video_output/opengl/internal.h b/modules/video_output/opengl/internal.h
index 6c711b5..13bd777 100644
--- a/modules/video_output/opengl/internal.h
+++ b/modules/video_output/opengl/internal.h
@@ -179,6 +179,9 @@ struct opengl_tex_converter_t
     /* Texture mapping (usually: GL_TEXTURE_2D), cannot be 0 */
     GLenum tex_target;
 
+    /* Set to true if textures are generated from pf_update() */
+    bool handle_texs_gen;
+
     struct opengl_tex_cfg {
         /* Texture scale factor, cannot be 0 */
         struct {
@@ -216,7 +219,8 @@ struct opengl_tex_converter_t
      *
      * This function pointer can be NULL. Software converters should call
      * glTexImage2D() to allocate textures data (it will be deallocated by the
-     * caller when calling glDeleteTextures()).
+     * caller when calling glDeleteTextures()). Won't be called if
+     * handle_texs_gen is true.
      *
      * \param fc OpenGL tex converter
      * \param textures array of textures to bind (one per plane)
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index e343e12..39c2eb7 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -678,6 +678,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
         free(vgl);
         return NULL;
     }
+    assert(!vgl->sub_prgm->tc.handle_texs_gen);
 
     for (size_t j = 0; j < ARRAY_SIZE(opengl_tex_converter_init_cbs); ++j)
     {
@@ -738,12 +739,15 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     }
 
     /* Allocates our textures */
-    ret = GenTextures(&vgl->prgm->tc, vgl->tex_width, vgl->tex_height,
-                      vgl->texture);
-    if (ret != VLC_SUCCESS)
+    if (!vgl->prgm->tc.handle_texs_gen)
     {
-        vout_display_opengl_Delete(vgl);
-        return NULL;
+        ret = GenTextures(&vgl->prgm->tc, vgl->tex_width, vgl->tex_height,
+                          vgl->texture);
+        if (ret != VLC_SUCCESS)
+        {
+            vout_display_opengl_Delete(vgl);
+            return NULL;
+        }
     }
 
     /* */
@@ -794,7 +798,8 @@ void vout_display_opengl_Delete(vout_display_opengl_t *vgl)
     glFlush();
 
     opengl_tex_converter_t *tc = &vgl->prgm->tc;
-    DelTextures(tc, vgl->texture);
+    if (!tc->handle_texs_gen)
+        DelTextures(tc, vgl->texture);
 
     tc = &vgl->sub_prgm->tc;
     for (int i = 0; i < vgl->region_count; i++)



More information about the vlc-commits mailing list