[vlc-devel] [PATCH v3 05/12] modules: pass NULL to picture_NewFromResource instead of dummy structures

Steve Lhomme robux4 at ycbcr.xyz
Tue Aug 18 08:24:46 CEST 2020


---
 modules/codec/vt_utils.c         | 3 +--
 modules/hw/d3d11/d3d11_surface.c | 3 +--
 modules/hw/d3d9/dxa9.c           | 3 +--
 modules/video_output/fb.c        | 4 +---
 modules/video_output/kms.c       | 4 +---
 modules/video_output/vmem.c      | 3 +--
 6 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/modules/codec/vt_utils.c b/modules/codec/vt_utils.c
index 75191117fe7..81314b606e3 100644
--- a/modules/codec/vt_utils.c
+++ b/modules/codec/vt_utils.c
@@ -153,7 +153,6 @@ cvpxpic_create_mapped(const video_format_t *fmt, CVPixelBufferRef cvpx,
 
     CVPixelBufferLockFlags lock = readonly ? kCVPixelBufferLock_ReadOnly : 0;
     CVPixelBufferLockBaseAddress(cvpx, lock);
-    picture_resource_t rsc = { };
 
 #ifndef NDEBUG
     assert(CVPixelBufferGetPlaneCount(cvpx) == planes_count);
@@ -162,7 +161,7 @@ cvpxpic_create_mapped(const video_format_t *fmt, CVPixelBufferRef cvpx,
     void (*pf_destroy)(picture_context_t *) = readonly ?
         cvpxpic_destroy_mapped_ro_cb : cvpxpic_destroy_mapped_rw_cb;
 
-    picture_t *pic = picture_NewFromResource(fmt, &rsc);
+    picture_t *pic = picture_NewFromResource(fmt, NULL);
     if (pic == NULL
      || cvpxpic_attach_common(pic, cvpx, pf_destroy, vctx, NULL) != VLC_SUCCESS)
     {
diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index d6bc9ba0267..ec25dc7be34 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -618,8 +618,7 @@ static picture_t *AllocateCPUtoGPUTexture(filter_t *p_filter, filter_sys_t *p_sy
     video_format_Copy(&fmt_staging, &p_filter->fmt_out.video);
     fmt_staging.i_chroma = cfg->fourcc;
 
-    picture_resource_t dummy_res = {};
-    picture_t *p_dst = picture_NewFromResource(&fmt_staging, &dummy_res);
+    picture_t *p_dst = picture_NewFromResource(&fmt_staging, NULL);
     if (p_dst == NULL) {
         msg_Err(p_filter, "Failed to map create the temporary picture.");
         goto done;
diff --git a/modules/hw/d3d9/dxa9.c b/modules/hw/d3d9/dxa9.c
index 563818dc708..d2fc65ffd28 100644
--- a/modules/hw/d3d9/dxa9.c
+++ b/modules/hw/d3d9/dxa9.c
@@ -347,8 +347,7 @@ static picture_t *AllocateCPUtoGPUTexture(filter_t *p_filter)
     video_format_Copy(&fmt_staging, &p_filter->fmt_out.video);
     fmt_staging.i_chroma = format;
 
-    picture_resource_t dummy_res = {};
-    picture_t *p_dst = picture_NewFromResource(&fmt_staging, &dummy_res);
+    picture_t *p_dst = picture_NewFromResource(&fmt_staging, NULL);
     if (p_dst == NULL) {
         msg_Err(p_filter, "Failed to map create the temporary picture.");
         goto done;
diff --git a/modules/video_output/fb.c b/modules/video_output/fb.c
index d8dcf8646a6..510d55d7e67 100644
--- a/modules/video_output/fb.c
+++ b/modules/video_output/fb.c
@@ -596,9 +596,7 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution)
         return VLC_EGENERIC;
     }
 
-    picture_resource_t rsc = { 0 };
-
-    sys->picture = picture_NewFromResource(&vd->fmt, &rsc);
+    sys->picture = picture_NewFromResource(&vd->fmt, NULL);
     if (unlikely(sys->picture == NULL)) {
         munmap(sys->video_ptr, sys->video_size);
         ioctl(sys->fd, FBIOPUT_VSCREENINFO, &sys->old_info);
diff --git a/modules/video_output/kms.c b/modules/video_output/kms.c
index 3e686e1414a..aa8920b2788 100644
--- a/modules/video_output/kms.c
+++ b/modules/video_output/kms.c
@@ -576,9 +576,7 @@ static int OpenDisplay(vout_display_t *vd)
     if (!found_connector)
         goto err_out;
 
-    picture_resource_t rsc = { 0 };
-
-    sys->picture = picture_NewFromResource(&vd->fmt, &rsc);
+    sys->picture = picture_NewFromResource(&vd->fmt, NULL);
 
     if (!sys->picture)
         goto err_out;
diff --git a/modules/video_output/vmem.c b/modules/video_output/vmem.c
index 7463fb1a7b9..ba0e0c6d57d 100644
--- a/modules/video_output/vmem.c
+++ b/modules/video_output/vmem.c
@@ -239,12 +239,11 @@ 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 = { .p_sys = NULL };
     void *planes[PICTURE_PLANE_MAX];
 
     sys->pic_opaque = sys->lock(sys->opaque, planes);
 
-    picture_t *locked = picture_NewFromResource(&vd->fmt, &rsc);
+    picture_t *locked = picture_NewFromResource(&vd->fmt, NULL);
     if (likely(locked != NULL)) {
         for (unsigned i = 0; i < PICTURE_PLANE_MAX; i++) {
             locked->p[i].p_pixels = planes[i];
-- 
2.26.2



More information about the vlc-devel mailing list