[vlc-commits] vt_utils: set the picture planes once the picture is created

Steve Lhomme git at videolan.org
Mon Aug 10 08:51:48 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jul 21 13:53:17 2020 +0200| [c9b19452df0f4ebd906f7a9c34f0a9bd0b36b59f] | committer: Steve Lhomme

vt_utils: set the picture planes once the picture is created

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

 modules/codec/vt_utils.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/modules/codec/vt_utils.c b/modules/codec/vt_utils.c
index 55375dc2ff..75191117fe 100644
--- a/modules/codec/vt_utils.c
+++ b/modules/codec/vt_utils.c
@@ -159,22 +159,6 @@ cvpxpic_create_mapped(const video_format_t *fmt, CVPixelBufferRef cvpx,
     assert(CVPixelBufferGetPlaneCount(cvpx) == planes_count);
 #endif
 
-    if (planes_count == 0)
-    {
-        rsc.p[0].p_pixels = CVPixelBufferGetBaseAddress(cvpx);
-        rsc.p[0].i_lines = CVPixelBufferGetHeight(cvpx);
-        rsc.p[0].i_pitch = CVPixelBufferGetBytesPerRow(cvpx);
-    }
-    else
-    {
-        for (unsigned i = 0; i < planes_count; ++i)
-        {
-            rsc.p[i].p_pixels = CVPixelBufferGetBaseAddressOfPlane(cvpx, i);
-            rsc.p[i].i_lines = CVPixelBufferGetHeightOfPlane(cvpx, i);
-            rsc.p[i].i_pitch = CVPixelBufferGetBytesPerRowOfPlane(cvpx, i);
-        }
-    }
-
     void (*pf_destroy)(picture_context_t *) = readonly ?
         cvpxpic_destroy_mapped_ro_cb : cvpxpic_destroy_mapped_rw_cb;
 
@@ -185,6 +169,23 @@ cvpxpic_create_mapped(const video_format_t *fmt, CVPixelBufferRef cvpx,
         CVPixelBufferUnlockBaseAddress(cvpx, lock);
         return NULL;
     }
+
+    if (planes_count == 0)
+    {
+        pic->p[0].p_pixels = CVPixelBufferGetBaseAddress(cvpx);
+        pic->p[0].i_lines = CVPixelBufferGetHeight(cvpx);
+        pic->p[0].i_pitch = CVPixelBufferGetBytesPerRow(cvpx);
+    }
+    else
+    {
+        for (unsigned i = 0; i < planes_count; ++i)
+        {
+            pic->p[i].p_pixels = CVPixelBufferGetBaseAddressOfPlane(cvpx, i);
+            pic->p[i].i_lines = CVPixelBufferGetHeightOfPlane(cvpx, i);
+            pic->p[i].i_pitch = CVPixelBufferGetBytesPerRowOfPlane(cvpx, i);
+        }
+    }
+
     return pic;
 }
 



More information about the vlc-commits mailing list