summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2018-02-20 02:25:13 +0100
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2018-02-20 10:57:12 -0600
commitbcc480b70e18eb5c1768aad5a8c28c2bfb9526a6 (patch)
tree820c4b5bbad6ea7603ef89af6112d9ad9d4144b0
parentad705cc5a3d45e70d2b1cb71698ebafe3c91cdc8 (diff)
vaapibufferpool: add gst_vaapi_video_buffer_pool_copy_buffer()
This function will inform the element if it shall copy the generated buffer by the pool to a system allocated buffer before pushing it to downstream. https://bugzilla.gnome.org/show_bug.cgi?id=785054
-rw-r--r--gst/vaapi/gstvaapivideobufferpool.c24
-rw-r--r--gst/vaapi/gstvaapivideobufferpool.h4
2 files changed, 28 insertions, 0 deletions
diff --git a/gst/vaapi/gstvaapivideobufferpool.c b/gst/vaapi/gstvaapivideobufferpool.c
index 812893ba16..51539e278c 100644
--- a/gst/vaapi/gstvaapivideobufferpool.c
+++ b/gst/vaapi/gstvaapivideobufferpool.c
@@ -49,6 +49,7 @@ struct _GstVaapiVideoBufferPoolPrivate
GstVaapiDisplay *display;
guint options;
guint use_dmabuf_memory:1;
+ guint forced_video_meta:1;
};
#define GST_VAAPI_VIDEO_BUFFER_POOL_GET_PRIVATE(obj) \
@@ -257,6 +258,7 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool,
GST_VIDEO_INFO_PLANE_STRIDE (&new_allocation_vinfo, i) !=
GST_VIDEO_INFO_PLANE_STRIDE (&priv->vmeta_vinfo, i)) {
priv->options |= GST_VAAPI_VIDEO_BUFFER_POOL_OPTION_VIDEO_META;
+ priv->forced_video_meta = TRUE;
GST_INFO_OBJECT (pool, "adding unrequested video meta");
break;
}
@@ -535,3 +537,25 @@ gst_vaapi_video_buffer_pool_new (GstVaapiDisplay * display)
return g_object_new (GST_VAAPI_TYPE_VIDEO_BUFFER_POOL,
"display", display, NULL);
}
+
+/**
+ * gst_vaapi_video_buffer_pool_copy_buffer:
+ * @pool: a #GstVaapiVideoBufferPool
+ *
+ * Returns if the @pool force set of #GstVideoMeta. If so, the element
+ * should copy the generated buffer by the pool to a system allocated
+ * buffer. Otherwise, downstream could not display correctly the
+ * frame.
+ *
+ * Returns: %TRUE if #GstVideoMeta is forced.
+ **/
+gboolean
+gst_vaapi_video_buffer_pool_copy_buffer (GstBufferPool * pool)
+{
+ GstVaapiVideoBufferPoolPrivate *priv;
+
+ g_return_val_if_fail (GST_VAAPI_IS_VIDEO_BUFFER_POOL (pool), FALSE);
+
+ priv = GST_VAAPI_VIDEO_BUFFER_POOL_GET_PRIVATE (pool);
+ return priv->forced_video_meta;
+}
diff --git a/gst/vaapi/gstvaapivideobufferpool.h b/gst/vaapi/gstvaapivideobufferpool.h
index 9498531649..98be6f848a 100644
--- a/gst/vaapi/gstvaapivideobufferpool.h
+++ b/gst/vaapi/gstvaapivideobufferpool.h
@@ -134,6 +134,10 @@ G_GNUC_INTERNAL
GstBufferPool *
gst_vaapi_video_buffer_pool_new (GstVaapiDisplay * display);
+G_GNUC_INTERNAL
+gboolean
+gst_vaapi_video_buffer_pool_copy_buffer (GstBufferPool * pool);
+
G_END_DECLS
#endif /* GST_VAAPI_VIDEO_BUFFER_POOL_H */