From 2928b14b69c0e8a23146988ac049739488f79cb1 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Tue, 17 Aug 2021 22:36:59 +0800 Subject: [PATCH] MSDK: Handle context query into the VPP's query function. The MSDK VPP's query function is not set and it just forwards all query to its base class. We now need to answer the context query correctly. Other VA plugins need to query the VA display. By the way, the current query of "gst.msdk.Context" is also missing. The other MSDK elements must depend on the bin's context message( sent in context_propagate()) to set their MsdkContext correctly. Part-of: --- subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c index 8f1e5e4..3bdc982 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c @@ -1468,6 +1468,33 @@ gst_msdkvpp_stop (GstBaseTransform * trans) return TRUE; } +static gboolean +gst_msdkvpp_query (GstBaseTransform * trans, GstPadDirection direction, + GstQuery * query) +{ + GstMsdkVPP *thiz = GST_MSDKVPP (trans); + gboolean ret = FALSE; + + switch (GST_QUERY_TYPE (query)) { + case GST_QUERY_CONTEXT:{ + GstMsdkContext *msdk_context = NULL; + + gst_object_replace ((GstObject **) & msdk_context, + (GstObject *) thiz->context); + ret = gst_msdk_handle_context_query (GST_ELEMENT_CAST (trans), + query, msdk_context); + gst_clear_object (&msdk_context); + break; + } + default: + ret = GST_BASE_TRANSFORM_CLASS (parent_class)->query (trans, + direction, query); + break; + } + + return ret; +} + static void gst_msdkvpp_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) @@ -1701,6 +1728,7 @@ gst_msdkvpp_class_init (GstMsdkVPPClass * klass) GST_DEBUG_FUNCPTR (gst_msdkvpp_decide_allocation); trans_class->prepare_output_buffer = GST_DEBUG_FUNCPTR (gst_msdkvpp_prepare_output_buffer); + trans_class->query = GST_DEBUG_FUNCPTR (gst_msdkvpp_query); obj_properties[PROP_HARDWARE] = g_param_spec_boolean ("hardware", "Hardware", "Enable hardware VPP", -- 2.7.4