[vlc-devel] [PATCH 08/39] directx_va: add a way to lock/unlock a surface

Steve Lhomme robux4 at videolabs.io
Fri Jun 2 16:46:11 CEST 2017


The surface may not be used by the decoder but still being used for display/filter.
---
 modules/codec/avcodec/directx_va.c | 7 +++++++
 modules/codec/avcodec/directx_va.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index f3c2e17980..190eb8589c 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -414,6 +414,13 @@ vlc_va_surface_t *directx_va_Get(vlc_va_t *va, directx_sys_t *dx_sys, uint8_t **
     return surface;
 }
 
+void directx_va_AddRef(vlc_va_surface_t *surface)
+{
+    vlc_mutex_lock( surface->p_lock );
+    surface->refcount++;
+    vlc_mutex_unlock( surface->p_lock );
+}
+
 void directx_va_Release(vlc_va_surface_t *surface)
 {
     vlc_mutex_lock( surface->p_lock );
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index a7e20d39ea..8bc296550e 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -138,6 +138,7 @@ int directx_va_Open(vlc_va_t *, directx_sys_t *, AVCodecContext *ctx, const es_f
 void directx_va_Close(vlc_va_t *, directx_sys_t *);
 int directx_va_Setup(vlc_va_t *, directx_sys_t *, AVCodecContext *avctx);
 vlc_va_surface_t *directx_va_Get(vlc_va_t *, directx_sys_t *, uint8_t **data);
+void directx_va_AddRef(vlc_va_surface_t *surface);
 void directx_va_Release(vlc_va_surface_t *surface);
 char *directx_va_GetDecoderName(const GUID *guid);
 
-- 
2.12.1



More information about the vlc-devel mailing list