[vlc-commits] core: remove global picture_sys_t typedef
Romain Vimont
git at videolan.org
Mon Apr 30 17:20:04 CEST 2018
vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Fri Apr 27 22:05:01 2018 +0200| [35dd7a8f1881cfc6cae45b943e8b40fb396341a7] | committer: Jean-Baptiste Kempf
core: remove global picture_sys_t typedef
Replace picture_sys_t* by void* in picture_resource_t, and remove its
typedef in vlc_common.h (for ODR).
This implies to use void* for private data in the vaapi.
See #17078 and #18033
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=35dd7a8f1881cfc6cae45b943e8b40fb396341a7
---
include/vlc_common.h | 1 -
include/vlc_picture.h | 2 +-
modules/codec/avcodec/directx_va.c | 5 +++--
modules/codec/avcodec/va.c | 6 +++---
modules/codec/avcodec/va.h | 2 +-
modules/codec/avcodec/va_surface.c | 5 +++--
modules/codec/avcodec/va_surface.h | 2 +-
modules/codec/avcodec/vaapi.c | 4 ++--
modules/hw/d3d11/d3d11_surface.c | 11 ++++++-----
modules/hw/d3d9/dxa9.c | 7 ++++---
modules/hw/mmal/mmal_picture.h | 5 +++--
modules/hw/vaapi/vlc_vaapi.c | 11 ++++++-----
modules/hw/vaapi/vlc_vaapi.h | 5 ++---
modules/hw/vdpau/vlc_vdpau.h | 4 ++--
modules/video_chroma/d3d11_fmt.h | 4 ++--
modules/video_chroma/d3d9_fmt.h | 4 ++--
modules/video_output/android/display.h | 4 ++--
modules/video_output/kva.c | 4 ++--
modules/video_output/opengl/converter_sw.c | 4 ++--
modules/video_output/vmem.c | 5 +++--
modules/video_output/wayland/shm.c | 2 +-
modules/video_output/win32/directdraw.c | 5 +++--
22 files changed, 54 insertions(+), 48 deletions(-)
diff --git a/include/vlc_common.h b/include/vlc_common.h
index 13b7d2e331..da334710af 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -377,7 +377,6 @@ typedef struct vlc_viewpoint_t vlc_viewpoint_t;
typedef video_format_t video_frame_format_t;
typedef struct picture_t picture_t;
-typedef struct picture_sys_t picture_sys_t;
/* Subpictures */
typedef struct spu_t spu_t;
diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index 7364ea94b2..e82c5da6f4 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -124,7 +124,7 @@ VLC_API picture_t * picture_NewFromFormat( const video_format_t *p_fmt ) VLC_USE
*/
typedef struct
{
- picture_sys_t *p_sys;
+ void *p_sys;
void (*pf_destroy)(picture_t *);
/* Plane resources
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index b69e092d6e..91f44e0a9a 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -39,9 +39,10 @@
#define D3D_DecoderType IUnknown
#define D3D_DecoderDevice IUnknown
#define D3D_DecoderSurface IUnknown
-struct picture_sys_t {
+typedef struct
+{
void *dummy;
-};
+} picture_sys_t;
#include "directx_va.h"
#include "avcodec.h"
diff --git a/modules/codec/avcodec/va.c b/modules/codec/avcodec/va.c
index b8b9e267a1..d1e3048259 100644
--- a/modules/codec/avcodec/va.c
+++ b/modules/codec/avcodec/va.c
@@ -97,9 +97,9 @@ static int vlc_va_Start(void *func, va_list ap)
AVCodecContext *ctx = va_arg(ap, AVCodecContext *);
enum PixelFormat pix_fmt = va_arg(ap, enum PixelFormat);
const es_format_t *fmt = va_arg(ap, const es_format_t *);
- picture_sys_t *p_sys = va_arg(ap, picture_sys_t *);
+ void *p_sys = va_arg(ap, void *);
int (*open)(vlc_va_t *, AVCodecContext *, enum PixelFormat,
- const es_format_t *, picture_sys_t *) = func;
+ const es_format_t *, void *) = func;
return open(va, ctx, pix_fmt, fmt, p_sys);
}
@@ -115,7 +115,7 @@ static void vlc_va_Stop(void *func, va_list ap)
vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *avctx,
enum PixelFormat pix_fmt, const es_format_t *fmt,
- picture_sys_t *p_sys)
+ void *p_sys)
{
vlc_va_t *va = vlc_object_create(obj, sizeof (*va));
if (unlikely(va == NULL))
diff --git a/modules/codec/avcodec/va.h b/modules/codec/avcodec/va.h
index a2881dc2ad..178047ad16 100644
--- a/modules/codec/avcodec/va.h
+++ b/modules/codec/avcodec/va.h
@@ -56,7 +56,7 @@ vlc_fourcc_t vlc_va_GetChroma(enum PixelFormat hwfmt, enum PixelFormat swfmt);
*/
vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *,
enum PixelFormat, const es_format_t *fmt,
- picture_sys_t *p_sys);
+ void *p_sys);
/**
* Allocates a hardware video surface for a libavcodec frame.
diff --git a/modules/codec/avcodec/va_surface.c b/modules/codec/avcodec/va_surface.c
index 0f540ca02f..a4415cbd2c 100644
--- a/modules/codec/avcodec/va_surface.c
+++ b/modules/codec/avcodec/va_surface.c
@@ -34,9 +34,10 @@
#include <vlc_codec.h>
#include <vlc_picture.h>
-struct picture_sys_t {
+typedef struct
+{
void *dummy;
-};
+} picture_sys_t;
#include "va_surface_internal.h"
#include "avcodec.h"
diff --git a/modules/codec/avcodec/va_surface.h b/modules/codec/avcodec/va_surface.h
index 0ce48cb026..abb52eb81d 100644
--- a/modules/codec/avcodec/va_surface.h
+++ b/modules/codec/avcodec/va_surface.h
@@ -33,7 +33,7 @@ struct va_pic_context
{
picture_context_t s;
struct vlc_va_surface_t *va_surface;
- struct picture_sys_t picsys;
+ picture_sys_t picsys;
};
#endif /* AVCODEC_VA_SURFACE_H */
diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index dccdefe772..d8fafed094 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -152,7 +152,7 @@ static void Delete(vlc_va_t *va, void *hwctx)
}
static int Create(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
- const es_format_t *fmt, picture_sys_t *p_sys)
+ const es_format_t *fmt, void *p_sys)
{
if (pix_fmt != AV_PIX_FMT_VAAPI_VLD || p_sys == NULL)
return VLC_EGENERIC;
@@ -261,7 +261,7 @@ static void DeleteDRM(vlc_va_t *va, void **hwctx)
}
static int CreateDRM(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
- const es_format_t *fmt, picture_sys_t *p_sys)
+ const es_format_t *fmt, void *p_sys)
{
if (pix_fmt != AV_PIX_FMT_VAAPI_VLD || p_sys)
return VLC_EGENERIC;
diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index 80a51e0086..2873dc7ce7 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -813,13 +813,14 @@ int D3D11OpenCPUConverter( vlc_object_t *obj )
picture_resource_t res;
res.pf_destroy = DestroyPicture;
- res.p_sys = calloc(1, sizeof(picture_sys_t));
- if (res.p_sys == NULL) {
+ picture_sys_t *res_sys = calloc(1, sizeof(picture_sys_t));
+ if (res_sys == NULL) {
err = VLC_ENOMEM;
goto done;
}
- res.p_sys->context = d3d_dev.d3dcontext;
- res.p_sys->formatTexture = texDesc.Format;
+ res.p_sys = res_sys;
+ res_sys->context = d3d_dev.d3dcontext;
+ res_sys->formatTexture = texDesc.Format;
video_format_Copy(&fmt_staging, &p_filter->fmt_out.video);
fmt_staging.i_chroma = d3d_fourcc;
@@ -849,7 +850,7 @@ int D3D11OpenCPUConverter( vlc_object_t *obj )
goto done;
}
- res.p_sys->texture[KNOWN_DXGI_INDEX] = texture;
+ res_sys->texture[KNOWN_DXGI_INDEX] = texture;
ID3D11DeviceContext_AddRef(p_dst_sys->context);
if ( p_filter->fmt_in.video.i_chroma != d3d_fourcc )
diff --git a/modules/hw/d3d9/dxa9.c b/modules/hw/d3d9/dxa9.c
index 166de39328..781b60b10f 100644
--- a/modules/hw/d3d9/dxa9.c
+++ b/modules/hw/d3d9/dxa9.c
@@ -412,11 +412,12 @@ int D3D9OpenCPUConverter( vlc_object_t *obj )
{
picture_resource_t res;
res.pf_destroy = DestroyPicture;
- res.p_sys = calloc(1, sizeof(picture_sys_t));
- if (res.p_sys == NULL) {
+ picture_sys_t *res_sys = calloc(1, sizeof(picture_sys_t));
+ if (res_sys == NULL) {
err = VLC_ENOMEM;
goto done;
}
+ res.p_sys = res_sys;
video_format_Copy(&fmt_staging, &p_filter->fmt_out.video);
fmt_staging.i_chroma = texDesc.Format;
@@ -441,7 +442,7 @@ int D3D9OpenCPUConverter( vlc_object_t *obj )
msg_Err(p_filter, "Failed to create a %4.4s staging texture to extract surface pixels (hr=0x%0lx)", (char *)texDesc.Format, hr );
goto done;
}
- res.p_sys->surface = texture;
+ res_sys->surface = texture;
IDirect3DSurface9_AddRef(texture);
p_cpu_filter = CreateFilter(VLC_OBJECT(p_filter), &p_filter->fmt_in, p_dst->format.i_chroma);
diff --git a/modules/hw/mmal/mmal_picture.h b/modules/hw/mmal/mmal_picture.h
index 3539f2cfc8..c8390f5994 100644
--- a/modules/hw/mmal/mmal_picture.h
+++ b/modules/hw/mmal/mmal_picture.h
@@ -30,12 +30,13 @@
/* Think twice before changing this. Incorrect values cause havoc. */
#define NUM_ACTUAL_OPAQUE_BUFFERS 30
-struct picture_sys_t {
+typedef struct
+{
vlc_object_t *owner;
MMAL_BUFFER_HEADER_T *buffer;
bool displayed;
-};
+} picture_sys_t;
int mmal_picture_lock(picture_t *picture);
diff --git a/modules/hw/vaapi/vlc_vaapi.c b/modules/hw/vaapi/vlc_vaapi.c
index a44d828852..3c69fea393 100644
--- a/modules/hw/vaapi/vlc_vaapi.c
+++ b/modules/hw/vaapi/vlc_vaapi.c
@@ -544,11 +544,11 @@ struct pic_sys_vaapi_instance
VASurfaceID render_targets[];
};
-struct picture_sys_t
+typedef struct
{
struct pic_sys_vaapi_instance *instance;
struct vaapi_pic_ctx ctx;
-};
+} picture_sys_t;
static void
pool_pic_destroy_cb(picture_t *pic)
@@ -685,17 +685,18 @@ error:
}
unsigned
-vlc_vaapi_PicSysGetRenderTargets(picture_sys_t *sys,
- VASurfaceID **render_targets)
+vlc_vaapi_PicSysGetRenderTargets(void *_sys, VASurfaceID **render_targets)
{
+ picture_sys_t *sys = (picture_sys_t *)_sys;
assert(sys && sys->instance);
*render_targets = sys->instance->render_targets;
return sys->instance->num_render_targets;
}
struct vlc_vaapi_instance *
-vlc_vaapi_PicSysHoldInstance(picture_sys_t *sys, VADisplay *dpy)
+vlc_vaapi_PicSysHoldInstance(void *_sys, VADisplay *dpy)
{
+ picture_sys_t *sys = (picture_sys_t *)_sys;
assert(sys->instance != NULL);
*dpy = vlc_vaapi_HoldInstance(sys->instance->va_inst);
return sys->instance->va_inst;
diff --git a/modules/hw/vaapi/vlc_vaapi.h b/modules/hw/vaapi/vlc_vaapi.h
index 98737c6929..8f7ca3455e 100644
--- a/modules/hw/vaapi/vlc_vaapi.h
+++ b/modules/hw/vaapi/vlc_vaapi.h
@@ -201,12 +201,11 @@ vlc_vaapi_PoolNew(vlc_object_t *o, struct vlc_vaapi_instance *vainst,
/* Get render targets from a pic_sys allocated by the vaapi pool (see
* vlc_vaapi_PoolNew()) */
unsigned
-vlc_vaapi_PicSysGetRenderTargets(picture_sys_t *sys,
- VASurfaceID **render_targets);
+vlc_vaapi_PicSysGetRenderTargets(void *sys, VASurfaceID **render_targets);
/* Get and hold the VADisplay instance attached to the picture sys */
struct vlc_vaapi_instance *
-vlc_vaapi_PicSysHoldInstance(picture_sys_t *sys, VADisplay *dpy);
+vlc_vaapi_PicSysHoldInstance(void *sys, VADisplay *dpy);
/* Attachs the VASurface to the picture context, the picture must be allocated
* by a vaapi pool (see vlc_vaapi_PoolNew()) */
diff --git a/modules/hw/vdpau/vlc_vdpau.h b/modules/hw/vdpau/vlc_vdpau.h
index f9d6b50eb1..892e717ea0 100644
--- a/modules/hw/vdpau/vlc_vdpau.h
+++ b/modules/hw/vdpau/vlc_vdpau.h
@@ -256,13 +256,13 @@ bool vlc_fourcc_to_vdp_ycc(vlc_fourcc_t fourcc,
return true;
}
-struct picture_sys_t
+typedef struct
{
VdpOutputSurface surface;
VdpDevice device;
vdp_t *vdp;
void *gl_nv_surface;
-};
+} picture_sys_t;
typedef struct vlc_vdp_video_frame
{
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index a5b46ad582..26e6acbd0f 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -55,7 +55,7 @@ typedef struct
} d3d11_handle_t;
/* owned by the vout for VLC_CODEC_D3D11_OPAQUE */
-struct picture_sys_t
+typedef struct
{
ID3D11VideoDecoderOutputView *decoder; /* may be NULL for pictures from the pool */
union {
@@ -68,7 +68,7 @@ struct picture_sys_t
ID3D11VideoProcessorOutputView *processorOutput; /* when used as processor output */
ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW];
DXGI_FORMAT formatTexture;
-};
+} picture_sys_t;
#include "../codec/avcodec/va_surface.h"
diff --git a/modules/video_chroma/d3d9_fmt.h b/modules/video_chroma/d3d9_fmt.h
index 6f86f0f04e..9db5659abf 100644
--- a/modules/video_chroma/d3d9_fmt.h
+++ b/modules/video_chroma/d3d9_fmt.h
@@ -32,13 +32,13 @@
#include "dxgi_fmt.h"
/* owned by the vout for VLC_CODEC_D3D9_OPAQUE */
-struct picture_sys_t
+typedef struct
{
IDirect3DSurface9 *surface;
/* decoder only */
IDirectXVideoDecoder *decoder; /* keep a reference while the surface exist */
HINSTANCE dxva2_dll;
-};
+} picture_sys_t;
typedef struct
{
diff --git a/modules/video_output/android/display.h b/modules/video_output/android/display.h
index cf94be5027..e3e91149ec 100644
--- a/modules/video_output/android/display.h
+++ b/modules/video_output/android/display.h
@@ -36,7 +36,7 @@
#include <vlc_vout_display.h>
#include <android/native_window.h>
-struct picture_sys_t
+typedef struct
{
union {
struct {
@@ -59,7 +59,7 @@ struct picture_sys_t
} sw;
};
bool b_locked;
-};
+} picture_sys_t;
static inline void
AndroidOpaquePicture_DetachDecoder(picture_sys_t *p_picsys)
diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
index 15acb1a5fb..0c633bf01e 100644
--- a/modules/video_output/kva.c
+++ b/modules/video_output/kva.c
@@ -105,10 +105,10 @@ struct vout_display_sys_t
bool is_on_top;
};
-struct picture_sys_t
+typedef struct
{
int i_chroma_shift;
-};
+} picture_sys_t;
/*****************************************************************************
* Local prototypes
diff --git a/modules/video_output/opengl/converter_sw.c b/modules/video_output/opengl/converter_sw.c
index 2a01ba4215..d609468cd2 100644
--- a/modules/video_output/opengl/converter_sw.c
+++ b/modules/video_output/opengl/converter_sw.c
@@ -68,7 +68,7 @@
#endif
#define PBO_DISPLAY_COUNT 2 /* Double buffering */
-struct picture_sys_t
+typedef struct
{
vlc_gl_t *gl;
PFNGLDELETEBUFFERSPROC DeleteBuffers;
@@ -76,7 +76,7 @@ struct picture_sys_t
size_t bytes[PICTURE_PLANE_MAX];
GLsync fence;
unsigned index;
-};
+} picture_sys_t;
struct priv
{
diff --git a/modules/video_output/vmem.c b/modules/video_output/vmem.c
index a046d7c33e..a5e6fe130d 100644
--- a/modules/video_output/vmem.c
+++ b/modules/video_output/vmem.c
@@ -81,9 +81,10 @@ vlc_module_end()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-struct picture_sys_t {
+typedef struct
+{
void *id;
-};
+} picture_sys_t;
/* NOTE: the callback prototypes must match those of LibVLC */
struct vout_display_sys_t {
diff --git a/modules/video_output/wayland/shm.c b/modules/video_output/wayland/shm.c
index 08ad5022f9..78dad4b7ef 100644
--- a/modules/video_output/wayland/shm.c
+++ b/modules/video_output/wayland/shm.c
@@ -178,7 +178,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
if (buf == NULL)
break;
- res.p_sys = (picture_sys_t *)buf;
+ res.p_sys = buf;
res.p[0].p_pixels = base;
base = ((char *)base) + picsize;
offset += picsize;
diff --git a/modules/video_output/win32/directdraw.c b/modules/video_output/win32/directdraw.c
index ac3b290ea1..a8c45437d9 100644
--- a/modules/video_output/win32/directdraw.c
+++ b/modules/video_output/win32/directdraw.c
@@ -123,11 +123,12 @@ vlc_module_end()
* Local prototypes.
*****************************************************************************/
-struct picture_sys_t {
+typedef struct
+{
LPDIRECTDRAWSURFACE2 surface;
LPDIRECTDRAWSURFACE2 front_surface;
picture_t *fallback;
-};
+} picture_sys_t;
struct vout_display_sys_t
{
More information about the vlc-commits
mailing list