[vlc-commits] libvlc: fix union in output callback device config
Steve Lhomme
git at videolan.org
Wed Feb 12 17:09:09 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Feb 12 10:05:38 2020 +0100| [6bba90162f0d1e62c8768dec49b6d33232eb2aee] | committer: Steve Lhomme
libvlc: fix union in output callback device config
For Direct3D9 we actually need both fields
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6bba90162f0d1e62c8768dec49b6d33232eb2aee
---
doc/libvlc/d3d11_player.cpp | 2 +-
doc/libvlc/d3d9_player.c | 4 ++--
include/vlc/libvlc_media_player.h | 9 +++++++--
modules/hw/d3d11/d3d11_device.c | 4 ++--
modules/hw/d3d9/d3d9_device.c | 6 +++---
5 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/doc/libvlc/d3d11_player.cpp b/doc/libvlc/d3d11_player.cpp
index 97e1dbd97a..946cfdb323 100644
--- a/doc/libvlc/d3d11_player.cpp
+++ b/doc/libvlc/d3d11_player.cpp
@@ -455,7 +455,7 @@ static bool Setup_cb( void **opaque, const libvlc_video_setup_device_cfg_t *cfg,
init_direct3d(ctx);
- out->device_context = ctx->d3dctxVLC;
+ out->d3d11.device_context = ctx->d3dctxVLC;
return true;
}
diff --git a/doc/libvlc/d3d9_player.c b/doc/libvlc/d3d9_player.c
index 4b925df52a..ad4f6736d6 100644
--- a/doc/libvlc/d3d9_player.c
+++ b/doc/libvlc/d3d9_player.c
@@ -203,8 +203,8 @@ static void release_direct3d(struct render_context *ctx)
static bool Setup_cb( void **opaque, const libvlc_video_setup_device_cfg_t *cfg, libvlc_video_setup_device_info_t *out )
{
struct render_context *ctx = *opaque;
- out->device_context = ctx->d3d;
- out->adapter = D3DADAPTER_DEFAULT;
+ out->d3d9.device = ctx->d3d;
+ out->d3d9.adapter = D3DADAPTER_DEFAULT;
return true;
}
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 17c8690442..d93837d50e 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -511,8 +511,13 @@ typedef struct
typedef struct
{
union {
- void *device_context; /** ID3D11DeviceContext* for D3D11, IDirect3D9 * for D3D9 */
- int adapter; /** Adapter to use with the IDirect3D9 for D3D9 */
+ struct {
+ void *device_context; /** ID3D11DeviceContext* */
+ } d3d11;
+ struct {
+ void *device; /** IDirect3D9* */
+ int adapter; /** Adapter to use with the IDirect3D9* */
+ } d3d9;
};
} libvlc_video_setup_device_info_t;
diff --git a/modules/hw/d3d11/d3d11_device.c b/modules/hw/d3d11/d3d11_device.c
index 88605614df..d5777bc23d 100644
--- a/modules/hw/d3d11/d3d11_device.c
+++ b/modules/hw/d3d11/d3d11_device.c
@@ -102,14 +102,14 @@ static int D3D11OpenDecoderDevice(vlc_decoder_device *device, bool forced, vout_
libvlc_video_setup_device_cfg_t cfg = {
.hardware_decoding = true, /* always favor hardware decoding */
};
- libvlc_video_setup_device_info_t out = { .device_context = NULL };
+ libvlc_video_setup_device_info_t out = { .d3d11.device_context = NULL };
if (!setupDeviceCb( &sys->external.opaque, &cfg, &out ))
{
if (sys->external.cleanupDeviceCb)
sys->external.cleanupDeviceCb( sys->external.opaque );
goto error;
}
- hr = D3D11_CreateDeviceExternal(device, out.device_context, true, &sys->dec_device.d3d_dev);
+ hr = D3D11_CreateDeviceExternal(device, out.d3d11.device_context, true, &sys->dec_device.d3d_dev);
}
else
{
diff --git a/modules/hw/d3d9/d3d9_device.c b/modules/hw/d3d9/d3d9_device.c
index 07b76be9cc..06c78873b6 100644
--- a/modules/hw/d3d9/d3d9_device.c
+++ b/modules/hw/d3d9/d3d9_device.c
@@ -74,7 +74,7 @@ int D3D9OpenDecoderDevice(vlc_decoder_device *device, vout_window_t *wnd)
if ( setupDeviceCb )
{
/* external rendering */
- libvlc_video_setup_device_info_t out = { .device_context = NULL, .adapter = 0 };
+ libvlc_video_setup_device_info_t out = { .d3d9.adapter = 0 };
sys->opaque = var_InheritAddress( device, "vout-cb-opaque" );
sys->cleanupDeviceCb = var_InheritAddress( device, "vout-cb-cleanup" );
libvlc_video_setup_device_cfg_t cfg = {
@@ -87,8 +87,8 @@ int D3D9OpenDecoderDevice(vlc_decoder_device *device, vout_window_t *wnd)
goto error;
}
- D3D9_CloneExternal( &sys->dec_device.hd3d, (IDirect3D9*) out.device_context );
- adapter = out.adapter;
+ D3D9_CloneExternal( &sys->dec_device.hd3d, (IDirect3D9*) out.d3d9.device );
+ adapter = out.d3d9.adapter;
}
else
{
More information about the vlc-commits
mailing list