Commit 41f17efe authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

va: pass hwaccel_context rather than AVCodecContext

(Eventually, we should remove this extra parameter altogether.)
parent 04ee03f2
......@@ -58,7 +58,7 @@
static int Open(vlc_va_t *, AVCodecContext *, enum PixelFormat,
const es_format_t *, picture_sys_t *p_sys);
static void Close(vlc_va_t *, AVCodecContext *);
static void Close(vlc_va_t *, void *);
vlc_module_begin()
set_description(N_("Direct3D11 Video Acceleration"))
......@@ -326,7 +326,7 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
return VLC_SUCCESS;
}
static void Close(vlc_va_t *va, AVCodecContext *ctx)
static void Close(vlc_va_t *va, void *ctx)
{
vlc_va_sys_t *sys = va->sys;
......
......@@ -46,7 +46,7 @@
static int Open(vlc_va_t *, AVCodecContext *, enum PixelFormat,
const es_format_t *, picture_sys_t *p_sys);
static void Close(vlc_va_t *, AVCodecContext *);
static void Close(vlc_va_t *, void *);
vlc_module_begin()
set_description(N_("DirectX Video Acceleration (DXVA) 2.0"))
......
......@@ -109,10 +109,10 @@ static int vlc_va_Start(void *func, va_list ap)
static void vlc_va_Stop(void *func, va_list ap)
{
vlc_va_t *va = va_arg(ap, vlc_va_t *);
AVCodecContext *ctx = va_arg(ap, AVCodecContext *);
void (*close)(vlc_va_t *, AVCodecContext *) = func;
void *hwctx = va_arg(ap, void *);
void (*close)(vlc_va_t *, void *) = func;
close(va, ctx);
close(va, hwctx);
}
vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *avctx,
......@@ -146,8 +146,8 @@ vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *avctx,
return va;
}
void vlc_va_Delete(vlc_va_t *va, AVCodecContext *avctx)
void vlc_va_Delete(vlc_va_t *va, void *hwctx)
{
vlc_module_unload(va->module, vlc_va_Stop, va, avctx);
vlc_module_unload(va->module, vlc_va_Stop, va, hwctx);
vlc_object_release(va);
}
......@@ -117,6 +117,6 @@ static inline int vlc_va_Extract(vlc_va_t *va, picture_t *pic, uint8_t *data)
* Destroys a libavcodec hardware acceleration back-end.
* All allocated surfaces shall have been released beforehand.
*/
void vlc_va_Delete(vlc_va_t *, AVCodecContext *);
void vlc_va_Delete(vlc_va_t *, void *);
#endif
......@@ -144,12 +144,12 @@ static int GetDR(vlc_va_t *va, picture_t *pic, uint8_t **data)
return VLC_SUCCESS;
}
static void DeleteDR(vlc_va_t *va, AVCodecContext *avctx)
static void DeleteDR(vlc_va_t *va, void *hwctx)
{
vlc_va_sys_t *sys = va->sys;
vlc_object_t *o = VLC_OBJECT(va);
(void) avctx;
(void) hwctx;
vlc_vaapi_DestroyContext(o, sys->hw_ctx.display, sys->hw_ctx.context_id);
vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
......@@ -253,12 +253,12 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
return VLC_SUCCESS;
}
static void Delete(vlc_va_t *va, AVCodecContext *avctx)
static void Delete(vlc_va_t *va, void *hwctx)
{
vlc_va_sys_t *sys = va->sys;
vlc_object_t *o = VLC_OBJECT(va);
(void) avctx;
(void) hwctx;
picture_pool_Release(sys->pool);
vlc_vaapi_DestroyContext(o, sys->hw_ctx.display, sys->hw_ctx.context_id);
vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
......
......@@ -1220,7 +1220,7 @@ void EndVideoDec( decoder_t *p_dec )
ffmpeg_CloseCodec( p_dec );
if( p_sys->p_va )
vlc_va_Delete( p_sys->p_va, p_sys->p_context );
vlc_va_Delete( p_sys->p_va, p_sys->p_context->hwaccel_context );
vlc_sem_destroy( &p_sys->sem_mt );
}
......
......@@ -213,14 +213,14 @@ error:
return VLC_EGENERIC;
}
static void Close(vlc_va_t *va, AVCodecContext *avctx)
static void Close(vlc_va_t *va, void *hwctx)
{
vlc_va_sys_t *sys = va->sys;
for (unsigned i = 0; sys->pool[i] != NULL; i++)
vlc_vdp_video_destroy(sys->pool[i]);
vdp_release_x11(sys->vdp);
av_freep(&avctx->hwaccel_context);
av_free(hwctx);
free(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