[vlc-commits] vaapi: filters: set the output video context

Steve Lhomme git at videolan.org
Mon Dec 2 13:42:54 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Nov  8 13:40:22 2019 +0100| [e012987229a40dea435f8b922b45f83f106cb38c] | committer: Steve Lhomme

vaapi: filters: set the output video context

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e012987229a40dea435f8b922b45f83f106cb38c
---

 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 1f34d82ab0..62a7b5ebf1 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 48436fba42..0e86004f5e 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);
 }
 



More information about the vlc-commits mailing list