[vlc-commits] d3d11va: clean error checking on Open
Steve Lhomme
git at videolan.org
Fri Oct 25 10:57:53 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Oct 25 10:49:35 2019 +0200| [a02408a16f6334fd032ece35c692d90775127990] | committer: Steve Lhomme
d3d11va: clean error checking on Open
Avoid all the code indentation.
No functional changes.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a02408a16f6334fd032ece35c692d90775127990
---
modules/codec/avcodec/d3d11va.c | 37 ++++++++++++++++---------------------
1 file changed, 16 insertions(+), 21 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 7a6f762fe9..d6cb7d6910 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -279,30 +279,15 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *des
sys->render = DXGI_FORMAT_UNKNOWN;
HRESULT hr = D3D11_CreateDeviceExternal(va, d3d11_device->device, true, &sys->d3d_dev);
if (FAILED(hr))
- msg_Err(va, "can't use the provided D3D11 context");
- else
{
- if (sys->d3d_dev.context_mutex == INVALID_HANDLE_VALUE)
- msg_Warn(va, "No mutex found to lock the decoder");
-
- sys->vctx = vlc_video_context_Create( dec_device, VLC_VIDEO_CONTEXT_D3D11VA, sizeof(d3d11_video_context_t), &d3d11_vctx_ops );
- if (likely(sys->vctx != NULL))
- {
- void *d3dvidctx = NULL;
- hr = ID3D11DeviceContext_QueryInterface(sys->d3d_dev.d3dcontext, &IID_ID3D11VideoContext, &d3dvidctx);
- if (FAILED(hr)) {
- msg_Err(va, "Could not Query ID3D11VideoContext Interface from the picture. (hr=0x%lX)", hr);
- D3D11_ReleaseDevice(&sys->d3d_dev);
- vlc_video_context_Release( sys->vctx );
- sys->vctx = NULL;
- /* TODO we can try all adapters to see if there's one that can decode */
- goto error;
- }
-
- sys->hw.video_context = d3dvidctx;
- }
+ msg_Err(va, "can't use the provided D3D11 context");
+ goto error;
}
+ if (sys->d3d_dev.context_mutex == INVALID_HANDLE_VALUE)
+ msg_Warn(va, "No mutex found to lock the decoder");
+ sys->vctx = vlc_video_context_Create( dec_device, VLC_VIDEO_CONTEXT_D3D11VA,
+ sizeof(d3d11_video_context_t), &d3d11_vctx_ops );
if (sys->vctx == NULL)
{
msg_Dbg(va, "no video context");
@@ -310,6 +295,16 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *des
goto error;
}
+ void *d3dvidctx = NULL;
+ hr = ID3D11DeviceContext_QueryInterface(sys->d3d_dev.d3dcontext, &IID_ID3D11VideoContext, &d3dvidctx);
+ if (FAILED(hr)) {
+ msg_Err(va, "Could not Query ID3D11VideoContext Interface from the picture. (hr=0x%lX)", hr);
+ D3D11_ReleaseDevice(&sys->d3d_dev);
+ // TODO we can try all adapters to see if there's one that can decode
+ goto error;
+ }
+ sys->hw.video_context = d3dvidctx;
+
d3d11_video_context_t *priv = GetD3D11ContextPrivate(sys->vctx);
priv->device = sys->d3d_dev.d3dcontext;
ID3D11DeviceContext_Release(priv->device);
More information about the vlc-commits
mailing list