[vlc-commits] directx_va: don't keep the directx_sys_t structure
Steve Lhomme
git at videolan.org
Mon Sep 2 15:43:26 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Sep 2 15:24:05 2019 +0200| [43009bdae42d7639eb76e842ad28982bf665f5c6] | committer: Steve Lhomme
directx_va: don't keep the directx_sys_t structure
It's only used for some callbacks on start.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=43009bdae42d7639eb76e842ad28982bf665f5c6
---
modules/codec/avcodec/d3d11va.c | 10 ++--------
modules/codec/avcodec/directx_va.c | 6 +++---
modules/codec/avcodec/directx_va.h | 2 +-
modules/codec/avcodec/dxva2.c | 11 ++---------
4 files changed, 8 insertions(+), 21 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 06ceca5ee7..0bd3bdddae 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -97,7 +97,6 @@ DEFINE_GUID(DXVA2_NoEncrypt, 0x1b81bed0, 0xa0c7, 0x11d3,
struct vlc_va_sys_t
{
- directx_sys_t dx_sys;
UINT totalTextureSlices;
unsigned textureWidth;
unsigned textureHeight;
@@ -307,7 +306,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
const es_format_t *fmt, void *picsys)
{
int err = VLC_EGENERIC;
- directx_sys_t *dx_sys;
ctx->hwaccel_context = NULL;
@@ -335,11 +333,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
if (err != VLC_SUCCESS)
goto error;
- dx_sys = &sys->dx_sys;
-
- dx_sys->pf_get_input_list = DxGetInputList;
- dx_sys->pf_setup_output = DxSetupOutput;
-
va->sys = sys;
sys->d3d_dev.d3ddevice = NULL;
@@ -389,7 +382,8 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
goto error;
video_format_t fmt_out;
- err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt, isXboxHardware(sys->d3d_dev.d3ddevice), &fmt_out, &sys->hw.surface_count, &sys->decoder_guid);
+ static const directx_sys_t dx_sys = { DxGetInputList, DxSetupOutput };
+ err = directx_va_Setup(va, &dx_sys, ctx, fmt, isXboxHardware(sys->d3d_dev.d3ddevice), &fmt_out, &sys->hw.surface_count, &sys->decoder_guid);
if (err != VLC_SUCCESS)
goto error;
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index 656657d9a4..133b457d70 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -263,7 +263,7 @@ static const directx_va_mode_t DXVA_MODES[] = {
{ NULL, NULL, 0, NULL }
};
-static int FindVideoServiceConversion(vlc_va_t *, directx_sys_t *, const es_format_t *, const AVCodecContext *, GUID *found_guid);
+static int FindVideoServiceConversion(vlc_va_t *, const directx_sys_t *, const es_format_t *, const AVCodecContext *, GUID *found_guid);
char *directx_va_GetDecoderName(const GUID *guid)
{
@@ -279,7 +279,7 @@ char *directx_va_GetDecoderName(const GUID *guid)
}
/* */
-int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, const AVCodecContext *avctx,
+int directx_va_Setup(vlc_va_t *va, const directx_sys_t *dx_sys, const AVCodecContext *avctx,
const es_format_t *fmt, int flag_xbox,
video_format_t *fmt_out, unsigned *surfaces, GUID *found_guid)
{
@@ -387,7 +387,7 @@ static bool profile_supported(const directx_va_mode_t *mode, const es_format_t *
/**
* Find the best suited decoder mode GUID and render format.
*/
-static int FindVideoServiceConversion(vlc_va_t *va, directx_sys_t *dx_sys,
+static int FindVideoServiceConversion(vlc_va_t *va, const directx_sys_t *dx_sys,
const es_format_t *fmt, const AVCodecContext *avctx,
GUID *found_guid)
{
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index 298cc09f50..4e94a95a13 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -64,7 +64,7 @@ typedef struct
} directx_sys_t;
-int directx_va_Setup(vlc_va_t *, directx_sys_t *, const AVCodecContext *avctx, const es_format_t *, int flag_xbox,
+int directx_va_Setup(vlc_va_t *, const directx_sys_t *, const AVCodecContext *avctx, const es_format_t *, int flag_xbox,
video_format_t *fmt_out, unsigned *surface_count, GUID *found_guid);
char *directx_va_GetDecoderName(const GUID *guid);
bool directx_va_canUseDecoder(vlc_va_t *, UINT VendorId, UINT DeviceId, const GUID *pCodec, UINT driverBuild);
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index ffcbfef914..c6ecbe40bd 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -106,8 +106,6 @@ static const d3d9_format_t *D3dFindFormat(D3DFORMAT format)
struct vlc_va_sys_t
{
- directx_sys_t dx_sys;
-
/* Direct3D */
d3d9_handle_t hd3d;
d3d9_device_t d3d_dev;
@@ -249,7 +247,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
const es_format_t *fmt, void *picsys)
{
int err = VLC_EGENERIC;
- directx_sys_t *dx_sys;
if (pix_fmt != AV_PIX_FMT_DXVA2_VLD)
return VLC_EGENERIC;
@@ -295,8 +292,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
return VLC_EGENERIC;
}
- dx_sys = &sys->dx_sys;
-
static const struct va_pool_cfg pool_cfg = {
D3dCreateDevice,
D3dDestroyDevice,
@@ -306,9 +301,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
NewSurfacePicContext,
};
- dx_sys->pf_get_input_list = DxGetInputList;
- dx_sys->pf_setup_output = DxSetupOutput;
-
va->sys = sys;
err = va_pool_Open(va, &pool_cfg, &sys->va_pool);
@@ -316,7 +308,8 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
goto error;
video_format_t fmt_out;
- err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt, 0, &fmt_out, &sys->hw.surface_count, &sys->decoder_guid);
+ static const directx_sys_t dx_sys = { DxGetInputList, DxSetupOutput };
+ err = directx_va_Setup(va, &dx_sys, ctx, fmt, 0, &fmt_out, &sys->hw.surface_count, &sys->decoder_guid);
if (err != VLC_SUCCESS)
goto error;
More information about the vlc-commits
mailing list