[vlc-commits] directx_va: pass the decoder surface via the returned vlc_va_surface_t
Steve Lhomme
git at videolan.org
Tue Jun 13 15:00:56 CEST 2017
vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Mon May 29 14:40:37 2017 +0200| [51af7cf65ace39b9834972c37da8a4b34547b8e2] | committer: Jean-Baptiste Kempf
directx_va: pass the decoder surface via the returned vlc_va_surface_t
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=51af7cf65ace39b9834972c37da8a4b34547b8e2
---
modules/codec/avcodec/d3d11va.c | 6 ++++--
modules/codec/avcodec/directx_va.c | 4 ++--
modules/codec/avcodec/directx_va.h | 3 ++-
modules/codec/avcodec/dxva2.c | 7 +++++--
4 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 213b5d4ae9..fa2461a6bc 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -246,9 +246,10 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
if (p_sys == NULL)
{
assert(!va->sys->b_extern_pool);
- vlc_va_surface_t *va_surface = directx_va_Get(va, &va->sys->dx_sys, data);
+ vlc_va_surface_t *va_surface = directx_va_Get(va, &va->sys->dx_sys);
if (!va_surface)
return VLC_EGENERIC;
+ *data = va_surface->decoderSurface;
pic->p_sys = va_surface->p_pic->p_sys;
pic->p_sys->va_surface = va_surface;
return VLC_SUCCESS;
@@ -283,9 +284,10 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
*data = p_sys->decoder;
return VLC_SUCCESS;
#endif
- vlc_va_surface_t *va_surface = directx_va_Get(va, &va->sys->dx_sys, data);
+ vlc_va_surface_t *va_surface = directx_va_Get(va, &va->sys->dx_sys);
if (!va_surface)
return VLC_EGENERIC;
+ *data = va_surface->decoderSurface;
pic->p_sys = va_surface->p_pic->p_sys;
pic->p_sys->va_surface = va_surface;
return VLC_SUCCESS;
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index a5a7783d28..00b1956055 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -390,7 +390,7 @@ void DestroyVideoDecoder(vlc_va_t *va, directx_sys_t *dx_sys)
}
/* FIXME it is nearly common with VAAPI */
-vlc_va_surface_t *directx_va_Get(vlc_va_t *va, directx_sys_t *dx_sys, uint8_t **data)
+vlc_va_surface_t *directx_va_Get(vlc_va_t *va, directx_sys_t *dx_sys)
{
/* Check the device */
if (dx_sys->pf_check_device(va)!=VLC_SUCCESS)
@@ -421,7 +421,7 @@ vlc_va_surface_t *directx_va_Get(vlc_va_t *va, directx_sys_t *dx_sys, uint8_t **
surface->refcount = 1;
surface->order = ++dx_sys->surface_order;
- *data = (void *)dx_sys->hw_surface[i];
+ surface->decoderSurface = dx_sys->hw_surface[i];
vlc_mutex_unlock( &dx_sys->surface_lock );
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index 1a6640470c..02acddba70 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -47,6 +47,7 @@ typedef struct {
unsigned int order;
vlc_mutex_t *p_lock;
picture_t *p_pic;
+ D3D_DecoderSurface *decoderSurface;
} vlc_va_surface_t;
typedef struct input_list_t {
@@ -135,7 +136,7 @@ typedef struct
int directx_va_Open(vlc_va_t *, directx_sys_t *, AVCodecContext *ctx, const es_format_t *fmt, bool b_dll);
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);
+vlc_va_surface_t *directx_va_Get(vlc_va_t *, directx_sys_t *);
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);
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 74ee567466..46e8c6bdc8 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -224,9 +224,12 @@ static int CheckDevice(vlc_va_t *va)
static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
{
- vlc_va_surface_t *va_surface = directx_va_Get(va, &va->sys->dx_sys, data);
+ vlc_va_surface_t *va_surface = directx_va_Get(va, &va->sys->dx_sys);
+ if (unlikely(va_surface==NULL))
+ return VLC_EGENERIC;
+ *data = (uint8_t*)va_surface->decoderSurface;
pic->p_sys->va_surface = va_surface;
- return va_surface ? VLC_SUCCESS : VLC_EGENERIC;
+ return VLC_SUCCESS;
}
static void Close(vlc_va_t *va, AVCodecContext *ctx)
More information about the vlc-commits
mailing list