From 395260f24bd8ab6e0f8464a6bffd39032c8bc03d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Tue, 1 Oct 2013 17:57:11 +0200 Subject: [PATCH] plugins: hanle the context query in any pad. Also this patch simplifies the code, since now the query is common for the decoder and the sink. https://bugzilla.gnome.org/show_bug.cgi?id=709200 --- gst/vaapi/gstvaapidecode.c | 18 ------------------ gst/vaapi/gstvaapipluginutil.c | 21 ++++++++++++++++++++- gst/vaapi/gstvaapisink.c | 23 ----------------------- 3 files changed, 20 insertions(+), 42 deletions(-) diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index 597a3fba00..2f17a3bf05 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -932,24 +932,6 @@ gst_vaapidecode_query(GST_PAD_QUERY_FUNCTION_ARGS) res = TRUE; break; } -#endif -#if GST_CHECK_VERSION(1,1,0) - case GST_QUERY_CONTEXT: { - const gchar *context_type = NULL; - - if (gst_query_parse_context_type(query, &context_type) && - !g_strcmp0(context_type, GST_VAAPI_DISPLAY_CONTEXT_TYPE_NAME) && - decode->display) { - GstContext *context; - - context = gst_vaapi_video_context_new_with_display( - decode->display, FALSE); - gst_query_set_context(query, context); - gst_context_unref(context); - return TRUE; - } - // fall-through - } #endif default: res = GST_PAD_QUERY_FUNCTION_CALL(decode->sinkpad_query, diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c index 43b1fc580c..ec1c99c9a1 100644 --- a/gst/vaapi/gstvaapipluginutil.c +++ b/gst/vaapi/gstvaapipluginutil.c @@ -220,7 +220,26 @@ gboolean gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display) { #if GST_CHECK_VERSION(1,1,0) - return FALSE; + const gchar *type = NULL; + GstContext *context; + + if (GST_QUERY_TYPE(query) != GST_QUERY_CONTEXT) + return FALSE; + + if (!display) + return FALSE; + + if (!gst_query_parse_context_type(query, &type)) + return FALSE; + + if (g_strcmp0(type, GST_VAAPI_DISPLAY_CONTEXT_TYPE_NAME)) + return FALSE; + + context = gst_vaapi_video_context_new_with_display(display, FALSE); + gst_query_set_context(query, context); + gst_context_unref(context); + + return TRUE; #else GstVaapiDisplayType display_type; const gchar **types; diff --git a/gst/vaapi/gstvaapisink.c b/gst/vaapi/gstvaapisink.c index b6ffca3661..c71c80af49 100644 --- a/gst/vaapi/gstvaapisink.c +++ b/gst/vaapi/gstvaapisink.c @@ -1368,29 +1368,6 @@ gst_vaapisink_query(GstBaseSink *base_sink, GstQuery *query) return TRUE; } - switch(GST_QUERY_TYPE(query)) { -#if GST_CHECK_VERSION(1,1,0) - case GST_QUERY_CONTEXT: { - const gchar *context_type = NULL; - - if (gst_query_parse_context_type(query, &context_type) && - !g_strcmp0(context_type, GST_VAAPI_DISPLAY_CONTEXT_TYPE_NAME) && - sink->display) { - GstContext *context; - - context = gst_vaapi_video_context_new_with_display( - sink->display, FALSE); - gst_query_set_context(query, context); - gst_context_unref(context); - return TRUE; - } - // fall-through - } -#endif - default: - break; - } - return GST_BASE_SINK_CLASS(gst_vaapisink_parent_class)->query(base_sink, query); }