From: U. Artie Eoff Date: Thu, 14 Nov 2019 19:54:59 +0000 (-0800) Subject: plugins: base: add GstVideoAggregator subclass support X-Git-Tag: 1.19.3~503^2~328 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=894c1da6c770cf3542f90e10da7a105cd5f7faa9;p=platform%2Fupstream%2Fgstreamer.git plugins: base: add GstVideoAggregator subclass support --- diff --git a/gst/vaapi/gstvaapipluginbase.c b/gst/vaapi/gstvaapipluginbase.c index 7c16778..e9dd8de 100644 --- a/gst/vaapi/gstvaapipluginbase.c +++ b/gst/vaapi/gstvaapipluginbase.c @@ -842,6 +842,27 @@ _set_sinkpad_caps (GstVaapiPluginBase * plugin, GstPad * sinkpad, } /** + * gst_vaapi_plugin_base_pad_set_caps: + * @plugin: a #GstVaapiPluginBase + * @sinkpad: the sink pad to set @incaps on + * @incaps: the sink pad (input) caps + * @srcpad: the src pad to set @outcaps on + * @outcaps: the src pad (output) caps + * + * Notifies the base plugin object of the new input and output caps, + * obtained from the subclass on the requested pads. + * + * Returns: %TRUE if the update of caps was successful, %FALSE otherwise. + */ +gboolean +gst_vaapi_plugin_base_pad_set_caps (GstVaapiPluginBase * plugin, + GstPad * sinkpad, GstCaps * incaps, GstPad * srcpad, GstCaps * outcaps) +{ + return _set_sinkpad_caps (plugin, sinkpad, incaps) + && _set_srcpad_caps (plugin, srcpad, outcaps); +} + +/** * gst_vaapi_plugin_base_set_caps: * @plugin: a #GstVaapiPluginBase * @incaps: the sink pad (input) caps @@ -856,25 +877,26 @@ gboolean gst_vaapi_plugin_base_set_caps (GstVaapiPluginBase * plugin, GstCaps * incaps, GstCaps * outcaps) { - return _set_sinkpad_caps (plugin, plugin->sinkpad, incaps) - && _set_srcpad_caps (plugin, plugin->srcpad, outcaps); + return gst_vaapi_plugin_base_pad_set_caps (plugin, plugin->sinkpad, incaps, + plugin->srcpad, outcaps); } /** - * gst_vaapi_plugin_base_propose_allocation: + * gst_vaapi_plugin_base_pad_propose_allocation: * @plugin: a #GstVaapiPluginBase + * @sinkpad: the sinkpad to configure the allocation query on * @query: the allocation query to configure * - * Proposes allocation parameters to the upstream elements on the base plugin - * static sinkpad. + * Proposes allocation parameters to the upstream elements on the requested + * sinkpad. * * Returns: %TRUE if successful, %FALSE otherwise. */ gboolean -gst_vaapi_plugin_base_propose_allocation (GstVaapiPluginBase * plugin, - GstQuery * query) +gst_vaapi_plugin_base_pad_propose_allocation (GstVaapiPluginBase * plugin, + GstPad * sinkpad, GstQuery * query) { - GstVaapiPadPrivate *sinkpriv = GST_VAAPI_PAD_PRIVATE (plugin->sinkpad); + GstVaapiPadPrivate *sinkpriv = GST_VAAPI_PAD_PRIVATE (sinkpad); GstCaps *caps = NULL; GstBufferPool *pool = NULL; gboolean need_pool; @@ -884,7 +906,7 @@ gst_vaapi_plugin_base_propose_allocation (GstVaapiPluginBase * plugin, if (!caps) goto error_no_caps; - if (!ensure_sinkpad_allocator (plugin, plugin->sinkpad, caps, &size)) + if (!ensure_sinkpad_allocator (plugin, sinkpad, caps, &size)) return FALSE; if (need_pool) { @@ -928,6 +950,24 @@ error_no_caps: } /** + * gst_vaapi_plugin_base_propose_allocation: + * @plugin: a #GstVaapiPluginBase + * @query: the allocation query to configure + * + * Proposes allocation parameters to the upstream elements on the base plugin + * static sinkpad. + * + * Returns: %TRUE if successful, %FALSE otherwise. + */ +gboolean +gst_vaapi_plugin_base_propose_allocation (GstVaapiPluginBase * plugin, + GstQuery * query) +{ + return gst_vaapi_plugin_base_pad_propose_allocation (plugin, plugin->sinkpad, + query); +} + +/** * gst_vaapi_plugin_base_decide_allocation: * @plugin: a #GstVaapiPluginBase * @query: the allocation query to parse @@ -1120,8 +1160,9 @@ error: } /** - * gst_vaapi_plugin_base_get_input_buffer: + * gst_vaapi_plugin_base_pad_get_input_buffer: * @plugin: a #GstVaapiPluginBase + * @sinkpad: the sink pad to obtain input buffer on * @inbuf: the sink pad (input) buffer * @outbuf_ptr: the pointer to location to the VA surface backed buffer * @@ -1133,10 +1174,10 @@ error: * Returns: #GST_FLOW_OK if the buffer could be acquired */ GstFlowReturn -gst_vaapi_plugin_base_get_input_buffer (GstVaapiPluginBase * plugin, - GstBuffer * inbuf, GstBuffer ** outbuf_ptr) +gst_vaapi_plugin_base_pad_get_input_buffer (GstVaapiPluginBase * plugin, + GstPad * sinkpad, GstBuffer * inbuf, GstBuffer ** outbuf_ptr) { - GstVaapiPadPrivate *sinkpriv = GST_VAAPI_PAD_PRIVATE (plugin->sinkpad); + GstVaapiPadPrivate *sinkpriv = GST_VAAPI_PAD_PRIVATE (sinkpad); GstVaapiVideoMeta *meta; GstBuffer *outbuf; GstVideoFrame src_frame, out_frame; @@ -1167,8 +1208,7 @@ gst_vaapi_plugin_base_get_input_buffer (GstVaapiPluginBase * plugin, goto error_create_buffer; if (is_dma_buffer (inbuf)) { - if (!plugin_bind_dma_to_vaapi_buffer (plugin, plugin->sinkpad, inbuf, - outbuf)) + if (!plugin_bind_dma_to_vaapi_buffer (plugin, sinkpad, inbuf, outbuf)) goto error_bind_dma_buffer; goto done; } @@ -1247,6 +1287,27 @@ error_copy_buffer: } /** + * gst_vaapi_plugin_base_get_input_buffer: + * @plugin: a #GstVaapiPluginBase + * @inbuf: the sink pad (input) buffer + * @outbuf_ptr: the pointer to location to the VA surface backed buffer + * + * Acquires the static sink pad (input) buffer as a VA surface backed + * buffer. This is mostly useful for raw YUV buffers, as source + * buffers that are already backed as a VA surface are passed + * verbatim. + * + * Returns: #GST_FLOW_OK if the buffer could be acquired + */ +GstFlowReturn +gst_vaapi_plugin_base_get_input_buffer (GstVaapiPluginBase * plugin, + GstBuffer * inbuf, GstBuffer ** outbuf_ptr) +{ + return gst_vaapi_plugin_base_pad_get_input_buffer (plugin, plugin->sinkpad, + inbuf, outbuf_ptr); +} + +/** * gst_vaapi_plugin_base_set_gl_context: * @plugin: a #GstVaapiPluginBase * @object: the new GL context from downstream diff --git a/gst/vaapi/gstvaapipluginbase.h b/gst/vaapi/gstvaapipluginbase.h index e98b451..c48f3bb 100644 --- a/gst/vaapi/gstvaapipluginbase.h +++ b/gst/vaapi/gstvaapipluginbase.h @@ -138,6 +138,18 @@ struct _GstVaapiPadPrivate GstAllocationParams other_allocator_params; }; +G_GNUC_INTERNAL +GstVaapiPadPrivate * +gst_vaapi_pad_private_new (void); + +G_GNUC_INTERNAL +void +gst_vaapi_pad_private_reset (GstVaapiPadPrivate * priv); + +G_GNUC_INTERNAL +void +gst_vaapi_pad_private_finalize (GstVaapiPadPrivate * priv); + struct _GstVaapiPluginBase { /*< private >*/ @@ -148,6 +160,7 @@ struct _GstVaapiPluginBase GstVideoEncoder encoder; GstBaseTransform transform; GstVideoSink sink; + GstVideoAggregator aggregator; } parent_instance; GstDebugCategory *debug_category; @@ -183,6 +196,7 @@ struct _GstVaapiPluginBaseClass GstVideoEncoderClass encoder; GstBaseTransformClass transform; GstVideoSinkClass sink; + GstVideoAggregatorClass aggregator; } parent_class; gboolean (*has_interface) (GstVaapiPluginBase * plugin, GType type); @@ -241,11 +255,21 @@ gst_vaapi_plugin_base_set_caps (GstVaapiPluginBase * plugin, GstCaps * incaps, G_GNUC_INTERNAL gboolean +gst_vaapi_plugin_base_pad_set_caps (GstVaapiPluginBase *plugin, + GstPad * sinkpad, GstCaps * incaps, GstPad * srcpad, GstCaps * outcaps); + +G_GNUC_INTERNAL +gboolean gst_vaapi_plugin_base_propose_allocation (GstVaapiPluginBase * plugin, GstQuery * query); G_GNUC_INTERNAL gboolean +gst_vaapi_plugin_base_pad_propose_allocation (GstVaapiPluginBase * plugin, + GstPad * sinkpad, GstQuery * query); + +G_GNUC_INTERNAL +gboolean gst_vaapi_plugin_base_decide_allocation (GstVaapiPluginBase * plugin, GstQuery * query); @@ -255,6 +279,11 @@ gst_vaapi_plugin_base_get_input_buffer (GstVaapiPluginBase * plugin, GstBuffer * inbuf, GstBuffer ** outbuf_ptr); G_GNUC_INTERNAL +GstFlowReturn +gst_vaapi_plugin_base_pad_get_input_buffer (GstVaapiPluginBase * plugin, + GstPad * sinkpad, GstBuffer * inbuf, GstBuffer ** outbuf_ptr); + +G_GNUC_INTERNAL void gst_vaapi_plugin_base_set_context (GstVaapiPluginBase * plugin, GstContext * context);