[vlc-devel] [PATCH 4/6] d3d9_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:36 CEST 2017


the decoder and filters fill context but the vout uses picture_sys_t by default
---
 modules/video_chroma/d3d9_fmt.h | 6 ++++++
 modules/video_chroma/dxa9.c     | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/modules/video_chroma/d3d9_fmt.h b/modules/video_chroma/d3d9_fmt.h
index eb9a1ac9b5..840ecb56e8 100644
--- a/modules/video_chroma/d3d9_fmt.h
+++ b/modules/video_chroma/d3d9_fmt.h
@@ -33,6 +33,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;
+}
+
 static inline void AcquirePictureSys(picture_sys_t *p_sys)
 {
     IDirect3DSurface9_AddRef(p_sys->surface);
diff --git a/modules/video_chroma/dxa9.c b/modules/video_chroma/dxa9.c
index 611ef9b296..e15ea86b0b 100644
--- a/modules/video_chroma/dxa9.c
+++ b/modules/video_chroma/dxa9.c
@@ -56,7 +56,7 @@ struct filter_sys_t {
 static bool GetLock(filter_t *p_filter, LPDIRECT3DSURFACE9 d3d,
                     D3DLOCKED_RECT *p_lock, D3DSURFACE_DESC *p_desc)
 {
-    if (FAILED( IDirect3DSurface9_GetDesc(d3d, p_desc)))
+    if (unlikely(FAILED( IDirect3DSurface9_GetDesc(d3d, p_desc))))
         return false;
 
     /* */
-- 
2.13.0



More information about the vlc-devel mailing list