Commit 73066b64 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

dxva: don't store the surface in the picture context

it's an old hack we don't need with picture_sys_t.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 79d7926a
......@@ -179,7 +179,7 @@ static int Extract(vlc_va_t *va, picture_t *output, uint8_t *data)
{
vlc_va_sys_t *sys = va->sys;
ID3D11VideoDecoderOutputView *src = (ID3D11VideoDecoderOutputView*)(uintptr_t)data;
vlc_va_surface_t *surface = output->context; /* when coming from our local pool */
vlc_va_surface_t *surface = output->p_sys->va_surface;
int ret = VLC_SUCCESS;
picture_sys_t *p_sys_out = surface ? surface->p_pic->p_sys : output->p_sys;
......@@ -300,8 +300,11 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
{
assert(!va->sys->b_extern_pool);
vlc_va_surface_t *va_surface = directx_va_Get(va, &va->sys->dx_sys, data);
pic->context = va_surface;
return va_surface ? VLC_SUCCESS : VLC_EGENERIC;
if (!va_surface)
return VLC_EGENERIC;
pic->p_sys = va_surface->p_pic->p_sys;
pic->p_sys->va_surface = va_surface;
return VLC_SUCCESS;
}
if (p_sys->decoder == NULL)
......@@ -332,11 +335,13 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
return VLC_EGENERIC;
*data = p_sys->decoder;
return VLC_SUCCESS;
#else
vlc_va_surface_t *va_surface = directx_va_Get(va, &va->sys->dx_sys, data);
pic->context = va_surface;
return va_surface ? VLC_SUCCESS : VLC_EGENERIC;
#endif
vlc_va_surface_t *va_surface = directx_va_Get(va, &va->sys->dx_sys, data);
if (!va_surface)
return VLC_EGENERIC;
pic->p_sys = va_surface->p_pic->p_sys;
pic->p_sys->va_surface = va_surface;
return VLC_SUCCESS;
}
static void Close(vlc_va_t *va, AVCodecContext *ctx)
......@@ -371,8 +376,8 @@ static void ReleasePic(void *opaque, uint8_t *data)
{
(void)data;
picture_t *pic = opaque;
directx_va_Release(pic->context);
pic->context = NULL;
directx_va_Release(pic->p_sys->va_surface);
pic->p_sys->va_surface = NULL;
picture_Release(pic);
}
......
......@@ -221,7 +221,7 @@ 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);
pic->context = va_surface;
pic->p_sys->va_surface = va_surface;
return va_surface ? VLC_SUCCESS : VLC_EGENERIC;
}
......@@ -258,8 +258,8 @@ static void ReleasePic(void *opaque, uint8_t *data)
{
(void)data;
picture_t *pic = opaque;
directx_va_Release(pic->context);
pic->context = NULL;
directx_va_Release(pic->p_sys->va_surface);
pic->p_sys->va_surface = NULL;
picture_Release(pic);
}
......
......@@ -42,6 +42,7 @@ struct picture_sys_t
ID3D11VideoProcessorInputView *processorInput; /* when used as processor input */
ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW];
DXGI_FORMAT formatTexture;
void *va_surface;
};
/* index to use for texture/resource that use a known DXGI format
......
......@@ -27,6 +27,7 @@
struct picture_sys_t
{
LPDIRECT3DSURFACE9 surface;
void *va_surface;
};
static inline void ReleasePictureSys(picture_sys_t *p_sys)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment