gst_iterator_resync(it);
gst_iterator_free(it);
- /* Ignore upstream neighbours */
+ if (g_value_get_boolean(&res))
+ return TRUE;
+
+ /* If none, ask upstream neighbour (auto-plugged case) */
+ it = gst_element_iterate_sink_pads(element);
+ while (gst_iterator_fold(it, func, &res, query) == GST_ITERATOR_RESYNC)
+ gst_iterator_resync(it);
+ gst_iterator_free(it);
+
return g_value_get_boolean(&res);
}
{
GstContext *context;
GstQuery *query;
+ GstMessage *msg;
if (!GST_CAT_CONTEXT)
GST_DEBUG_CATEGORY_GET(GST_CAT_CONTEXT, "GST_CONTEXT");
- /* (2) Query downstream with GST_QUERY_CONTEXT for the context and
- check if downstream already has a context of the specified type */
+ /* 1) Check if the element already has a context of the specific
+ * type, i.e. it was previously set via
+ * gst_element_set_context(). */
+ /* This was already done by the caller of this function:
+ * gst_vaapi_ensure_display() */
+
+ /* 2) Query downstream with GST_QUERY_CONTEXT for the context and
+ check if downstream already has a context of the specific
+ type */
+ /* 3) Query upstream with GST_QUERY_CONTEXT for the context and
+ check if upstream already has a context of the specific
+ type */
context = NULL;
query = gst_query_new_context(GST_VAAPI_DISPLAY_CONTEXT_TYPE_NAME);
if (run_context_query(element, query)) {
gst_element_set_context(element, context);
}
else {
- /* (3) Post a GST_MESSAGE_NEED_CONTEXT message on the bus with
- the required context types and afterwards check if a usable
- context was set now as in (1). The message could be handled
- by the parent bins of the element and the application */
- GstMessage *msg;
-
+ /* 4) Post a GST_MESSAGE_NEED_CONTEXT message on the bus with
+ the required context types and afterwards check if an
+ usable context was set now as in 1). The message could
+ be handled by the parent bins of the element and the
+ application. */
GST_CAT_INFO_OBJECT(GST_CAT_CONTEXT, element,
"posting `need-context' message");
msg = gst_message_new_need_context(GST_OBJECT_CAST(element),
GST_VAAPI_DISPLAY_CONTEXT_TYPE_NAME);
gst_element_post_message(element, msg);
+
+ /* The check of an usable context is done by the caller:
+ gst_vaapi_ensure_display() */
}
+
gst_query_unref(query);
}
-/* (4) Create context by itself and post a GST_MESSAGE_HAVE_CONTEXT
- message and send a GST_EVENT_CONTEXT event downstream, thus
- containing the complete context information at this time */
+/* 5) Create a context by itself and post a GST_MESSAGE_HAVE_CONTEXT message
+ on the bus. */
void
gst_vaapi_video_context_propagate(GstElement *element, GstVaapiDisplay *display)
{