[vlc-devel] [PATCH 19/19] picture: remove unused resource parameter from picture_NewFromResource
Steve Lhomme
robux4 at ycbcr.xyz
Thu Jul 30 14:17:00 CEST 2020
---
include/vlc_picture.h | 21 ++-------------------
modules/codec/vt_utils.c | 2 +-
modules/hw/d3d11/d3d11_surface.c | 2 +-
modules/hw/d3d9/dxa9.c | 2 +-
modules/hw/nvdec/nvdec.c | 2 +-
modules/hw/vaapi/vlc_vaapi.c | 2 +-
modules/hw/vdpau/picture.c | 2 +-
modules/video_chroma/copy.c | 2 +-
modules/video_output/android/display.c | 2 +-
modules/video_output/fb.c | 2 +-
modules/video_output/kms.c | 2 +-
modules/video_output/opengl/interop_sw.c | 2 +-
modules/video_output/vmem.c | 2 +-
modules/video_output/win32/direct3d11.c | 2 +-
src/misc/picture.c | 13 +------------
15 files changed, 16 insertions(+), 44 deletions(-)
diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index 178118633d0..a7423918320 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -183,23 +183,6 @@ VLC_API picture_t * picture_New( vlc_fourcc_t i_chroma, int i_width, int i_heigh
*/
VLC_API picture_t * picture_NewFromFormat( const video_format_t *p_fmt ) VLC_USED;
-/**
- * Resource for a picture.
- */
-typedef struct
-{
- /* Plane resources
- * XXX all fields MUST be set to the right value.
- */
- struct
- {
- uint8_t *p_pixels; /**< Start of the plane's data */
- int i_lines; /**< Number of lines, including margins */
- int i_pitch; /**< Number of bytes in a line, including margins */
- } p[PICTURE_PLANE_MAX];
-
-} picture_resource_t;
-
/**
* Callback structure to release allocated resources when a picture is released
* for good.
@@ -211,9 +194,9 @@ typedef struct
} picture_gc_t;
/**
- * This function will create a new picture using the provided resource.
+ * This function will create a new picture using the provided destructor.
*/
-VLC_API picture_t * picture_NewFromResource( const video_format_t *, const picture_gc_t *, const picture_resource_t * ) VLC_USED;
+VLC_API picture_t * picture_NewFromResource( const video_format_t *, const picture_gc_t * ) VLC_USED;
/**
* Destroys a picture without references.
diff --git a/modules/codec/vt_utils.c b/modules/codec/vt_utils.c
index a4bc02cc9ba..9510f45b034 100644
--- a/modules/codec/vt_utils.c
+++ b/modules/codec/vt_utils.c
@@ -161,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, NULL, NULL);
+ 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 f0b2ff6e016..48458924c1d 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -615,7 +615,7 @@ static picture_t *AllocateCPUtoGPUTexture(filter_t *p_filter, filter_sys_t *p_sy
fmt_staging.i_chroma = cfg->fourcc;
// allocate a picture with the planes setup but no attached buffer
- picture_t *p_dst = picture_NewFromResource(&fmt_staging, NULL, NULL);
+ 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 a6f8d9171bd..d2d3c01935d 100644
--- a/modules/hw/d3d9/dxa9.c
+++ b/modules/hw/d3d9/dxa9.c
@@ -348,7 +348,7 @@ static picture_t *AllocateCPUtoGPUTexture(filter_t *p_filter)
fmt_staging.i_chroma = format;
// allocate a picture with the planes setup but no attached buffer
- picture_t *p_dst = picture_NewFromResource(&fmt_staging, NULL, NULL);
+ 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/nvdec/nvdec.c b/modules/hw/nvdec/nvdec.c
index 3ae4836c04b..2852405a59d 100644
--- a/modules/hw/nvdec/nvdec.c
+++ b/modules/hw/nvdec/nvdec.c
@@ -178,7 +178,7 @@ static nvdec_pool_t* nvdec_pool_Create(vlc_video_context *vctx,
if (ret != CUDA_SUCCESS || pool->outputDevicePtr[i] == 0)
goto free_pool;
- pics[i] = picture_NewFromResource(fmt, NULL, NULL);
+ pics[i] = picture_NewFromResource(fmt, NULL);
if (!pics[i])
goto free_pool;
pics[i]->p_sys = (void*)(uintptr_t)pool->outputDevicePtr[i];
diff --git a/modules/hw/vaapi/vlc_vaapi.c b/modules/hw/vaapi/vlc_vaapi.c
index 7d9b545928d..30e075151e1 100644
--- a/modules/hw/vaapi/vlc_vaapi.c
+++ b/modules/hw/vaapi/vlc_vaapi.c
@@ -513,7 +513,7 @@ vlc_vaapi_PoolNew(vlc_object_t *o, vlc_video_context *vctx,
p_sys->ctx.ctx.va_dpy = dpy;
p_sys->ctx.picref = NULL;
picture_gc_t gc = { pool_pic_destroy_cb, p_sys };
- pics[i] = picture_NewFromResource(fmt, &gc, NULl);
+ pics[i] = picture_NewFromResource(fmt, &gc);
if (pics[i] == NULL)
{
free(p_sys);
diff --git a/modules/hw/vdpau/picture.c b/modules/hw/vdpau/picture.c
index fdebcaa9ffb..78edc59a2fa 100644
--- a/modules/hw/vdpau/picture.c
+++ b/modules/hw/vdpau/picture.c
@@ -173,7 +173,7 @@ error:
vlc_vdp_output_surface_destroy, sys,
};
- picture_t *pic = picture_NewFromResource(fmt, &gc, NULL);
+ picture_t *pic = picture_NewFromResource(fmt, &gc);
if (unlikely(pic == NULL))
{
vdp_output_surface_destroy(vdpau_dev->vdp, sys->surface);
diff --git a/modules/video_chroma/copy.c b/modules/video_chroma/copy.c
index c457730b7fa..f4651c6a20b 100644
--- a/modules/video_chroma/copy.c
+++ b/modules/video_chroma/copy.c
@@ -1121,7 +1121,7 @@ static picture_t *pic_new_unaligned(const video_format_t *fmt)
assert(rsc->p[i].p_pixels);
}
picture_gc_t gc = { pic_rsc_destroy, rsc };
- picture_t *pic = picture_NewFromResource(fmt, &gc, NULL);
+ picture_t *pic = picture_NewFromResource(fmt, &gc);
if (unlikely(pic == NULL))
{
pic_rsc_destroy(rsc);
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index a257ba1a7f0..760394b564d 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -187,7 +187,7 @@ static picture_t *PictureAlloc(video_format_t *fmt)
picture_gc_t gc = { AndroidPicture_Destroy, p_picsys };
- p_pic = picture_NewFromResource(fmt, &gc, NULL);
+ p_pic = picture_NewFromResource(fmt, &gc);
if (!p_pic)
{
free(p_picsys);
diff --git a/modules/video_output/fb.c b/modules/video_output/fb.c
index 223d3c1b0bd..510d55d7e67 100644
--- a/modules/video_output/fb.c
+++ b/modules/video_output/fb.c
@@ -596,7 +596,7 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution)
return VLC_EGENERIC;
}
- sys->picture = picture_NewFromResource(&vd->fmt, NULL, NULL);
+ 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 33ca309562b..8347b16cb8d 100644
--- a/modules/video_output/kms.c
+++ b/modules/video_output/kms.c
@@ -576,7 +576,7 @@ static int OpenDisplay(vout_display_t *vd)
if (!found_connector)
goto err_out;
- sys->picture = picture_NewFromResource(&vd->fmt, NULL, NULL);
+ sys->picture = picture_NewFromResource(&vd->fmt, NULL);
if (!sys->picture)
goto err_out;
diff --git a/modules/video_output/opengl/interop_sw.c b/modules/video_output/opengl/interop_sw.c
index 630d1fbb2b3..e20fc1ecb1e 100644
--- a/modules/video_output/opengl/interop_sw.c
+++ b/modules/video_output/opengl/interop_sw.c
@@ -68,7 +68,7 @@ pbo_picture_create(const struct vlc_gl_interop *interop)
return NULL;
picture_gc_t gc = { pbo_picture_destroy, picsys };
- picture_t *pic = picture_NewFromResource(&interop->fmt_out, &gc, NULL);
+ picture_t *pic = picture_NewFromResource(&interop->fmt_out, &gc);
if (pic == NULL)
{
free(picsys);
diff --git a/modules/video_output/vmem.c b/modules/video_output/vmem.c
index 80e30da85a6..640458e1997 100644
--- a/modules/video_output/vmem.c
+++ b/modules/video_output/vmem.c
@@ -243,7 +243,7 @@ static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic,
sys->pic_opaque = sys->lock(sys->opaque, planes);
- picture_t *locked = picture_NewFromResource(&vd->fmt, NULL, NULL);
+ picture_t *locked = picture_NewFromResource(&vd->fmt, NULL);
if (likely(locked != NULL)) {
for (unsigned i = 0; i < locked->i_planes; i++) {
locked->p[i].p_pixels = planes[i];
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 0c5a487ec29..18bdcfa2912 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1340,7 +1340,7 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
continue;
}
picture_gc_t gc = { DestroyPictureQuad, d3dquad };
- (*region)[i] = picture_NewFromResource(&r->p_picture->format, &gc, NULL);
+ (*region)[i] = picture_NewFromResource(&r->p_picture->format, &gc);
if ((*region)[i] == NULL) {
msg_Err(vd, "Failed to create %dx%d picture for OSD",
r->fmt.i_width, r->fmt.i_height);
diff --git a/src/misc/picture.c b/src/misc/picture.c
index 3c527a44e9d..0a380b6f8e1 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -208,8 +208,7 @@ static bool picture_InitPrivate(const video_format_t *restrict p_fmt,
return true;
}
-picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_gc_t *gc,
- const picture_resource_t *p_resource )
+picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_gc_t *gc )
{
picture_priv_t *priv = malloc(sizeof(*priv));
if (unlikely(priv == NULL))
@@ -234,16 +233,6 @@ picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_g
p_picture->p_sys = NULL;
}
- if (p_resource != NULL)
- {
- for( int i = 0; i < p_picture->i_planes; i++ )
- {
- p_picture->p[i].p_pixels = p_resource->p[i].p_pixels;
- p_picture->p[i].i_lines = p_resource->p[i].i_lines;
- p_picture->p[i].i_pitch = p_resource->p[i].i_pitch;
- }
- }
-
return p_picture;
}
--
2.26.2
More information about the vlc-devel
mailing list