mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
plugins: fix context query handling
The current context query handling design is flawed: the function gst_vaapi_reply_to_query() returns FALSE either if the query is not a GST_CONTEXT_QUERY of if the query could not be handled correctly. But the pad query function should handle differently each case. This patch changes the gst_vaapi_reply_to_query() for gst_vaapi_handle_context_query() and changes it usage in all the vaapi plugins to match the correct context query handling. 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
28c366a003
commit
b2707c8eec
6 changed files with 32 additions and 28 deletions
|
@ -1057,11 +1057,6 @@ gst_vaapidecode_sink_query (GstVideoDecoder * vdec, GstQuery * query)
|
|||
GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec);
|
||||
GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (decode);
|
||||
|
||||
if (gst_vaapi_reply_to_query (query, plugin->display)) {
|
||||
GST_DEBUG_OBJECT (decode, "sharing display %p", plugin->display);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_CAPS:{
|
||||
GstCaps *caps, *filter = NULL;
|
||||
|
@ -1080,6 +1075,10 @@ gst_vaapidecode_sink_query (GstVideoDecoder * vdec, GstQuery * query)
|
|||
gst_caps_unref (caps);
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_CONTEXT:{
|
||||
ret = gst_vaapi_handle_context_query (query, plugin->display);
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
#if GST_CHECK_VERSION(1,4,0)
|
||||
ret = GST_VIDEO_DECODER_CLASS (gst_vaapidecode_parent_class)->sink_query
|
||||
|
@ -1105,11 +1104,6 @@ gst_vaapidecode_src_query (GstVideoDecoder * vdec, GstQuery * query)
|
|||
GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec);
|
||||
GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (decode);
|
||||
|
||||
if (gst_vaapi_reply_to_query (query, plugin->display)) {
|
||||
GST_DEBUG_OBJECT (decode, "sharing display %p", plugin->display);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_CAPS:{
|
||||
GstCaps *caps, *filter = NULL;
|
||||
|
@ -1128,6 +1122,10 @@ gst_vaapidecode_src_query (GstVideoDecoder * vdec, GstQuery * query)
|
|||
gst_caps_unref (caps);
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_CONTEXT:{
|
||||
ret = gst_vaapi_handle_context_query (query, plugin->display);
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
#if GST_CHECK_VERSION(1,4,0)
|
||||
ret = GST_VIDEO_DECODER_CLASS (gst_vaapidecode_parent_class)->src_query
|
||||
|
|
|
@ -66,8 +66,8 @@ gst_vaapiencode_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
|||
|
||||
GST_INFO_OBJECT (plugin, "query type %s", GST_QUERY_TYPE_NAME (query));
|
||||
|
||||
if (gst_vaapi_reply_to_query (query, plugin->display))
|
||||
success = TRUE;
|
||||
if (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT)
|
||||
success = gst_vaapi_handle_context_query (query, plugin->display);
|
||||
else if (GST_PAD_IS_SINK (pad))
|
||||
success = plugin->sinkpad_query (plugin->sinkpad, parent, query);
|
||||
else
|
||||
|
|
|
@ -255,13 +255,12 @@ gst_vaapi_ensure_display (GstElement * element, GstVaapiDisplayType type)
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_vaapi_reply_to_query (GstQuery * query, GstVaapiDisplay * display)
|
||||
gst_vaapi_handle_context_query (GstQuery * query, GstVaapiDisplay * display)
|
||||
{
|
||||
const gchar *type = NULL;
|
||||
GstContext *context, *old_context;
|
||||
|
||||
if (GST_QUERY_TYPE (query) != GST_QUERY_CONTEXT)
|
||||
return FALSE;
|
||||
g_return_val_if_fail (query != NULL, FALSE);
|
||||
|
||||
if (!display)
|
||||
return FALSE;
|
||||
|
|
|
@ -35,7 +35,7 @@ gst_vaapi_ensure_display (GstElement * element, GstVaapiDisplayType type);
|
|||
|
||||
G_GNUC_INTERNAL
|
||||
gboolean
|
||||
gst_vaapi_reply_to_query (GstQuery * query, GstVaapiDisplay * display);
|
||||
gst_vaapi_handle_context_query (GstQuery * query, GstVaapiDisplay * display);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
gboolean
|
||||
|
|
|
@ -1286,11 +1286,13 @@ gst_vaapipostproc_query (GstBaseTransform * trans, GstPadDirection direction,
|
|||
{
|
||||
GstVaapiPostproc *const postproc = GST_VAAPIPOSTPROC (trans);
|
||||
|
||||
if (gst_vaapi_reply_to_query (query,
|
||||
GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc))) {
|
||||
GST_DEBUG_OBJECT (postproc, "sharing display %p",
|
||||
GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc));
|
||||
return TRUE;
|
||||
if (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT) {
|
||||
if (gst_vaapi_handle_context_query (query,
|
||||
GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc))) {
|
||||
GST_DEBUG_OBJECT (postproc, "sharing display %p",
|
||||
GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
|
|
|
@ -1447,15 +1447,20 @@ static gboolean
|
|||
gst_vaapisink_query (GstBaseSink * base_sink, GstQuery * query)
|
||||
{
|
||||
GstVaapiSink *const sink = GST_VAAPISINK_CAST (base_sink);
|
||||
GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (sink);
|
||||
gboolean ret = FALSE;
|
||||
|
||||
GST_INFO_OBJECT (sink, "query type %s", GST_QUERY_TYPE_NAME (query));
|
||||
|
||||
if (gst_vaapi_reply_to_query (query, GST_VAAPI_PLUGIN_BASE_DISPLAY (sink))) {
|
||||
GST_DEBUG ("sharing display %p", GST_VAAPI_PLUGIN_BASE_DISPLAY (sink));
|
||||
return TRUE;
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_CONTEXT:
|
||||
ret = gst_vaapi_handle_context_query (query, plugin->display);
|
||||
break;
|
||||
default:
|
||||
ret = GST_BASE_SINK_CLASS (gst_vaapisink_parent_class)->query (base_sink,
|
||||
query);
|
||||
break;
|
||||
}
|
||||
return GST_BASE_SINK_CLASS (gst_vaapisink_parent_class)->query (base_sink,
|
||||
query);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue