summaryrefslogtreecommitdiff
path: root/gst/vaapi
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2015-11-04 21:38:42 +0100
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2015-11-09 16:18:19 +0100
commitb2707c8eece0a57906b3225f3f8706d94d41831c (patch)
tree7aa6584dd38930f7e71fc23ba6913fc5b62cbb5b /gst/vaapi
parent28c366a003c6483a0602775b3dd18add75c12592 (diff)
downloadgstreamer-vaapi-b2707c8eece0a57906b3225f3f8706d94d41831c.tar.gz
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
Diffstat (limited to 'gst/vaapi')
-rw-r--r--gst/vaapi/gstvaapidecode.c18
-rw-r--r--gst/vaapi/gstvaapiencode.c4
-rw-r--r--gst/vaapi/gstvaapipluginutil.c5
-rw-r--r--gst/vaapi/gstvaapipluginutil.h2
-rw-r--r--gst/vaapi/gstvaapipostproc.c12
-rw-r--r--gst/vaapi/gstvaapisink.c19
6 files changed, 32 insertions, 28 deletions
diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c
index 6be9eb1e..7bec7b88 100644
--- a/gst/vaapi/gstvaapidecode.c
+++ b/gst/vaapi/gstvaapidecode.c
@@ -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
diff --git a/gst/vaapi/gstvaapiencode.c b/gst/vaapi/gstvaapiencode.c
index 88c5549e..14154418 100644
--- a/gst/vaapi/gstvaapiencode.c
+++ b/gst/vaapi/gstvaapiencode.c
@@ -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
diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c
index 00babbe1..74f311b2 100644
--- a/gst/vaapi/gstvaapipluginutil.c
+++ b/gst/vaapi/gstvaapipluginutil.c
@@ -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;
diff --git a/gst/vaapi/gstvaapipluginutil.h b/gst/vaapi/gstvaapipluginutil.h
index 4ca82253..d46f2dbb 100644
--- a/gst/vaapi/gstvaapipluginutil.h
+++ b/gst/vaapi/gstvaapipluginutil.h
@@ -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
diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c
index fc8c7cb2..38fa9b5c 100644
--- a/gst/vaapi/gstvaapipostproc.c
+++ b/gst/vaapi/gstvaapipostproc.c
@@ -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
diff --git a/gst/vaapi/gstvaapisink.c b/gst/vaapi/gstvaapisink.c
index b148cacc..7ff84012 100644
--- a/gst/vaapi/gstvaapisink.c
+++ b/gst/vaapi/gstvaapisink.c
@@ -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