[vlc-devel] [PATCH 33/34] vaapi: filters: set the output video context

Steve Lhomme robux4 at ycbcr.xyz
Fri Nov 8 15:40:37 CET 2019


---
 modules/hw/vaapi/chroma.c  | 6 ++++++
 modules/hw/vaapi/filters.c | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/modules/hw/vaapi/chroma.c b/modules/hw/vaapi/chroma.c
index 96346546302..e8432b14351 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_sys->dec_device, 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;
diff --git a/modules/hw/vaapi/filters.c b/modules/hw/vaapi/filters.c
index c711c962dd0..4e299d4fb85 100644
--- a/modules/hw/vaapi/filters.c
+++ b/modules/hw/vaapi/filters.c
@@ -444,6 +444,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:
@@ -473,6 +475,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