[vlc-devel] [PATCH 18/19] vout: vmem: set the picture planes once the picture is created

Steve Lhomme robux4 at ycbcr.xyz
Thu Jul 30 14:16:59 CEST 2020


---
 modules/video_output/vmem.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/modules/video_output/vmem.c b/modules/video_output/vmem.c
index 90f61363f9e..80e30da85a6 100644
--- a/modules/video_output/vmem.c
+++ b/modules/video_output/vmem.c
@@ -239,19 +239,18 @@ static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic,
 {
     VLC_UNUSED(date);
     vout_display_sys_t *sys = vd->sys;
-    picture_resource_t rsc = { };
     void *planes[PICTURE_PLANE_MAX];
 
     sys->pic_opaque = sys->lock(sys->opaque, planes);
 
-    for (unsigned i = 0; i < PICTURE_PLANE_MAX; i++) {
-        rsc.p[i].p_pixels = planes[i];
-        rsc.p[i].i_lines  = sys->lines[i];
-        rsc.p[i].i_pitch  = sys->pitches[i];
-    }
-
-    picture_t *locked = picture_NewFromResource(&vd->fmt, NULL, &rsc);
+    picture_t *locked = picture_NewFromResource(&vd->fmt, NULL, NULL);
     if (likely(locked != NULL)) {
+        for (unsigned i = 0; i < locked->i_planes; i++) {
+            locked->p[i].p_pixels = planes[i];
+            locked->p[i].i_lines  = sys->lines[i];
+            locked->p[i].i_pitch  = sys->pitches[i];
+        }
+
         picture_CopyPixels(locked, pic);
         picture_Release(locked);
     }
-- 
2.26.2



More information about the vlc-devel mailing list