mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-22 10:23:47 +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);
|
GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec);
|
||||||
GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (decode);
|
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)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_CAPS:{
|
case GST_QUERY_CAPS:{
|
||||||
GstCaps *caps, *filter = NULL;
|
GstCaps *caps, *filter = NULL;
|
||||||
|
@ -1080,6 +1075,10 @@ gst_vaapidecode_sink_query (GstVideoDecoder * vdec, GstQuery * query)
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GST_QUERY_CONTEXT:{
|
||||||
|
ret = gst_vaapi_handle_context_query (query, plugin->display);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:{
|
default:{
|
||||||
#if GST_CHECK_VERSION(1,4,0)
|
#if GST_CHECK_VERSION(1,4,0)
|
||||||
ret = GST_VIDEO_DECODER_CLASS (gst_vaapidecode_parent_class)->sink_query
|
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);
|
GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec);
|
||||||
GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (decode);
|
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)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_CAPS:{
|
case GST_QUERY_CAPS:{
|
||||||
GstCaps *caps, *filter = NULL;
|
GstCaps *caps, *filter = NULL;
|
||||||
|
@ -1128,6 +1122,10 @@ gst_vaapidecode_src_query (GstVideoDecoder * vdec, GstQuery * query)
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GST_QUERY_CONTEXT:{
|
||||||
|
ret = gst_vaapi_handle_context_query (query, plugin->display);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:{
|
default:{
|
||||||
#if GST_CHECK_VERSION(1,4,0)
|
#if GST_CHECK_VERSION(1,4,0)
|
||||||
ret = GST_VIDEO_DECODER_CLASS (gst_vaapidecode_parent_class)->src_query
|
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));
|
GST_INFO_OBJECT (plugin, "query type %s", GST_QUERY_TYPE_NAME (query));
|
||||||
|
|
||||||
if (gst_vaapi_reply_to_query (query, plugin->display))
|
if (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT)
|
||||||
success = TRUE;
|
success = gst_vaapi_handle_context_query (query, plugin->display);
|
||||||
else if (GST_PAD_IS_SINK (pad))
|
else if (GST_PAD_IS_SINK (pad))
|
||||||
success = plugin->sinkpad_query (plugin->sinkpad, parent, query);
|
success = plugin->sinkpad_query (plugin->sinkpad, parent, query);
|
||||||
else
|
else
|
||||||
|
|
|
@ -255,13 +255,12 @@ gst_vaapi_ensure_display (GstElement * element, GstVaapiDisplayType type)
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_reply_to_query (GstQuery * query, GstVaapiDisplay * display)
|
gst_vaapi_handle_context_query (GstQuery * query, GstVaapiDisplay * display)
|
||||||
{
|
{
|
||||||
const gchar *type = NULL;
|
const gchar *type = NULL;
|
||||||
GstContext *context, *old_context;
|
GstContext *context, *old_context;
|
||||||
|
|
||||||
if (GST_QUERY_TYPE (query) != GST_QUERY_CONTEXT)
|
g_return_val_if_fail (query != NULL, FALSE);
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (!display)
|
if (!display)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -35,7 +35,7 @@ gst_vaapi_ensure_display (GstElement * element, GstVaapiDisplayType type);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_reply_to_query (GstQuery * query, GstVaapiDisplay * display);
|
gst_vaapi_handle_context_query (GstQuery * query, GstVaapiDisplay * display);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
|
|
|
@ -1286,11 +1286,13 @@ gst_vaapipostproc_query (GstBaseTransform * trans, GstPadDirection direction,
|
||||||
{
|
{
|
||||||
GstVaapiPostproc *const postproc = GST_VAAPIPOSTPROC (trans);
|
GstVaapiPostproc *const postproc = GST_VAAPIPOSTPROC (trans);
|
||||||
|
|
||||||
if (gst_vaapi_reply_to_query (query,
|
if (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT) {
|
||||||
GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc))) {
|
if (gst_vaapi_handle_context_query (query,
|
||||||
GST_DEBUG_OBJECT (postproc, "sharing display %p",
|
GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc))) {
|
||||||
GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc));
|
GST_DEBUG_OBJECT (postproc, "sharing display %p",
|
||||||
return TRUE;
|
GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc));
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
|
@ -1447,15 +1447,20 @@ static gboolean
|
||||||
gst_vaapisink_query (GstBaseSink * base_sink, GstQuery * query)
|
gst_vaapisink_query (GstBaseSink * base_sink, GstQuery * query)
|
||||||
{
|
{
|
||||||
GstVaapiSink *const sink = GST_VAAPISINK_CAST (base_sink);
|
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));
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
|
case GST_QUERY_CONTEXT:
|
||||||
if (gst_vaapi_reply_to_query (query, GST_VAAPI_PLUGIN_BASE_DISPLAY (sink))) {
|
ret = gst_vaapi_handle_context_query (query, plugin->display);
|
||||||
GST_DEBUG ("sharing display %p", GST_VAAPI_PLUGIN_BASE_DISPLAY (sink));
|
break;
|
||||||
return TRUE;
|
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
|
static void
|
||||||
|
|
Loading…
Reference in a new issue