[vlc-devel] [PATCH 21/36] vaapi: filters: set the output video context
Steve Lhomme
robux4 at ycbcr.xyz
Thu Nov 21 15:14:12 CET 2019
---
modules/hw/vaapi/chroma.c | 8 ++++++++
modules/hw/vaapi/filters.c | 3 +++
2 files changed, 11 insertions(+)
diff --git a/modules/hw/vaapi/chroma.c b/modules/hw/vaapi/chroma.c
index 1f34d82ab0d..62a7b5ebf15 100644
--- a/modules/hw/vaapi/chroma.c
+++ b/modules/hw/vaapi/chroma.c
@@ -354,6 +354,8 @@ vlc_vaapi_OpenChroma(vlc_object_t *obj)
return VLC_EGENERIC;
}
+ filter->vctx_out = vlc_video_context_Create( filter_sys->dec_device, VLC_VIDEO_CONTEXT_VAAPI, 0, NULL );
+
filter_sys->dest_pics =
vlc_vaapi_PoolNew(obj, filter->vctx_out, filter_sys->dpy,
DEST_PICS_POOL_SZ, &filter_sys->va_surface_ids,
@@ -361,6 +363,8 @@ vlc_vaapi_OpenChroma(vlc_object_t *obj)
if (!filter_sys->dest_pics)
{
vlc_vaapi_FilterReleaseInstance(filter, filter_sys->dec_device);
+ vlc_video_context_Release(filter->vctx_out);
+ filter->vctx_out = NULL;
free(filter_sys);
return VLC_EGENERIC;
}
@@ -381,6 +385,8 @@ vlc_vaapi_OpenChroma(vlc_object_t *obj)
{
picture_pool_Release(filter_sys->dest_pics);
vlc_vaapi_FilterReleaseInstance(filter, filter_sys->dec_device);
+ vlc_video_context_Release(filter->vctx_out);
+ filter->vctx_out = NULL;
}
free(filter_sys);
return VLC_EGENERIC;
@@ -407,6 +413,8 @@ vlc_vaapi_CloseChroma(vlc_object_t *obj)
if (filter_sys->dec_device != NULL)
vlc_vaapi_FilterReleaseInstance(filter, filter_sys->dec_device);
CopyCleanCache(&filter_sys->cache);
+ if (filter->vctx_out)
+ vlc_video_context_Release(filter->vctx_out);
free(filter_sys);
}
diff --git a/modules/hw/vaapi/filters.c b/modules/hw/vaapi/filters.c
index 48436fba424..0e86004f5e2 100644
--- a/modules/hw/vaapi/filters.c
+++ b/modules/hw/vaapi/filters.c
@@ -441,6 +441,8 @@ Open(filter_t * filter,
pf_use_pipeline_caps(p_data, p_pipeline_caps))
goto error;
+ filter->vctx_out = vlc_video_context_Hold(filter->vctx_in);
+
return VLC_SUCCESS;
error:
@@ -470,6 +472,7 @@ Close(filter_t *filter, filter_sys_t * filter_sys)
vlc_vaapi_DestroyContext(obj, filter_sys->va.dpy, filter_sys->va.ctx);
vlc_vaapi_DestroyConfig(obj, filter_sys->va.dpy, filter_sys->va.conf);
vlc_vaapi_FilterReleaseInstance(filter, filter_sys->va.dec_device);
+ vlc_video_context_Release(filter->vctx_out);
free(filter_sys);
}
--
2.17.1
More information about the vlc-devel
mailing list