Commit 35dd7a8f authored by Romain Vimont's avatar Romain Vimont Committed by 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's avatarJean-Baptiste Kempf <jb@videolan.org>
parent a9456f3c
...@@ -377,7 +377,6 @@ typedef struct vlc_viewpoint_t vlc_viewpoint_t; ...@@ -377,7 +377,6 @@ typedef struct vlc_viewpoint_t vlc_viewpoint_t;
typedef video_format_t video_frame_format_t; typedef video_format_t video_frame_format_t;
typedef struct picture_t picture_t; typedef struct picture_t picture_t;
typedef struct picture_sys_t picture_sys_t;
/* Subpictures */ /* Subpictures */
typedef struct spu_t spu_t; typedef struct spu_t spu_t;
......
...@@ -124,7 +124,7 @@ VLC_API picture_t * picture_NewFromFormat( const video_format_t *p_fmt ) VLC_USE ...@@ -124,7 +124,7 @@ VLC_API picture_t * picture_NewFromFormat( const video_format_t *p_fmt ) VLC_USE
*/ */
typedef struct typedef struct
{ {
picture_sys_t *p_sys; void *p_sys;
void (*pf_destroy)(picture_t *); void (*pf_destroy)(picture_t *);
/* Plane resources /* Plane resources
......
...@@ -39,9 +39,10 @@ ...@@ -39,9 +39,10 @@
#define D3D_DecoderType IUnknown #define D3D_DecoderType IUnknown
#define D3D_DecoderDevice IUnknown #define D3D_DecoderDevice IUnknown
#define D3D_DecoderSurface IUnknown #define D3D_DecoderSurface IUnknown
struct picture_sys_t { typedef struct
{
void *dummy; void *dummy;
}; } picture_sys_t;
#include "directx_va.h" #include "directx_va.h"
#include "avcodec.h" #include "avcodec.h"
......
...@@ -97,9 +97,9 @@ static int vlc_va_Start(void *func, va_list ap) ...@@ -97,9 +97,9 @@ static int vlc_va_Start(void *func, va_list ap)
AVCodecContext *ctx = va_arg(ap, AVCodecContext *); AVCodecContext *ctx = va_arg(ap, AVCodecContext *);
enum PixelFormat pix_fmt = va_arg(ap, enum PixelFormat); enum PixelFormat pix_fmt = va_arg(ap, enum PixelFormat);
const es_format_t *fmt = va_arg(ap, const es_format_t *); 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, 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); return open(va, ctx, pix_fmt, fmt, p_sys);
} }
...@@ -115,7 +115,7 @@ static void vlc_va_Stop(void *func, va_list ap) ...@@ -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, vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *avctx,
enum PixelFormat pix_fmt, const es_format_t *fmt, 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)); vlc_va_t *va = vlc_object_create(obj, sizeof (*va));
if (unlikely(va == NULL)) if (unlikely(va == NULL))
......
...@@ -56,7 +56,7 @@ vlc_fourcc_t vlc_va_GetChroma(enum PixelFormat hwfmt, enum PixelFormat swfmt); ...@@ -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 *, vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *,
enum PixelFormat, const es_format_t *fmt, enum PixelFormat, const es_format_t *fmt,
picture_sys_t *p_sys); void *p_sys);
/** /**
* Allocates a hardware video surface for a libavcodec frame. * Allocates a hardware video surface for a libavcodec frame.
......
...@@ -34,9 +34,10 @@ ...@@ -34,9 +34,10 @@
#include <vlc_codec.h> #include <vlc_codec.h>
#include <vlc_picture.h> #include <vlc_picture.h>
struct picture_sys_t { typedef struct
{
void *dummy; void *dummy;
}; } picture_sys_t;
#include "va_surface_internal.h" #include "va_surface_internal.h"
#include "avcodec.h" #include "avcodec.h"
......
...@@ -33,7 +33,7 @@ struct va_pic_context ...@@ -33,7 +33,7 @@ struct va_pic_context
{ {
picture_context_t s; picture_context_t s;
struct vlc_va_surface_t *va_surface; struct vlc_va_surface_t *va_surface;
struct picture_sys_t picsys; picture_sys_t picsys;
}; };
#endif /* AVCODEC_VA_SURFACE_H */ #endif /* AVCODEC_VA_SURFACE_H */
...@@ -152,7 +152,7 @@ static void Delete(vlc_va_t *va, void *hwctx) ...@@ -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, 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) if (pix_fmt != AV_PIX_FMT_VAAPI_VLD || p_sys == NULL)
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -261,7 +261,7 @@ static void DeleteDRM(vlc_va_t *va, void **hwctx) ...@@ -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, 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) if (pix_fmt != AV_PIX_FMT_VAAPI_VLD || p_sys)
return VLC_EGENERIC; return VLC_EGENERIC;
......
...@@ -813,13 +813,14 @@ int D3D11OpenCPUConverter( vlc_object_t *obj ) ...@@ -813,13 +813,14 @@ int D3D11OpenCPUConverter( vlc_object_t *obj )
picture_resource_t res; picture_resource_t res;
res.pf_destroy = DestroyPicture; res.pf_destroy = DestroyPicture;
res.p_sys = calloc(1, sizeof(picture_sys_t)); picture_sys_t *res_sys = calloc(1, sizeof(picture_sys_t));
if (res.p_sys == NULL) { if (res_sys == NULL) {
err = VLC_ENOMEM; err = VLC_ENOMEM;
goto done; goto done;
} }
res.p_sys->context = d3d_dev.d3dcontext; res.p_sys = res_sys;
res.p_sys->formatTexture = texDesc.Format; res_sys->context = d3d_dev.d3dcontext;
res_sys->formatTexture = texDesc.Format;
video_format_Copy(&fmt_staging, &p_filter->fmt_out.video); video_format_Copy(&fmt_staging, &p_filter->fmt_out.video);
fmt_staging.i_chroma = d3d_fourcc; fmt_staging.i_chroma = d3d_fourcc;
...@@ -849,7 +850,7 @@ int D3D11OpenCPUConverter( vlc_object_t *obj ) ...@@ -849,7 +850,7 @@ int D3D11OpenCPUConverter( vlc_object_t *obj )
goto done; goto done;
} }
res.p_sys->texture[KNOWN_DXGI_INDEX] = texture; res_sys->texture[KNOWN_DXGI_INDEX] = texture;
ID3D11DeviceContext_AddRef(p_dst_sys->context); ID3D11DeviceContext_AddRef(p_dst_sys->context);
if ( p_filter->fmt_in.video.i_chroma != d3d_fourcc ) if ( p_filter->fmt_in.video.i_chroma != d3d_fourcc )
......
...@@ -412,11 +412,12 @@ int D3D9OpenCPUConverter( vlc_object_t *obj ) ...@@ -412,11 +412,12 @@ int D3D9OpenCPUConverter( vlc_object_t *obj )
{ {
picture_resource_t res; picture_resource_t res;
res.pf_destroy = DestroyPicture; res.pf_destroy = DestroyPicture;
res.p_sys = calloc(1, sizeof(picture_sys_t)); picture_sys_t *res_sys = calloc(1, sizeof(picture_sys_t));
if (res.p_sys == NULL) { if (res_sys == NULL) {
err = VLC_ENOMEM; err = VLC_ENOMEM;
goto done; goto done;
} }
res.p_sys = res_sys;
video_format_Copy(&fmt_staging, &p_filter->fmt_out.video); video_format_Copy(&fmt_staging, &p_filter->fmt_out.video);
fmt_staging.i_chroma = texDesc.Format; fmt_staging.i_chroma = texDesc.Format;
...@@ -441,7 +442,7 @@ int D3D9OpenCPUConverter( vlc_object_t *obj ) ...@@ -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 ); 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; goto done;
} }
res.p_sys->surface = texture; res_sys->surface = texture;
IDirect3DSurface9_AddRef(texture); IDirect3DSurface9_AddRef(texture);
p_cpu_filter = CreateFilter(VLC_OBJECT(p_filter), &p_filter->fmt_in, p_dst->format.i_chroma); p_cpu_filter = CreateFilter(VLC_OBJECT(p_filter), &p_filter->fmt_in, p_dst->format.i_chroma);
......
...@@ -30,12 +30,13 @@ ...@@ -30,12 +30,13 @@
/* Think twice before changing this. Incorrect values cause havoc. */ /* Think twice before changing this. Incorrect values cause havoc. */
#define NUM_ACTUAL_OPAQUE_BUFFERS 30 #define NUM_ACTUAL_OPAQUE_BUFFERS 30
struct picture_sys_t { typedef struct
{
vlc_object_t *owner; vlc_object_t *owner;
MMAL_BUFFER_HEADER_T *buffer; MMAL_BUFFER_HEADER_T *buffer;
bool displayed; bool displayed;
}; } picture_sys_t;
int mmal_picture_lock(picture_t *picture); int mmal_picture_lock(picture_t *picture);
......
...@@ -544,11 +544,11 @@ struct pic_sys_vaapi_instance ...@@ -544,11 +544,11 @@ struct pic_sys_vaapi_instance
VASurfaceID render_targets[]; VASurfaceID render_targets[];
}; };
struct picture_sys_t typedef struct
{ {
struct pic_sys_vaapi_instance *instance; struct pic_sys_vaapi_instance *instance;
struct vaapi_pic_ctx ctx; struct vaapi_pic_ctx ctx;
}; } picture_sys_t;
static void static void
pool_pic_destroy_cb(picture_t *pic) pool_pic_destroy_cb(picture_t *pic)
...@@ -685,17 +685,18 @@ error: ...@@ -685,17 +685,18 @@ error:
} }
unsigned unsigned
vlc_vaapi_PicSysGetRenderTargets(picture_sys_t *sys, vlc_vaapi_PicSysGetRenderTargets(void *_sys, VASurfaceID **render_targets)
VASurfaceID **render_targets)
{ {
picture_sys_t *sys = (picture_sys_t *)_sys;
assert(sys && sys->instance); assert(sys && sys->instance);
*render_targets = sys->instance->render_targets; *render_targets = sys->instance->render_targets;
return sys->instance->num_render_targets; return sys->instance->num_render_targets;
} }
struct vlc_vaapi_instance * 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); assert(sys->instance != NULL);
*dpy = vlc_vaapi_HoldInstance(sys->instance->va_inst); *dpy = vlc_vaapi_HoldInstance(sys->instance->va_inst);
return sys->instance->va_inst; return sys->instance->va_inst;
......
...@@ -201,12 +201,11 @@ vlc_vaapi_PoolNew(vlc_object_t *o, struct vlc_vaapi_instance *vainst, ...@@ -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 /* Get render targets from a pic_sys allocated by the vaapi pool (see
* vlc_vaapi_PoolNew()) */ * vlc_vaapi_PoolNew()) */
unsigned unsigned
vlc_vaapi_PicSysGetRenderTargets(picture_sys_t *sys, vlc_vaapi_PicSysGetRenderTargets(void *sys, VASurfaceID **render_targets);
VASurfaceID **render_targets);
/* Get and hold the VADisplay instance attached to the picture sys */ /* Get and hold the VADisplay instance attached to the picture sys */
struct vlc_vaapi_instance * 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 /* Attachs the VASurface to the picture context, the picture must be allocated
* by a vaapi pool (see vlc_vaapi_PoolNew()) */ * by a vaapi pool (see vlc_vaapi_PoolNew()) */
......
...@@ -256,13 +256,13 @@ bool vlc_fourcc_to_vdp_ycc(vlc_fourcc_t fourcc, ...@@ -256,13 +256,13 @@ bool vlc_fourcc_to_vdp_ycc(vlc_fourcc_t fourcc,
return true; return true;
} }
struct picture_sys_t typedef struct
{ {
VdpOutputSurface surface; VdpOutputSurface surface;
VdpDevice device; VdpDevice device;
vdp_t *vdp; vdp_t *vdp;
void *gl_nv_surface; void *gl_nv_surface;
}; } picture_sys_t;
typedef struct vlc_vdp_video_frame typedef struct vlc_vdp_video_frame
{ {
......
...@@ -55,7 +55,7 @@ typedef struct ...@@ -55,7 +55,7 @@ typedef struct
} d3d11_handle_t; } d3d11_handle_t;
/* owned by the vout for VLC_CODEC_D3D11_OPAQUE */ /* 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 */ ID3D11VideoDecoderOutputView *decoder; /* may be NULL for pictures from the pool */
union { union {
...@@ -68,7 +68,7 @@ struct picture_sys_t ...@@ -68,7 +68,7 @@ struct picture_sys_t
ID3D11VideoProcessorOutputView *processorOutput; /* when used as processor output */ ID3D11VideoProcessorOutputView *processorOutput; /* when used as processor output */
ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW]; ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW];
DXGI_FORMAT formatTexture; DXGI_FORMAT formatTexture;
}; } picture_sys_t;
#include "../codec/avcodec/va_surface.h" #include "../codec/avcodec/va_surface.h"
......
...@@ -32,13 +32,13 @@ ...@@ -32,13 +32,13 @@
#include "dxgi_fmt.h" #include "dxgi_fmt.h"
/* owned by the vout for VLC_CODEC_D3D9_OPAQUE */ /* owned by the vout for VLC_CODEC_D3D9_OPAQUE */
struct picture_sys_t typedef struct
{ {
IDirect3DSurface9 *surface; IDirect3DSurface9 *surface;
/* decoder only */ /* decoder only */
IDirectXVideoDecoder *decoder; /* keep a reference while the surface exist */ IDirectXVideoDecoder *decoder; /* keep a reference while the surface exist */
HINSTANCE dxva2_dll; HINSTANCE dxva2_dll;
}; } picture_sys_t;
typedef struct typedef struct
{ {
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <vlc_vout_display.h> #include <vlc_vout_display.h>
#include <android/native_window.h> #include <android/native_window.h>
struct picture_sys_t typedef struct
{ {
union { union {
struct { struct {
...@@ -59,7 +59,7 @@ struct picture_sys_t ...@@ -59,7 +59,7 @@ struct picture_sys_t
} sw; } sw;
}; };
bool b_locked; bool b_locked;
}; } picture_sys_t;
static inline void static inline void
AndroidOpaquePicture_DetachDecoder(picture_sys_t *p_picsys) AndroidOpaquePicture_DetachDecoder(picture_sys_t *p_picsys)
......
...@@ -105,10 +105,10 @@ struct vout_display_sys_t ...@@ -105,10 +105,10 @@ struct vout_display_sys_t
bool is_on_top; bool is_on_top;
}; };
struct picture_sys_t typedef struct
{ {
int i_chroma_shift; int i_chroma_shift;
}; } picture_sys_t;
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
#endif #endif
#define PBO_DISPLAY_COUNT 2 /* Double buffering */ #define PBO_DISPLAY_COUNT 2 /* Double buffering */
struct picture_sys_t typedef struct
{ {
vlc_gl_t *gl; vlc_gl_t *gl;
PFNGLDELETEBUFFERSPROC DeleteBuffers; PFNGLDELETEBUFFERSPROC DeleteBuffers;
...@@ -76,7 +76,7 @@ struct picture_sys_t ...@@ -76,7 +76,7 @@ struct picture_sys_t
size_t bytes[PICTURE_PLANE_MAX]; size_t bytes[PICTURE_PLANE_MAX];
GLsync fence; GLsync fence;
unsigned index; unsigned index;
}; } picture_sys_t;
struct priv struct priv
{ {
......
...@@ -81,9 +81,10 @@ vlc_module_end() ...@@ -81,9 +81,10 @@ vlc_module_end()
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
struct picture_sys_t { typedef struct
{
void *id; void *id;
}; } picture_sys_t;
/* NOTE: the callback prototypes must match those of LibVLC */ /* NOTE: the callback prototypes must match those of LibVLC */
struct vout_display_sys_t { struct vout_display_sys_t {
......
...@@ -178,7 +178,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req) ...@@ -178,7 +178,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
if (buf == NULL) if (buf == NULL)
break; break;
res.p_sys = (picture_sys_t *)buf; res.p_sys = buf;
res.p[0].p_pixels = base; res.p[0].p_pixels = base;
base = ((char *)base) + picsize; base = ((char *)base) + picsize;
offset += picsize; offset += picsize;
......
...@@ -123,11 +123,12 @@ vlc_module_end() ...@@ -123,11 +123,12 @@ vlc_module_end()
* Local prototypes. * Local prototypes.
*****************************************************************************/ *****************************************************************************/
struct picture_sys_t { typedef struct
{
LPDIRECTDRAWSURFACE2 surface; LPDIRECTDRAWSURFACE2 surface;
LPDIRECTDRAWSURFACE2 front_surface; LPDIRECTDRAWSURFACE2 front_surface;
picture_t *fallback; picture_t *fallback;
}; } picture_sys_t;
struct vout_display_sys_t struct vout_display_sys_t
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment