vlc | branch: master | Steve Lhomme <[email protected]> | Fri Sep 20 09:19:19 2019 +0200| [8d2782de726f2f9d96859b863cc2330deb06a656] | committer: Steve Lhomme
d3d11: use a helper to get the proper type of the D3D11 decoder device > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8d2782de726f2f9d96859b863cc2330deb06a656 --- modules/video_chroma/d3d11_fmt.h | 23 +++++++++++++++++++++++ modules/video_output/win32/direct3d11.c | 7 ++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h index 0f2051c2e7..8afe82bd80 100644 --- a/modules/video_chroma/d3d11_fmt.h +++ b/modules/video_chroma/d3d11_fmt.h @@ -23,6 +23,8 @@ #ifndef VLC_VIDEOCHROMA_D3D11_FMT_H_ #define VLC_VIDEOCHROMA_D3D11_FMT_H_ +#include <vlc_codec.h> + #include <d3d11.h> #include <d3dcompiler.h> @@ -96,6 +98,27 @@ static inline bool is_d3d11_opaque(vlc_fourcc_t chroma) chroma == VLC_CODEC_D3D11_OPAQUE_BGRA; } +static inline d3d11_decoder_device_t *GetD3D11OpaqueDevice(vlc_decoder_device *device) +{ + if (device == NULL || device->type != VLC_DECODER_DEVICE_D3D11VA) + return NULL; + return device->opaque; +} + +static inline d3d11_decoder_device_t *GetD3D11OpaqueContext(vlc_video_context *vctx) +{ + vlc_decoder_device *device = vctx ? vctx->device : NULL; + if (unlikely(device == NULL)) + return NULL; + d3d11_decoder_device_t *res = NULL; + if (device->type == VLC_DECODER_DEVICE_D3D11VA) + { + assert(device->opaque != NULL); + res = GetD3D11OpaqueDevice(device); + } + return res; +} + void AcquireD3D11PictureSys(picture_sys_d3d11_t *p_sys); void ReleaseD3D11PictureSys(picture_sys_d3d11_t *p_sys); diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c index 9fa245a5f1..3938f7c176 100644 --- a/modules/video_output/win32/direct3d11.c +++ b/modules/video_output/win32/direct3d11.c @@ -325,12 +325,9 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg, sys->startEndRenderingCb = var_InheritAddress( vd, "vout-cb-make-current" ); sys->selectPlaneCb = var_InheritAddress( vd, "vout-cb-select-plane" ); - d3d11_decoder_device_t *d3d11_decoder = NULL; - if ( context && context->device->type == VLC_DECODER_DEVICE_D3D11VA ) - d3d11_decoder = context->device->opaque; - HRESULT hr; - if (d3d11_decoder && d3d11_decoder->device) + d3d11_decoder_device_t *d3d11_decoder = GetD3D11OpaqueContext(context); + if ( d3d11_decoder == NULL ) { hr = D3D11_CreateDeviceExternal(vd, d3d11_decoder->device, is_d3d11_opaque(vd->source.i_chroma), _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
