[vlc-devel] [PATCH 04/13] Replace picture_sys_t* by void*
Romain Vimont
rom1v at videolabs.io
Tue Apr 24 11:18:22 CEST 2018
See #17078
---
include/vlc_picture.h | 2 +-
modules/hw/vaapi/vlc_vaapi.c | 8 +++++---
modules/hw/vdpau/chroma.c | 7 ++++---
modules/hw/vdpau/display.c | 3 ++-
modules/video_output/opengl/converter_sw.c | 13 ++++++++-----
modules/video_output/opengl/converter_vdpau.c | 13 ++++++++-----
6 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index 7c0d869821..7364ea94b2 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -97,7 +97,7 @@ struct picture_t
/** Private data - the video output plugin might want to put stuff here to
* keep track of the picture */
- picture_sys_t * p_sys;
+ void *p_sys;
/** Next picture in a FIFO a pictures */
struct picture_t *p_next;
diff --git a/modules/hw/vaapi/vlc_vaapi.c b/modules/hw/vaapi/vlc_vaapi.c
index 1f1f384c99..a44d828852 100644
--- a/modules/hw/vaapi/vlc_vaapi.c
+++ b/modules/hw/vaapi/vlc_vaapi.c
@@ -712,8 +712,9 @@ vlc_vaapi_PicAttachContext(picture_t *pic)
assert(pic->p_sys != NULL);
assert(pic->context == NULL);
- pic->p_sys->ctx.picref = pic;
- pic->context = &pic->p_sys->ctx.s;
+ picture_sys_t *p_sys = pic->p_sys;
+ p_sys->ctx.picref = pic;
+ pic->context = &p_sys->ctx.s;
}
VASurfaceID
@@ -731,5 +732,6 @@ vlc_vaapi_PicGetDisplay(picture_t *pic)
ASSERT_VAAPI_CHROMA(pic);
assert(pic->context);
- return ((struct vaapi_pic_ctx *)pic->context)->picref->p_sys->instance->va_dpy;
+ picture_sys_t *p_sys = ((struct vaapi_pic_ctx *)pic->context)->picref->p_sys;
+ return p_sys->instance->va_dpy;
}
diff --git a/modules/hw/vdpau/chroma.c b/modules/hw/vdpau/chroma.c
index d839285d8b..028f3d808c 100644
--- a/modules/hw/vdpau/chroma.c
+++ b/modules/hw/vdpau/chroma.c
@@ -516,7 +516,8 @@ static picture_t *Render(filter_t *filter, picture_t *src, bool import)
if (dst == NULL)
goto skip;
- assert(dst->p_sys != NULL && dst->p_sys->vdp ==sys->vdp);
+ picture_sys_t *p_sys = dst->p_sys;
+ assert(p_sys != NULL && p_sys->vdp == sys->vdp);
dst->date = sys->history[MAX_PAST].date;
dst->b_force = sys->history[MAX_PAST].force;
@@ -589,7 +590,7 @@ static picture_t *Render(filter_t *filter, picture_t *src, bool import)
}
}
- VdpOutputSurface output = dst->p_sys->surface;
+ VdpOutputSurface output = p_sys->surface;
if (swap)
{
@@ -670,7 +671,7 @@ static picture_t *Render(filter_t *filter, picture_t *src, bool import)
if (swap)
{
err = vdp_output_surface_render_output_surface(sys->vdp,
- dst->p_sys->surface, NULL, output, NULL, NULL, NULL,
+ p_sys->surface, NULL, output, NULL, NULL, NULL,
VDP_OUTPUT_SURFACE_RENDER_ROTATE_90);
vdp_output_surface_destroy(sys->vdp, output);
if (err != VDP_STATUS_OK)
diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index edd6096729..87b1378c6e 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -243,7 +243,8 @@ out:/* Destroy GPU surface */
static void Queue(vout_display_t *vd, picture_t *pic, subpicture_t *subpic)
{
vout_display_sys_t *sys = vd->sys;
- VdpOutputSurface surface = pic->p_sys->surface;
+ picture_sys_t *p_sys = pic->p_sys;
+ VdpOutputSurface surface = p_sys->surface;
VdpStatus err;
VdpPresentationQueueStatus status;
diff --git a/modules/video_output/opengl/converter_sw.c b/modules/video_output/opengl/converter_sw.c
index 981e0d4e37..2a01ba4215 100644
--- a/modules/video_output/opengl/converter_sw.c
+++ b/modules/video_output/opengl/converter_sw.c
@@ -216,6 +216,7 @@ tc_pbo_update(const opengl_tex_converter_t *tc, GLuint *textures,
struct priv *priv = tc->priv;
picture_t *display_pic = priv->pbo.display_pics[priv->pbo.display_idx];
+ 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++)
@@ -223,7 +224,7 @@ tc_pbo_update(const opengl_tex_converter_t *tc, GLuint *textures,
GLsizeiptr size = pic->p[i].i_lines * pic->p[i].i_pitch;
const GLvoid *data = pic->p[i].p_pixels;
tc->vt->BindBuffer(GL_PIXEL_UNPACK_BUFFER,
- display_pic->p_sys->buffers[i]);
+ p_sys->buffers[i]);
tc->vt->BufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, size, data);
tc->vt->ActiveTexture(GL_TEXTURE0 + i);
@@ -344,7 +345,7 @@ tc_persistent_update(const opengl_tex_converter_t *tc, GLuint *textures,
}
picsys->fence = tc->vt->FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
- if (pic->p_sys->fence == NULL)
+ if (picsys->fence == NULL)
{
/* Error (corner case): don't hold the picture */
hold = false;
@@ -355,7 +356,7 @@ tc_persistent_update(const opengl_tex_converter_t *tc, GLuint *textures,
if (hold)
{
/* Hold the picture while it's used by the GPU */
- unsigned index = pic->p_sys->index;
+ unsigned index = picsys->index;
priv->persistent.list |= 1ULL << index;
assert(priv->persistent.pics[index] == NULL);
@@ -384,11 +385,13 @@ tc_persistent_get_pool(const opengl_tex_converter_t *tc, unsigned requested_coun
picture_t *pic = pictures[count] = pbo_picture_create(tc, true);
if (pic == NULL)
break;
+
+ picture_sys_t *p_sys = pic->p_sys;
#ifndef NDEBUG
for (int i = 0; i < pic->i_planes; ++i)
- assert(pic->p_sys->bytes[i] == pictures[0]->p_sys->bytes[i]);
+ assert(p_sys->bytes[i] == ((picture_sys_t *) pictures[0]->p_sys)->bytes[i]);
#endif
- pic->p_sys->index = count;
+ p_sys->index = count;
if (persistent_map(tc, pic) != VLC_SUCCESS)
{
diff --git a/modules/video_output/opengl/converter_vdpau.c b/modules/video_output/opengl/converter_vdpau.c
index f3d807a49b..bb77ae8d26 100644
--- a/modules/video_output/opengl/converter_vdpau.c
+++ b/modules/video_output/opengl/converter_vdpau.c
@@ -66,9 +66,10 @@ static PFNGLVDPAUUNMAPSURFACESNVPROC _glVDPAUUnmapSurfacesNV;
static void
pool_pic_destroy_cb(picture_t *pic)
{
- vdp_output_surface_destroy(pic->p_sys->vdp, pic->p_sys->surface);
- vdp_release_x11(pic->p_sys->vdp);
- free(pic->p_sys);
+ picture_sys_t *p_sys = pic->p_sys;
+ vdp_output_surface_destroy(p_sys->vdp, p_sys->surface);
+ vdp_release_x11(p_sys->vdp);
+ free(p_sys);
free(pic);
}
@@ -129,8 +130,10 @@ tc_vdpau_gl_update(opengl_tex_converter_t const *tc, GLuint textures[],
VLC_UNUSED(tex_heights);
VLC_UNUSED(plane_offsets);
+ picture_sys_t *p_sys = pic->p_sys;
+
GLvdpauSurfaceNV *p_gl_nv_surface =
- (GLvdpauSurfaceNV *)&pic->p_sys->gl_nv_surface;
+ (GLvdpauSurfaceNV *)&p_sys->gl_nv_surface;
if (*p_gl_nv_surface)
{
@@ -148,7 +151,7 @@ tc_vdpau_gl_update(opengl_tex_converter_t const *tc, GLuint textures[],
*p_gl_nv_surface =
INTEROP_CALL(glVDPAURegisterOutputSurfaceNV,
- (void *)(size_t)pic->p_sys->surface,
+ (void *)(size_t)p_sys->surface,
GL_TEXTURE_2D, tc->tex_count, textures);
INTEROP_CALL(glVDPAUSurfaceAccessNV, *p_gl_nv_surface, GL_READ_ONLY);
INTEROP_CALL(glVDPAUMapSurfacesNV, 1, p_gl_nv_surface);
--
2.17.0
More information about the vlc-devel
mailing list