vlc | branch: master | Steve Lhomme <[email protected]> | Fri Sep 20 14:13:48 2019 +0200| [4f9eb8a1d29d20f6792b41b43960894f108dee43] | committer: Steve Lhomme
dxva2: use the decoder device to init the D3D9 device rather than the picture_sys > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4f9eb8a1d29d20f6792b41b43960894f108dee43 --- modules/codec/avcodec/dxva2.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index 60cc2b506b..7576a62f70 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -269,25 +269,25 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *des if (unlikely(sys == NULL)) return VLC_ENOMEM; /* Load dll*/ - picture_sys_d3d9_t *p_sys = picsys; - if (p_sys!=NULL && p_sys->surface!=NULL) + d3d9_decoder_device_t *d3d9_decoder = GetD3D9OpaqueDevice( dec_device ); + if ( d3d9_decoder != NULL ) { - IDirect3DDevice9 *device; - if ( FAILED(IDirect3DSurface9_GetDevice( p_sys->surface, &device )) ) + D3D9_CloneExternal(&sys->hd3d, d3d9_decoder->device); + HRESULT hr = D3D9_CreateDevice(va, &sys->hd3d, d3d9_decoder->adapter, &sys->d3d_dev); + if ( FAILED(hr) ) { + D3D9_Destroy(&sys->hd3d); free( sys ); return VLC_EGENERIC; } - if ( D3D9_CreateExternal(&sys->hd3d, device) != VLC_SUCCESS || - FAILED(D3D9_CreateDeviceExternal( device, &sys->hd3d, &sys->d3d_dev)) ) + if (picsys != NULL) { - IDirect3DDevice9_Release(device); - free( sys ); - return VLC_EGENERIC; + picture_sys_d3d9_t *p_sys = picsys; + /* TODO this will go away in push, we decide the decoding format */ + D3DSURFACE_DESC src; + if (SUCCEEDED(IDirect3DSurface9_GetDesc(p_sys->surface, &src))) + sys->render = src.Format; } - D3DSURFACE_DESC src; - if (SUCCEEDED(IDirect3DSurface9_GetDesc(p_sys->surface, &src))) - sys->render = src.Format; } else if (D3D9_Create(va, &sys->hd3d) != VLC_SUCCESS) { msg_Warn(va, "cannot load d3d9.dll"); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
