summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubosz Sarnecki <lubosz.sarnecki@collabora.co.uk>2015-07-20 14:24:22 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2015-07-20 14:41:12 -0400
commit2fb862b34fbe1f7713381144800f863aad1ef16f (patch)
tree5da69945ab13b377daf8982debb94180e12a2faa
parent555428872c72e10a4a4eb47d48588a81130cec71 (diff)
glimagesinkbin: Add allocation query for GstVideoOverlayComposition
Adds an GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE query to glupload and glimagesink. Detects the query from the downstream elements, so it is executed only when downstream supports the overlay API. This makes pipelines with textoverlay ! glupload ! gldownload ! xvimagesink possible. Uses allocation meta struct for passing the window size upstream. https://bugzilla.gnome.org/show_bug.cgi?id=745107
-rw-r--r--ext/gl/gstglimagesink.c13
-rw-r--r--ext/gl/gstgluploadelement.c19
2 files changed, 32 insertions, 0 deletions
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index 4120a893c..bb1ee18bc 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -1519,6 +1519,7 @@ gst_glimage_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
GstCaps *caps;
guint size;
gboolean need_pool;
+ GstStructure *allocation_meta = NULL;
if (!_ensure_gl_setup (glimage_sink))
return FALSE;
@@ -1557,6 +1558,18 @@ gst_glimage_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
if (glimage_sink->context->gl_vtable->FenceSync)
gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, 0);
+ if (glimage_sink->window_width != 0 && glimage_sink->window_height != 0) {
+ allocation_meta =
+ gst_structure_new ("GstVideoOverlayCompositionMeta",
+ "width", G_TYPE_UINT, glimage_sink->window_width,
+ "height", G_TYPE_UINT, glimage_sink->window_height, NULL);
+ GST_DEBUG ("sending alloc query with size %dx%d",
+ glimage_sink->window_width, glimage_sink->window_height);
+ }
+
+ gst_query_add_allocation_meta (query,
+ GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE, allocation_meta);
+
return TRUE;
/* ERRORS */
diff --git a/ext/gl/gstgluploadelement.c b/ext/gl/gstgluploadelement.c
index 368c2c93c..6ed3f1cc0 100644
--- a/ext/gl/gstgluploadelement.c
+++ b/ext/gl/gstgluploadelement.c
@@ -143,11 +143,30 @@ static gboolean
_gst_gl_upload_element_propose_allocation (GstBaseTransform * bt,
GstQuery * decide_query, GstQuery * query)
{
+ guint alloc_index;
+ gboolean alloc_has_overlay_meta;
GstGLUploadElement *upload = GST_GL_UPLOAD_ELEMENT (bt);
if (!upload->upload)
return FALSE;
+ alloc_has_overlay_meta =
+ gst_query_find_allocation_meta (decide_query,
+ GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE, &alloc_index);
+
+ if (alloc_has_overlay_meta) {
+ const GstStructure *params;
+ GST_DEBUG ("adding allocation meta in upload for textoverlay");
+
+ /* read window size from decide_query */
+ gst_query_parse_nth_allocation_meta (decide_query, alloc_index, &params);
+
+ if (params)
+ gst_query_add_allocation_meta (query,
+ GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE, params);
+
+ }
+
gst_gl_upload_propose_allocation (upload->upload, decide_query, query);
return TRUE;