From 5842e9cf879c8efb03a3e61d833be6627c8ad737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Thu, 15 Feb 2018 19:29:51 +0100 Subject: [PATCH] plugins: add COPY_OUTPUT_FRAME flag This patch add the member copy_output_frame and set it TRUE when when downstream didn't request GstVideoMeta API, the caps are raw and the internal allocator is the VA-API one. https://bugzilla.gnome.org/show_bug.cgi?id=785054 --- gst/vaapi/gstvaapipluginbase.c | 6 ++++++ gst/vaapi/gstvaapipluginbase.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/gst/vaapi/gstvaapipluginbase.c b/gst/vaapi/gstvaapipluginbase.c index 0183579cf1..568c42e7a1 100644 --- a/gst/vaapi/gstvaapipluginbase.c +++ b/gst/vaapi/gstvaapipluginbase.c @@ -1015,6 +1015,12 @@ gst_vaapi_plugin_base_decide_allocation (GstVaapiPluginBase * plugin, g_clear_object (&plugin->srcpad_buffer_pool); plugin->srcpad_buffer_pool = pool; + + /* if downstream doesn't support GstVideoMeta, and the negotiated + * caps are raw video, and the used allocator is the VA-API one, we + * should copy the VA-API frame into a dumb buffer */ + plugin->copy_output_frame = gst_vaapi_video_buffer_pool_copy_buffer (pool); + return TRUE; /* ERRORS */ diff --git a/gst/vaapi/gstvaapipluginbase.h b/gst/vaapi/gstvaapipluginbase.h index 81b5f4eddb..b58fdbea86 100644 --- a/gst/vaapi/gstvaapipluginbase.h +++ b/gst/vaapi/gstvaapipluginbase.h @@ -85,6 +85,8 @@ typedef struct _GstVaapiPluginBaseClass GstVaapiPluginBaseClass; (&GST_VAAPI_PLUGIN_BASE(plugin)->srcpad_info) #define GST_VAAPI_PLUGIN_BASE_SRC_PAD_CAN_DMABUF(plugin) \ (GST_VAAPI_PLUGIN_BASE(plugin)->srcpad_can_dmabuf) +#define GST_VAAPI_PLUGIN_BASE_COPY_OUTPUT_FRAME(plugin) \ + (GST_VAAPI_PLUGIN_BASE(plugin)->copy_output_frame) #define GST_VAAPI_PLUGIN_BASE_DISPLAY(plugin) \ (GST_VAAPI_PLUGIN_BASE(plugin)->display) @@ -147,8 +149,10 @@ struct _GstVaapiPluginBase gboolean srcpad_can_dmabuf; gboolean enable_direct_rendering; + GstAllocator *other_srcpad_allocator; GstAllocationParams other_allocator_params; + gboolean copy_output_frame; }; struct _GstVaapiPluginBaseClass