[vlc-devel] [PATCH v2 10/14] vout: opengl: keep the number of bound planes in picture_sys_t

Steve Lhomme robux4 at ycbcr.xyz
Fri Aug 14 14:01:45 CEST 2020


---
 modules/video_output/opengl/interop_sw.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/modules/video_output/opengl/interop_sw.c b/modules/video_output/opengl/interop_sw.c
index 4a29422daff..68953865aca 100644
--- a/modules/video_output/opengl/interop_sw.c
+++ b/modules/video_output/opengl/interop_sw.c
@@ -34,6 +34,7 @@
 typedef struct
 {
     PFNGLDELETEBUFFERSPROC DeleteBuffers;
+    int         i_planes;
     GLuint      buffers[PICTURE_PLANE_MAX];
     size_t      bytes[PICTURE_PLANE_MAX];
 } picture_sys_t;
@@ -54,7 +55,7 @@ pbo_picture_destroy(picture_t *pic)
 {
     picture_sys_t *picsys = pic->p_sys;
 
-    picsys->DeleteBuffers(pic->i_planes, picsys->buffers);
+    picsys->DeleteBuffers(picsys->i_planes, picsys->buffers);
 
     free(picsys);
 }
@@ -73,14 +74,15 @@ pbo_picture_create(const struct vlc_gl_interop *interop)
         free(picsys);
         return NULL;
     }
+    picsys->i_planes = pic->i_planes;
 
-    interop->vt->GenBuffers(pic->i_planes, picsys->buffers);
+    interop->vt->GenBuffers(picsys->i_planes, picsys->buffers);
     picsys->DeleteBuffers = interop->vt->DeleteBuffers;
 
-    assert(pic->i_planes > 0
-        && (unsigned) pic->i_planes == interop->tex_count);
+    assert(picsys->i_planes > 0
+        && (unsigned) picsys->i_planes == interop->tex_count);
 
-    for (int i = 0; i < pic->i_planes; ++i)
+    for (int i = 0; i < picsys->i_planes; ++i)
     {
         const plane_t *p = &pic->p[i];
 
@@ -102,7 +104,7 @@ pbo_data_alloc(const struct vlc_gl_interop *interop, picture_t *pic)
 
     interop->vt->GetError();
 
-    for (int i = 0; i < pic->i_planes; ++i)
+    for (int i = 0; i < picsys->i_planes; ++i)
     {
         interop->vt->BindBuffer(GL_PIXEL_UNPACK_BUFFER, picsys->buffers[i]);
         interop->vt->BufferData(GL_PIXEL_UNPACK_BUFFER, picsys->bytes[i], NULL,
@@ -155,7 +157,7 @@ tc_pbo_update(const struct vlc_gl_interop *interop, GLuint *textures,
     picture_sys_t *p_sys = display_pic->p_sys;
     priv->pbo.display_idx = (priv->pbo.display_idx + 1) % PBO_DISPLAY_COUNT;
 
-    for (int i = 0; i < pic->i_planes; i++)
+    for (int i = 0; i < p_sys->i_planes; i++)
     {
         GLsizeiptr size = pic->p[i].i_lines * pic->p[i].i_pitch;
         const GLvoid *data = pic->p[i].p_pixels;
-- 
2.26.2



More information about the vlc-devel mailing list