[vlc-devel] [PATCH 3/6] d3d11_fmt: add a helper function to find the actual picture_sys_t to use
Steve Lhomme
robux4 at videolabs.io
Sat Jul 1 18:03:35 CEST 2017
the decoder and filters fill context but the vout uses picture_sys_t by default
---
modules/video_chroma/d3d11_fmt.h | 6 ++++++
modules/video_output/win32/direct3d11.c | 6 ++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index 3fdbad2137..4631da185c 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -50,6 +50,12 @@ struct picture_sys_t
#include "../codec/avcodec/va_surface.h"
+static inline picture_sys_t *ActivePictureSys(picture_t *p_pic)
+{
+ struct va_pic_context *pic_ctx = (struct va_pic_context*)p_pic->context;
+ return pic_ctx ? &pic_ctx->picsys : p_pic->p_sys;
+}
+
/* index to use for texture/resource that use a known DXGI format
* (ie not DXGI_FORMAT_UNKNWON) */
#define KNOWN_DXGI_INDEX 0
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index d1628e6086..d5a4db7106 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1112,8 +1112,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
if( sys->context_lock != INVALID_HANDLE_VALUE )
WaitForSingleObjectEx( sys->context_lock, INFINITE, FALSE );
#endif
- struct va_pic_context *pic_ctx = (struct va_pic_context*)picture->context;
- picture_sys_t *p_sys = pic_ctx ? &pic_ctx->picsys : picture->p_sys;
+ picture_sys_t *p_sys = ActivePictureSys(picture);
if (!is_d3d11_opaque(picture->format.i_chroma) || sys->legacy_shader) {
D3D11_TEXTURE2D_DESC texDesc;
if (!is_d3d11_opaque(picture->format.i_chroma))
@@ -1208,8 +1207,7 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
if (!is_d3d11_opaque(picture->format.i_chroma) || sys->legacy_shader)
DisplayD3DPicture(sys, &sys->picQuad, sys->stagingSys.resourceView);
else {
- struct va_pic_context *pic_ctx = (struct va_pic_context*)picture->context;
- picture_sys_t *p_sys = pic_ctx ? &pic_ctx->picsys : picture->p_sys;
+ picture_sys_t *p_sys = ActivePictureSys(picture);
DisplayD3DPicture(sys, &sys->picQuad, p_sys->resourceView);
}
--
2.13.0
More information about the vlc-devel
mailing list