gst-analytics: add missing mtd segmentation API

- add gst_analytics_segmentation_mtd_get_mtd_type() which is required to
  retrieve the concrete type of a generic mtd (GstAnalyticsMtd).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8307>
This commit is contained in:
Daniel Morin 2025-01-15 17:08:21 -05:00
parent 0476b9cd2c
commit 5919b20e8b
3 changed files with 54 additions and 2 deletions

View file

@ -877,6 +877,30 @@ Ids (@an_meta_first_id and @an_meta_second_id) must be from a call to
</parameter>
</parameters>
</method>
<method name="get_segmentation_mtd" c:identifier="gst_analytics_relation_meta_get_segmentation_mtd" version="1.26">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticssegmentationmtd.c">Fill @rlt if a analytics-meta with id == @an_meta_id exist in @meta instance,
otherwise this method return FALSE and @rlt is invalid.</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticssegmentationmtd.h"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticssegmentationmtd.c">TRUE if successful.</doc>
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<instance-parameter name="meta" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticssegmentationmtd.c">Instance of #GstAnalyticsRelationMeta</doc>
<type name="RelationMeta" c:type="GstAnalyticsRelationMeta*"/>
</instance-parameter>
<parameter name="an_meta_id" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticssegmentationmtd.c">Id of #GstAnalyticsSegmentationMtd instance to retrieve</doc>
<type name="guint" c:type="guint"/>
</parameter>
<parameter name="rlt" direction="out" caller-allocates="1" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticssegmentationmtd.c">Will be filled with relatable
meta</doc>
<type name="SegmentationMtd" c:type="GstAnalyticsSegmentationMtd*"/>
</parameter>
</parameters>
</method>
<method name="get_tracking_mtd" c:identifier="gst_analytics_relation_meta_get_tracking_mtd" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjecttrackingmtd.c">Fill @rlt if a analytics-meta with id == @an_meta_id exist in @meta instance,
otherwise this method return FALSE and @rlt is invalid.</doc>
@ -958,7 +982,7 @@ Ids must have been obtained a call to
</parameter>
</parameters>
</method>
<function name="get_info" c:identifier="gst_analytics_relation_meta_get_info" version="1.24" introspectable="0">
<function name="get_info" c:identifier="gst_analytics_relation_meta_get_info" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.c">Get the meta info</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.h"/>
<return-value transfer-ownership="none">
@ -1744,7 +1768,7 @@ information about the tracking, for example, it can be used alongside a
<type name="GType" c:type="GType"/>
</return-value>
</function>
<function name="relation_meta_get_info" c:identifier="gst_analytics_relation_meta_get_info" moved-to="RelationMeta.get_info" version="1.24" introspectable="0">
<function name="relation_meta_get_info" c:identifier="gst_analytics_relation_meta_get_info" moved-to="RelationMeta.get_info" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.c">Get the meta info</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.h"/>
<return-value transfer-ownership="none">

View file

@ -465,3 +465,26 @@ gst_analytics_segmentation_mtd_transform (GstBuffer * transbuf,
return TRUE;
}
/**
* gst_analytics_relation_meta_get_segmentation_mtd:
* @meta: Instance of #GstAnalyticsRelationMeta
* @an_meta_id: Id of #GstAnalyticsSegmentationMtd instance to retrieve
* @rlt: (out caller-allocates)(not nullable): Will be filled with relatable
* meta
*
* Fill @rlt if a analytics-meta with id == @an_meta_id exist in @meta instance,
* otherwise this method return FALSE and @rlt is invalid.
*
* Returns: TRUE if successful.
*
* Since: 1.26
*/
gboolean
gst_analytics_relation_meta_get_segmentation_mtd (GstAnalyticsRelationMeta *
meta, guint an_meta_id, GstAnalyticsSegmentationMtd * rlt)
{
return gst_analytics_relation_meta_get_mtd (meta, an_meta_id,
gst_analytics_segmentation_mtd_get_mtd_type (),
(GstAnalyticsSegmentationMtd *) rlt);
}

View file

@ -93,5 +93,10 @@ gst_analytics_relation_meta_add_segmentation_mtd (GstAnalyticsRelationMeta *
guint masks_loc_w, guint masks_loc_h, GstAnalyticsSegmentationMtd *
segmentation_mtd);
GST_ANALYTICS_META_API
gboolean
gst_analytics_relation_meta_get_segmentation_mtd (GstAnalyticsRelationMeta *
meta, guint an_meta_id, GstAnalyticsSegmentationMtd * rlt);
G_END_DECLS
#endif // __GST_ANALYTICS_SEGMENTATION_META_H__