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
This commit is contained in:
Víctor Manuel Jáquez Leal 2013-10-01 17:57:11 +02:00 committed by Gwenole Beauchesne
parent b56144e924
commit 395260f24b
3 changed files with 20 additions and 42 deletions

View file

@ -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,

View file

@ -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;

View file

@ -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);
}