MSDK: Handle context query into the VPP's query function.
authorHe Junyan <junyan.he@intel.com>
Tue, 17 Aug 2021 14:36:59 +0000 (22:36 +0800)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 11 Feb 2022 07:13:45 +0000 (07:13 +0000)
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>

subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c

index 8f1e5e4..3bdc982 100644 (file)
@@ -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",