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;
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;
......
......@@ -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
......
......@@ -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"
......
......@@ -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))
......
......@@ -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.
......
......@@ -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"
......
......@@ -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 */
......@@ -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;
......
......@@ -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 )
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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()) */
......
......@@ -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
{
......
......@@ -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"
......
......@@ -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
{
......
......@@ -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)
......
......@@ -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
......
......@@ -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
{
......
......@@ -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 {
......
......@@ -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;
......
......@@ -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
{
......
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