mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-03 13:02:29 +00:00
plugins: check if display is set in sync
Since the context messages are sync'ed, the display assignation happens in the same thread, hence we can know if the display was found or not as soon we call for it. In order to take advantage of it, gst_vaapi_video_context_prepare() receives, as a new parameter, the address of the plugin's display, and reports back if the display was found and set. Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com> https://bugzilla.gnome.org/show_bug.cgi?id=757598
This commit is contained in:
parent
b45089f0f7
commit
ef3fb4afaf
3 changed files with 23 additions and 16 deletions
|
@ -235,11 +235,11 @@ gst_vaapi_ensure_display (GstElement * element, GstVaapiDisplayType type)
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
||||||
|
|
||||||
gst_vaapi_video_context_prepare (element);
|
if (gst_vaapi_video_context_prepare (element, &plugin->display)) {
|
||||||
|
|
||||||
/* Neighbour found and it updated the display */
|
/* Neighbour found and it updated the display */
|
||||||
if (gst_vaapi_plugin_base_has_display_type (plugin, type))
|
if (gst_vaapi_plugin_base_has_display_type (plugin, type))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* If no neighboor, or application not interested, use system default */
|
/* If no neighboor, or application not interested, use system default */
|
||||||
if (plugin->gl_context)
|
if (plugin->gl_context)
|
||||||
|
|
|
@ -178,21 +178,27 @@ found:
|
||||||
gst_query_unref (query);
|
gst_query_unref (query);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
gst_vaapi_video_context_prepare (GstElement * element)
|
gst_vaapi_video_context_prepare (GstElement * element,
|
||||||
|
GstVaapiDisplay ** display_ptr)
|
||||||
{
|
{
|
||||||
g_return_if_fail (element != NULL);
|
g_return_val_if_fail (element != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (display_ptr != NULL, FALSE);
|
||||||
|
|
||||||
/* 1) Check if the element already has a context of the specific
|
/* 1) Check if the element already has a context of the specific
|
||||||
* type, i.e. it was previously set via
|
* type.
|
||||||
* gst_element_set_context(). */
|
*/
|
||||||
/* This was already done by the caller of this function:
|
if (*display_ptr) {
|
||||||
* gst_vaapi_ensure_display() */
|
GST_LOG_OBJECT (element, "already have a display (%p)", *display_ptr);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
_gst_context_query (element, GST_VAAPI_DISPLAY_CONTEXT_TYPE_NAME);
|
_gst_context_query (element, GST_VAAPI_DISPLAY_CONTEXT_TYPE_NAME);
|
||||||
|
|
||||||
/* The check of an usable context is done by the caller:
|
if (*display_ptr)
|
||||||
gst_vaapi_ensure_display() */
|
GST_LOG_OBJECT (element, "found a display (%p)", *display_ptr);
|
||||||
|
|
||||||
|
return *display_ptr != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 5) Create a context by itself and post a GST_MESSAGE_HAVE_CONTEXT message
|
/* 5) Create a context by itself and post a GST_MESSAGE_HAVE_CONTEXT message
|
||||||
|
|
|
@ -42,8 +42,9 @@ gst_vaapi_video_context_get_display (GstContext * context,
|
||||||
GstVaapiDisplay ** display_ptr);
|
GstVaapiDisplay ** display_ptr);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
gboolean
|
||||||
gst_vaapi_video_context_prepare (GstElement * element);
|
gst_vaapi_video_context_prepare (GstElement * element,
|
||||||
|
GstVaapiDisplay ** display_ptr);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue