[vlc-devel] [PATCH 27/31] dxva2: create a video context for the VA
Steve Lhomme
robux4 at ycbcr.xyz
Fri Jul 5 16:20:06 CEST 2019
---
modules/codec/avcodec/dxva2.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 28e6405ab3..63a2d11217 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -274,13 +274,20 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
d3d9_decoder_device_t *d3d9_decoder = GetD3D9OpaqueDevice( dec_device );
if ( d3d9_decoder != NULL )
{
- D3D9_CloneExternal(&sys->hd3d, d3d9_decoder->device);
- HRESULT hr = D3D9_CreateDevice(va, &sys->hd3d, d3d9_decoder->adapter, &sys->d3d_dev);
- if ( FAILED(hr) )
+ vlc_video_context *vctx = vlc_video_context_Create( dec_device, NULL, NULL );
+ if (likely(vctx != NULL))
{
- D3D9_Destroy(&sys->hd3d);
- free( sys );
- goto error;
+ D3D9_CloneExternal(&sys->hd3d, d3d9_decoder->device);
+ HRESULT hr = D3D9_CreateDevice(va, &sys->hd3d, d3d9_decoder->adapter, &sys->d3d_dev);
+ if ( FAILED(hr) )
+ {
+ vlc_video_context_Release(vctx);
+ D3D9_Destroy(&sys->hd3d);
+ free( sys );
+ goto error;
+ }
+
+ *vctx_out = vctx;
}
if (p_sys != NULL)
{
--
2.17.1
More information about the vlc-devel
mailing list