glutils: expose running a query on a set of src/sink pads

This commit is contained in:
Matthew Waters 2015-02-11 01:27:28 +11:00 committed by Tim-Philipp Müller
parent f9ac4984eb
commit 6d4cca89ef
2 changed files with 9 additions and 7 deletions

View file

@ -487,7 +487,7 @@ gst_gl_display_found (GstElement * element, GstGLDisplay * display)
GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT); GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
static gboolean static gboolean
context_pad_query (const GValue * item, GValue * value, gpointer user_data) pad_query (const GValue * item, GValue * value, gpointer user_data)
{ {
GstPad *pad = g_value_get_object (item); GstPad *pad = g_value_get_object (item);
GstQuery *query = user_data; GstQuery *query = user_data;
@ -500,16 +500,16 @@ context_pad_query (const GValue * item, GValue * value, gpointer user_data)
return FALSE; return FALSE;
} }
GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, pad, "context pad peer query failed"); GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, pad, "pad peer query failed");
return TRUE; return TRUE;
} }
static gboolean gboolean
run_context_query (GstElement * element, GstQuery * query, gst_gl_run_query (GstElement * element, GstQuery * query,
GstPadDirection direction) GstPadDirection direction)
{ {
GstIterator *it; GstIterator *it;
GstIteratorFoldFunction func = context_pad_query; GstIteratorFoldFunction func = pad_query;
GValue res = { 0 }; GValue res = { 0 };
g_value_init (&res, G_TYPE_BOOLEAN); g_value_init (&res, G_TYPE_BOOLEAN);
@ -541,11 +541,11 @@ _gst_context_query (GstElement * element,
* 2b) Query upstream as above. * 2b) Query upstream as above.
*/ */
query = gst_query_new_context (display_type); query = gst_query_new_context (display_type);
if (run_context_query (element, query, GST_PAD_SRC)) { if (gst_gl_run_query (element, query, GST_PAD_SRC)) {
gst_query_parse_context (query, &ctxt); gst_query_parse_context (query, &ctxt);
GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element, GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element,
"found context (%p) in downstream query", ctxt); "found context (%p) in downstream query", ctxt);
} else if (run_context_query (element, query, GST_PAD_SINK)) { } else if (gst_gl_run_query (element, query, GST_PAD_SINK)) {
gst_query_parse_context (query, &ctxt); gst_query_parse_context (query, &ctxt);
GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element, GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element,
"found context (%p) in upstream query", ctxt); "found context (%p) in upstream query", ctxt);

View file

@ -99,6 +99,8 @@ gboolean gst_gl_handle_set_context (GstElement * element, GstContext * context,
gboolean gst_gl_handle_context_query (GstElement * element, GstQuery * query, gboolean gst_gl_handle_context_query (GstElement * element, GstQuery * query,
GstGLDisplay ** display, GstGLContext ** other_context); GstGLDisplay ** display, GstGLContext ** other_context);
gboolean gst_gl_run_query (GstElement * element,
GstQuery * query, GstPadDirection direction);
gsize gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align, gsize gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align,
guint plane); guint plane);
GstCaps * gst_gl_caps_replace_all_caps_features (const GstCaps * caps, GstCaps * gst_gl_caps_replace_all_caps_features (const GstCaps * caps,