analytics: Replace type quark with opaque struct pointer

This way, we can add function pointers in there for things like
transformations.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5863>
This commit is contained in:
Olivier Crête 2024-01-04 19:27:22 -05:00
parent 91815710dd
commit 5d3035553c
10 changed files with 192 additions and 208 deletions

View file

@ -9,7 +9,7 @@ and/or use gtk-doc annotations. -->
<alias name="MtdType" c:type="GstAnalyticsMtdType"> <alias name="MtdType" c:type="GstAnalyticsMtdType">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.h">Type of analytics meta data</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.h">Type of analytics meta data</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.h"/> <source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.h"/>
<type name="guint32" c:type="guint32"/> <type name="guintptr" c:type="guintptr"/>
</alias> </alias>
<constant name="AN_RELATION_META_TAG" value="GST-ANALYSIS-RELATION-META-TAG" c:type="GST_AN_RELATION_META_TAG"> <constant name="AN_RELATION_META_TAG" value="GST-ANALYSIS-RELATION-META-TAG" c:type="GST_AN_RELATION_META_TAG">
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.h"/> <source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.h"/>
@ -97,19 +97,11 @@ Get quark of the class at @index</doc>
</parameter> </parameter>
</parameters> </parameters>
</method> </method>
<function name="get_type_name" c:identifier="gst_analytics_cls_mtd_get_type_name" version="1.24"> <function name="get_mtd_type" c:identifier="gst_analytics_cls_mtd_get_mtd_type" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.c">Get the static string representing #GstAnalyticsMtd type.</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.c">Get a id identifying #GstAnalyticsMtd type.</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.h"/> <source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.h"/>
<return-value transfer-ownership="none"> <return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.c">#GstAnalyticsMtd type name.</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.c">opaque id of #GstAnalyticsMtd type</doc>
<type name="utf8" c:type="const gchar*"/>
</return-value>
</function>
<function name="get_type_quark" c:identifier="gst_analytics_cls_mtd_get_type_quark" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.c">Get a quark identifying #GstAnalyticsMtd type.</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.h"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.c">Quark of #GstAnalyticsMtd type</doc>
<type name="MtdType" c:type="GstAnalyticsMtdType"/> <type name="MtdType" c:type="GstAnalyticsMtdType"/>
</return-value> </return-value>
</function> </function>
@ -157,6 +149,20 @@ Get instance id</doc>
</instance-parameter> </instance-parameter>
</parameters> </parameters>
</method> </method>
<method name="get_mtd_type" c:identifier="gst_analytics_mtd_get_mtd_type" version="1.24">
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.h"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.c">opaque id of the type</doc>
<type name="MtdType" c:type="GstAnalyticsMtdType"/>
</return-value>
<parameters>
<instance-parameter name="instance" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.c">Instance of #GstAnalyticsMtd
Get analysis result type.</doc>
<type name="Mtd" c:type="GstAnalyticsMtd*"/>
</instance-parameter>
</parameters>
</method>
<method name="get_size" c:identifier="gst_analytics_mtd_get_size" version="1.24"> <method name="get_size" c:identifier="gst_analytics_mtd_get_size" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.c">@instance Instance of #GstAnalyticsRelatableMtd <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.c">@instance Instance of #GstAnalyticsRelatableMtd
Get instance size</doc> Get instance size</doc>
@ -171,20 +177,53 @@ Get instance size</doc>
</instance-parameter> </instance-parameter>
</parameters> </parameters>
</method> </method>
<method name="get_type_quark" c:identifier="gst_analytics_mtd_get_type_quark" version="1.24"> <function name="type_get_name" c:identifier="gst_analytics_mtd_type_get_name">
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.h"/> <source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.h"/>
<return-value transfer-ownership="none"> <return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.c">quark associated with type.</doc> <type name="utf8" c:type="const gchar*"/>
<type name="MtdType" c:type="GstAnalyticsMtdType"/>
</return-value> </return-value>
<parameters> <parameters>
<instance-parameter name="instance" transfer-ownership="none"> <parameter name="type" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.c">Instance of #GstAnalyticsMtd <type name="MtdType" c:type="GstAnalyticsMtdType"/>
Get analysis result type.</doc> </parameter>
<type name="Mtd" c:type="GstAnalyticsMtd*"/>
</instance-parameter>
</parameters> </parameters>
</method> </function>
</record>
<record name="MtdImpl" c:type="GstAnalyticsMtdImpl">
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.h"/>
<field name="name" writable="1">
<type name="utf8" c:type="const char*"/>
</field>
<field name="mtd_meta_transform">
<callback name="mtd_meta_transform">
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.h"/>
<return-value transfer-ownership="none">
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<parameter name="transbuf" transfer-ownership="none">
<type name="Gst.Buffer" c:type="GstBuffer*"/>
</parameter>
<parameter name="mtd" transfer-ownership="none">
<type name="Mtd" c:type="GstAnalyticsMtd*"/>
</parameter>
<parameter name="buffer" transfer-ownership="none">
<type name="Gst.Buffer" c:type="GstBuffer*"/>
</parameter>
<parameter name="type" transfer-ownership="none">
<type name="GLib.Quark" c:type="GQuark"/>
</parameter>
<parameter name="data" transfer-ownership="none">
<type name="gpointer" c:type="gpointer"/>
</parameter>
</parameters>
</callback>
</field>
<field name="_reserved" writable="1">
<array zero-terminated="0" fixed-size="20">
<type name="gpointer" c:type="gpointer"/>
</array>
</field>
</record> </record>
<record name="ODMtd" c:type="GstAnalyticsODMtd" version="1.24"> <record name="ODMtd" c:type="GstAnalyticsODMtd" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.h">Handle containing data required to use gst_analytics_od_mtd APIs. This type <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.h">Handle containing data required to use gst_analytics_od_mtd APIs. This type
@ -233,7 +272,8 @@ identified by @id is stored.</doc>
</parameter> </parameter>
</parameters> </parameters>
</method> </method>
<method name="get_type" c:identifier="gst_analytics_od_mtd_get_type" version="1.24"> <method name="get_obj_type" c:identifier="gst_analytics_od_mtd_get_obj_type" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Quark of the class of object associated with this location.</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.h"/> <source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.h"/>
<return-value transfer-ownership="none"> <return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Quark different from on success and 0 on failure.</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Quark different from on success and 0 on failure.</doc>
@ -241,25 +281,16 @@ identified by @id is stored.</doc>
</return-value> </return-value>
<parameters> <parameters>
<instance-parameter name="handle" transfer-ownership="none"> <instance-parameter name="handle" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Instance handle <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Instance handle</doc>
Quark of the class of object associated with this location.</doc>
<type name="ODMtd" c:type="GstAnalyticsODMtd*"/> <type name="ODMtd" c:type="GstAnalyticsODMtd*"/>
</instance-parameter> </instance-parameter>
</parameters> </parameters>
</method> </method>
<function name="get_type_name" c:identifier="gst_analytics_od_mtd_get_type_name" version="1.24"> <function name="get_mtd_type" c:identifier="gst_analytics_od_mtd_get_mtd_type" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Get a text representing object-detection metadata type.</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Get an id that represent object-detection metadata type</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.h"/> <source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.h"/>
<return-value transfer-ownership="none"> <return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">#GstAnalyticsMtd type name.</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Opaqu id of the #GstAnalyticsMtd type</doc>
<type name="utf8" c:type="const gchar*"/>
</return-value>
</function>
<function name="get_type_quark" c:identifier="gst_analytics_od_mtd_get_type_quark" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Get a quark that represent object-detection metadata type</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.h"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Quark of #GstAnalyticsMtd type</doc>
<type name="MtdType" c:type="GstAnalyticsMtdType"/> <type name="MtdType" c:type="GstAnalyticsMtdType"/>
</return-value> </return-value>
</function> </function>
@ -337,9 +368,9 @@ Since 1.24</doc>
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.c">Instance</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.c">Instance</doc>
<type name="RelationMeta" c:type="GstAnalyticsRelationMeta*"/> <type name="RelationMeta" c:type="GstAnalyticsRelationMeta*"/>
</instance-parameter> </instance-parameter>
<parameter name="type" transfer-ownership="none"> <parameter name="impl" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.c">Type of relatable (#GstAnalyticsRelatableMtd)</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.c">Implementation of relatable (#GstAnalyticsRelatableMtd)</doc>
<type name="MtdType" c:type="GstAnalyticsMtdType"/> <type name="MtdImpl" c:type="const GstAnalyticsMtdImpl*"/>
</parameter> </parameter>
<parameter name="size" transfer-ownership="none"> <parameter name="size" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.c">Size required</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.c">Size required</doc>
@ -839,19 +870,13 @@ Set tracking to lost</doc>
</parameter> </parameter>
</parameters> </parameters>
</method> </method>
<function name="get_type_name" c:identifier="gst_analytics_tracking_mtd_get_type_name"> <function name="get_mtd_type" c:identifier="gst_analytics_tracking_mtd_get_mtd_type" version="1.24">
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjecttrackingmtd.h"/> <source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjecttrackingmtd.h"/>
<return-value transfer-ownership="none"> <return-value transfer-ownership="none">
<type name="utf8" c:type="const gchar*"/> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjecttrackingmtd.c">id representing the type of GstAnalyticsRelatableMtd
</return-value>
</function>
<function name="get_type_quark" c:identifier="gst_analytics_tracking_mtd_get_type_quark" version="1.24">
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjecttrackingmtd.h"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjecttrackingmtd.c">Quark representing the type of GstAnalyticsRelatableMtd
Get the quark identifying the relatable type</doc> Get the opaque id identifying the relatable type</doc>
<type name="GLib.Quark" c:type="GQuark"/> <type name="MtdType" c:type="GstAnalyticsMtdType"/>
</return-value> </return-value>
</function> </function>
</record> </record>
@ -912,35 +937,30 @@ Since 1.24</doc>
</parameter> </parameter>
</parameters> </parameters>
</function> </function>
<function name="cls_mtd_get_type_name" c:identifier="gst_analytics_cls_mtd_get_type_name" moved-to="ClsMtd.get_type_name" version="1.24"> <function name="cls_mtd_get_mtd_type" c:identifier="gst_analytics_cls_mtd_get_mtd_type" moved-to="ClsMtd.get_mtd_type" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.c">Get the static string representing #GstAnalyticsMtd type.</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.c">Get a id identifying #GstAnalyticsMtd type.</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.h"/> <source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.h"/>
<return-value transfer-ownership="none"> <return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.c">#GstAnalyticsMtd type name.</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.c">opaque id of #GstAnalyticsMtd type</doc>
<type name="utf8" c:type="const gchar*"/>
</return-value>
</function>
<function name="cls_mtd_get_type_quark" c:identifier="gst_analytics_cls_mtd_get_type_quark" moved-to="ClsMtd.get_type_quark" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.c">Get a quark identifying #GstAnalyticsMtd type.</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.h"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.c">Quark of #GstAnalyticsMtd type</doc>
<type name="MtdType" c:type="GstAnalyticsMtdType"/> <type name="MtdType" c:type="GstAnalyticsMtdType"/>
</return-value> </return-value>
</function> </function>
<function name="od_mtd_get_type_name" c:identifier="gst_analytics_od_mtd_get_type_name" moved-to="ODMtd.get_type_name" version="1.24"> <function name="mtd_type_get_name" c:identifier="gst_analytics_mtd_type_get_name" moved-to="Mtd.type_get_name">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Get a text representing object-detection metadata type.</doc> <source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsmeta.h"/>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.h"/>
<return-value transfer-ownership="none"> <return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">#GstAnalyticsMtd type name.</doc>
<type name="utf8" c:type="const gchar*"/> <type name="utf8" c:type="const gchar*"/>
</return-value> </return-value>
<parameters>
<parameter name="type" transfer-ownership="none">
<type name="MtdType" c:type="GstAnalyticsMtdType"/>
</parameter>
</parameters>
</function> </function>
<function name="od_mtd_get_type_quark" c:identifier="gst_analytics_od_mtd_get_type_quark" moved-to="ODMtd.get_type_quark" version="1.24"> <function name="od_mtd_get_mtd_type" c:identifier="gst_analytics_od_mtd_get_mtd_type" moved-to="ODMtd.get_mtd_type" version="1.24">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Get a quark that represent object-detection metadata type</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Get an id that represent object-detection metadata type</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.h"/> <source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.h"/>
<return-value transfer-ownership="none"> <return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Quark of #GstAnalyticsMtd type</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjectdetectionmtd.c">Opaqu id of the #GstAnalyticsMtd type</doc>
<type name="MtdType" c:type="GstAnalyticsMtdType"/> <type name="MtdType" c:type="GstAnalyticsMtdType"/>
</return-value> </return-value>
</function> </function>
@ -972,19 +992,13 @@ instance.</doc>
<type name="Gst.MetaInfo" c:type="const GstMetaInfo*"/> <type name="Gst.MetaInfo" c:type="const GstMetaInfo*"/>
</return-value> </return-value>
</function> </function>
<function name="tracking_mtd_get_type_name" c:identifier="gst_analytics_tracking_mtd_get_type_name" moved-to="TrackingMtd.get_type_name"> <function name="tracking_mtd_get_mtd_type" c:identifier="gst_analytics_tracking_mtd_get_mtd_type" moved-to="TrackingMtd.get_mtd_type" version="1.24">
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjecttrackingmtd.h"/> <source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjecttrackingmtd.h"/>
<return-value transfer-ownership="none"> <return-value transfer-ownership="none">
<type name="utf8" c:type="const gchar*"/> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjecttrackingmtd.c">id representing the type of GstAnalyticsRelatableMtd
</return-value>
</function>
<function name="tracking_mtd_get_type_quark" c:identifier="gst_analytics_tracking_mtd_get_type_quark" moved-to="TrackingMtd.get_type_quark" version="1.24">
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjecttrackingmtd.h"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsobjecttrackingmtd.c">Quark representing the type of GstAnalyticsRelatableMtd
Get the quark identifying the relatable type</doc> Get the opaque id identifying the relatable type</doc>
<type name="GLib.Quark" c:type="GQuark"/> <type name="MtdType" c:type="GstAnalyticsMtdType"/>
</return-value> </return-value>
</function> </function>
</namespace> </namespace>

View file

@ -24,9 +24,10 @@
#include "gstanalyticsclassificationmtd.h" #include "gstanalyticsclassificationmtd.h"
#define GST_RELATABLE_MTD_CLASSIFICATION_TYPE_NAME "classification" static const GstAnalyticsMtdImpl cls_impl = {
"classification",
static char type[] = GST_RELATABLE_MTD_CLASSIFICATION_TYPE_NAME; NULL
};
typedef struct _GstAnalyticsClsConfLvlAndClass GstAnalyticsClsConfLvlAndClass; typedef struct _GstAnalyticsClsConfLvlAndClass GstAnalyticsClsConfLvlAndClass;
typedef struct _GstAnalyticsClsMtdData GstAnalyticsClsMtdData; typedef struct _GstAnalyticsClsMtdData GstAnalyticsClsMtdData;
@ -53,31 +54,17 @@ struct _GstAnalyticsClsMtdData
}; };
/** /**
* gst_analytics_cls_mtd_get_type_quark: * gst_analytics_cls_mtd_get_mtd_type:
* Get a quark identifying #GstAnalyticsMtd type. * Get a id identifying #GstAnalyticsMtd type.
* *
* Returns: Quark of #GstAnalyticsMtd type * Returns: opaque id of #GstAnalyticsMtd type
* *
* Since: 1.24 * Since: 1.24
*/ */
GstAnalyticsMtdType GstAnalyticsMtdType
gst_analytics_cls_mtd_get_type_quark (void) gst_analytics_cls_mtd_get_mtd_type (void)
{ {
return g_quark_from_static_string (type); return (GstAnalyticsMtdType) & cls_impl;
}
/**
* gst_analytics_cls_mtd_get_type_name:
* Get the static string representing #GstAnalyticsMtd type.
*
* Returns: #GstAnalyticsMtd type name.
*
* Since: 1.24
*/
const gchar *
gst_analytics_cls_mtd_get_type_name (void)
{
return GST_RELATABLE_MTD_CLASSIFICATION_TYPE_NAME;
} }
/** /**
@ -191,7 +178,6 @@ gst_analytics_relation_meta_add_cls_mtd (GstAnalyticsRelationMeta *
instance, gsize length, gfloat * confidence_levels, GQuark * class_quarks, instance, gsize length, gfloat * confidence_levels, GQuark * class_quarks,
GstAnalyticsClsMtd * cls_mtd) GstAnalyticsClsMtd * cls_mtd)
{ {
GQuark type = gst_analytics_cls_mtd_get_type_quark ();
g_return_val_if_fail (instance, FALSE); g_return_val_if_fail (instance, FALSE);
gsize confidence_levels_size = gsize confidence_levels_size =
(sizeof (GstAnalyticsClsConfLvlAndClass) * length); (sizeof (GstAnalyticsClsConfLvlAndClass) * length);
@ -199,7 +185,7 @@ gst_analytics_relation_meta_add_cls_mtd (GstAnalyticsRelationMeta *
GstAnalyticsClsConfLvlAndClass *conf_lvls_and_classes; GstAnalyticsClsConfLvlAndClass *conf_lvls_and_classes;
GstAnalyticsClsMtdData *cls_mtd_data = (GstAnalyticsClsMtdData *) GstAnalyticsClsMtdData *cls_mtd_data = (GstAnalyticsClsMtdData *)
gst_analytics_relation_meta_add_mtd (instance, type, size, cls_mtd); gst_analytics_relation_meta_add_mtd (instance, &cls_impl, size, cls_mtd);
if (cls_mtd_data) { if (cls_mtd_data) {
cls_mtd_data->length = length; cls_mtd_data->length = length;
for (gsize i = 0; i < length; i++) { for (gsize i = 0; i < length; i++) {
@ -255,5 +241,5 @@ gst_analytics_relation_meta_get_cls_mtd (GstAnalyticsRelationMeta * meta,
guint an_meta_id, GstAnalyticsClsMtd * rlt) guint an_meta_id, GstAnalyticsClsMtd * rlt)
{ {
return gst_analytics_relation_meta_get_mtd (meta, an_meta_id, return gst_analytics_relation_meta_get_mtd (meta, an_meta_id,
gst_analytics_cls_mtd_get_type_quark (), (GstAnalyticsClsMtd *) rlt); gst_analytics_cls_mtd_get_mtd_type (), (GstAnalyticsClsMtd *) rlt);
} }

View file

@ -42,10 +42,7 @@ G_BEGIN_DECLS
typedef struct _GstAnalyticsMtd GstAnalyticsClsMtd; typedef struct _GstAnalyticsMtd GstAnalyticsClsMtd;
GST_ANALYTICS_META_API GST_ANALYTICS_META_API
GstAnalyticsMtdType gst_analytics_cls_mtd_get_type_quark (void); GstAnalyticsMtdType gst_analytics_cls_mtd_get_mtd_type (void);
GST_ANALYTICS_META_API
const gchar *gst_analytics_cls_mtd_get_type_name (void);
GST_ANALYTICS_META_API GST_ANALYTICS_META_API
gfloat gst_analytics_cls_mtd_get_level (GstAnalyticsClsMtd * handle, gfloat gst_analytics_cls_mtd_get_level (GstAnalyticsClsMtd * handle,

View file

@ -39,7 +39,7 @@ GST_DEBUG_CATEGORY_STATIC (an_relation_meta_debug);
*/ */
typedef struct typedef struct
{ {
GstAnalyticsMtdType analysis_type; const GstAnalyticsMtdImpl *impl;
guint id; guint id;
gsize size; gsize size;
gpointer data[]; gpointer data[];
@ -88,8 +88,6 @@ typedef struct _GstAnalyticsRelationMeta
} GstAnalyticsRelationMeta; } GstAnalyticsRelationMeta;
static char invalid_type_name[] = "_invalid";
static guint static guint
gst_analytics_relation_meta_get_next_id (GstAnalyticsRelationMeta * meta); gst_analytics_relation_meta_get_next_id (GstAnalyticsRelationMeta * meta);
@ -111,25 +109,24 @@ gst_analytics_relation_meta_get_mtd_data_internal (GstAnalyticsRelationMeta *
} }
/** /**
* gst_analytics_mtd_get_type_quark: * gst_analytics_mtd_get_mtd_type:
* @instance: Instance of #GstAnalyticsMtd * @instance: Instance of #GstAnalyticsMtd
* Get analysis result type. * Get analysis result type.
* *
* Returns: quark associated with type. * Returns: opaque id of the type
* *
* Since: 1.24 * Since: 1.24
*/ */
GstAnalyticsMtdType GstAnalyticsMtdType
gst_analytics_mtd_get_type_quark (GstAnalyticsMtd * handle) gst_analytics_mtd_get_mtd_type (GstAnalyticsMtd * handle)
{ {
GstAnalyticsRelatableMtdData *rlt; GstAnalyticsRelatableMtdData *rlt;
rlt = gst_analytics_relation_meta_get_mtd_data_internal (handle->meta, rlt = gst_analytics_relation_meta_get_mtd_data_internal (handle->meta,
handle->id); handle->id);
g_return_val_if_fail (rlt != NULL, g_return_val_if_fail (rlt != NULL, 0);
g_quark_from_static_string (invalid_type_name));
return rlt->analysis_type; return (GstAnalyticsMtdType) rlt->impl;
} }
/** /**
@ -170,6 +167,15 @@ gst_analytics_mtd_get_size (GstAnalyticsMtd * handle)
return rlt->size; return rlt->size;
} }
const gchar *
gst_analytics_mtd_type_get_name (GstAnalyticsMtdType type)
{
GstAnalyticsMtdImpl *impl = (GstAnalyticsMtdImpl *) type;
g_return_val_if_fail (impl != NULL, NULL);
return impl->name;
}
/** /**
* gst_analytics_relation_get_length: * gst_analytics_relation_get_length:
@ -801,7 +807,7 @@ gst_buffer_get_analytics_relation_meta (GstBuffer * buffer)
/** /**
* gst_analytics_relation_meta_add_mtd: (skip) * gst_analytics_relation_meta_add_mtd: (skip)
* @meta: Instance * @meta: Instance
* @type: Type of relatable (#GstAnalyticsRelatableMtd) * @impl: Implementation of relatable (#GstAnalyticsRelatableMtd)
* @size: Size required * @size: Size required
* @rlt_mtd: Updated handle * @rlt_mtd: Updated handle
* *
@ -814,7 +820,7 @@ gst_buffer_get_analytics_relation_meta (GstBuffer * buffer)
*/ */
gpointer gpointer
gst_analytics_relation_meta_add_mtd (GstAnalyticsRelationMeta * meta, gst_analytics_relation_meta_add_mtd (GstAnalyticsRelationMeta * meta,
GstAnalyticsMtdType type, gsize size, GstAnalyticsMtd * rlt_mtd) const GstAnalyticsMtdImpl * impl, gsize size, GstAnalyticsMtd * rlt_mtd)
{ {
gsize object_size; gsize object_size;
gsize new_size; gsize new_size;
@ -860,7 +866,7 @@ gst_analytics_relation_meta_add_mtd (GstAnalyticsRelationMeta * meta,
dest = dest =
(GstAnalyticsRelatableMtdData *) (meta->analysis_results + (GstAnalyticsRelatableMtdData *) (meta->analysis_results +
meta->offset); meta->offset);
dest->analysis_type = type; dest->impl = impl;
dest->id = gst_analytics_relation_meta_get_next_id (meta); dest->id = gst_analytics_relation_meta_get_next_id (meta);
dest->size = size; dest->size = size;
meta->mtd_data_lookup[dest->id] = meta->offset; meta->mtd_data_lookup[dest->id] = meta->offset;
@ -870,7 +876,7 @@ gst_analytics_relation_meta_add_mtd (GstAnalyticsRelationMeta * meta,
rlt_mtd->meta = meta; rlt_mtd->meta = meta;
GST_CAT_TRACE (GST_CAT_AN_RELATION, "Add %p relatable type=%s (%" GST_CAT_TRACE (GST_CAT_AN_RELATION, "Add %p relatable type=%s (%"
G_GSIZE_FORMAT " / %" G_GSIZE_FORMAT ").", dest, G_GSIZE_FORMAT " / %" G_GSIZE_FORMAT ").", dest,
g_quark_to_string (type), new_size, meta->max_size); impl->name, new_size, meta->max_size);
} else { } else {
GST_CAT_ERROR (GST_CAT_AN_RELATION, GST_CAT_ERROR (GST_CAT_AN_RELATION,
"Failed to add relatable, out-of-space (%" G_GSIZE_FORMAT " / %" "Failed to add relatable, out-of-space (%" G_GSIZE_FORMAT " / %"
@ -915,11 +921,12 @@ gst_analytics_relation_meta_get_mtd (GstAnalyticsRelationMeta * meta,
if (d == NULL) if (d == NULL)
return FALSE; return FALSE;
if (d->analysis_type == 0) { if (d->impl == NULL) {
return FALSE; return FALSE;
} }
if (type != GST_ANALYTICS_MTD_TYPE_ANY && d->analysis_type != type) { if (type != GST_ANALYTICS_MTD_TYPE_ANY &&
d->impl != (GstAnalyticsMtdImpl *) type) {
return FALSE; return FALSE;
} }
@ -976,8 +983,8 @@ gst_analytics_relation_meta_get_direct_related (GstAnalyticsRelationMeta * meta,
gsize i; gsize i;
GST_CAT_TRACE (GST_CAT_AN_RELATION, GST_CAT_TRACE (GST_CAT_AN_RELATION,
"Looking for %s related to %u by %d", g_quark_to_string (type), "Looking for %s related to %u by %d",
an_meta_id, relation_type); gst_analytics_mtd_type_get_name (type), an_meta_id, relation_type);
g_return_val_if_fail (rmeta != NULL, FALSE); g_return_val_if_fail (rmeta != NULL, FALSE);
g_return_val_if_fail (type != 0, FALSE); g_return_val_if_fail (type != 0, FALSE);
@ -1009,7 +1016,7 @@ gst_analytics_relation_meta_get_direct_related (GstAnalyticsRelationMeta * meta,
rlt_mtd_data = (GstAnalyticsRelatableMtdData *) rlt_mtd_data = (GstAnalyticsRelatableMtdData *)
(meta->mtd_data_lookup[i] + meta->analysis_results); (meta->mtd_data_lookup[i] + meta->analysis_results);
rlt_mtd->id = rlt_mtd_data->id; rlt_mtd->id = rlt_mtd_data->id;
if (gst_analytics_mtd_get_type_quark (rlt_mtd) == type) { if (gst_analytics_mtd_get_mtd_type (rlt_mtd) == type) {
if (state) { if (state) {
*state = GSIZE_TO_POINTER (G_MINSSIZE | i); *state = GSIZE_TO_POINTER (G_MINSSIZE | i);
} }
@ -1059,7 +1066,7 @@ gst_analytics_relation_meta_iterate (GstAnalyticsRelationMeta * meta,
rlt_mtd->id = rlt_mtd_data->id; rlt_mtd->id = rlt_mtd_data->id;
rlt_mtd->meta = meta; rlt_mtd->meta = meta;
if (type == GST_ANALYTICS_MTD_TYPE_ANY || if (type == GST_ANALYTICS_MTD_TYPE_ANY ||
gst_analytics_mtd_get_type_quark (rlt_mtd) == type) { gst_analytics_mtd_get_mtd_type (rlt_mtd) == type) {
*state = GSIZE_TO_POINTER (G_MINSSIZE | index); *state = GSIZE_TO_POINTER (G_MINSSIZE | index);
return TRUE; return TRUE;
} }

View file

@ -41,7 +41,7 @@ typedef struct _GstAnalyticsMtd GstAnalyticsMtd;
* *
* Since: 1.24 * Since: 1.24
*/ */
typedef guint32 GstAnalyticsMtdType; typedef guintptr GstAnalyticsMtdType;
/** /**
* GST_ANALYTICS_MTD_TYPE_ANY: * GST_ANALYTICS_MTD_TYPE_ANY:
@ -75,8 +75,18 @@ struct _GstAnalyticsMtd
GstAnalyticsRelationMeta *meta; GstAnalyticsRelationMeta *meta;
}; };
typedef struct {
const char *name;
gboolean (*mtd_meta_transform) (GstBuffer *transbuf, GstAnalyticsMtd *mtd,
GstBuffer *buffer, GQuark type,
gpointer data);
gpointer _reserved[GST_PADDING_LARGE];
} GstAnalyticsMtdImpl;
GST_ANALYTICS_META_API GST_ANALYTICS_META_API
GstAnalyticsMtdType gst_analytics_mtd_get_type_quark (GstAnalyticsMtd * instance); GstAnalyticsMtdType gst_analytics_mtd_get_mtd_type (GstAnalyticsMtd * instance);
GST_ANALYTICS_META_API GST_ANALYTICS_META_API
guint gst_analytics_mtd_get_id (GstAnalyticsMtd * instance); guint gst_analytics_mtd_get_id (GstAnalyticsMtd * instance);
@ -84,6 +94,9 @@ guint gst_analytics_mtd_get_id (GstAnalyticsMtd * instance);
GST_ANALYTICS_META_API GST_ANALYTICS_META_API
gsize gst_analytics_mtd_get_size (GstAnalyticsMtd * instance); gsize gst_analytics_mtd_get_size (GstAnalyticsMtd * instance);
GST_ANALYTICS_META_API
const gchar *gst_analytics_mtd_type_get_name (GstAnalyticsMtdType type);
typedef struct _GstAnalyticsRelationMetaInitParams typedef struct _GstAnalyticsRelationMetaInitParams
GstAnalyticsRelationMetaInitParams; GstAnalyticsRelationMetaInitParams;
@ -174,7 +187,7 @@ gst_buffer_get_analytics_relation_meta (GstBuffer * buffer);
GST_ANALYTICS_META_API GST_ANALYTICS_META_API
gpointer gpointer
gst_analytics_relation_meta_add_mtd (GstAnalyticsRelationMeta * meta, gst_analytics_relation_meta_add_mtd (GstAnalyticsRelationMeta * meta,
GstAnalyticsMtdType type, gsize size, GstAnalyticsMtd * rlt_mtd); const GstAnalyticsMtdImpl * impl, gsize size, GstAnalyticsMtd * rlt_mtd);
GST_ANALYTICS_META_API GST_ANALYTICS_META_API
gboolean gboolean

View file

@ -24,10 +24,6 @@
#include "gstanalyticsobjectdetectionmtd.h" #include "gstanalyticsobjectdetectionmtd.h"
#define GST_RELATABLE_MTD_OD_TYPE_NAME "object-detection"
static char type[] = GST_RELATABLE_MTD_OD_TYPE_NAME;
typedef struct _GstAnalyticsODMtdData GstAnalyticsODMtdData; typedef struct _GstAnalyticsODMtdData GstAnalyticsODMtdData;
/** /**
@ -53,33 +49,23 @@ struct _GstAnalyticsODMtdData
gfloat location_confidence_lvl; gfloat location_confidence_lvl;
}; };
static const GstAnalyticsMtdImpl od_impl = {
"object-detection",
NULL
};
/** /**
* gst_analytics_od_mtd_get_type_quark: * gst_analytics_od_mtd_get_mtd_type:
* Get a quark that represent object-detection metadata type * Get an id that represent object-detection metadata type
* *
* Returns: Quark of #GstAnalyticsMtd type * Returns: Opaqu id of the #GstAnalyticsMtd type
* *
* Since: 1.24 * Since: 1.24
*/ */
GstAnalyticsMtdType GstAnalyticsMtdType
gst_analytics_od_mtd_get_type_quark (void) gst_analytics_od_mtd_get_mtd_type (void)
{ {
return g_quark_from_static_string (type); return (GstAnalyticsMtdType) & od_impl;
}
/**
* gst_analytics_od_mtd_get_type_name:
* Get a text representing object-detection metadata type.
*
* Returns: #GstAnalyticsMtd type name.
*
* Since: 1.24
*/
const gchar *
gst_analytics_od_mtd_get_type_name (void)
{
return GST_RELATABLE_MTD_OD_TYPE_NAME;
} }
/** /**
@ -121,20 +107,21 @@ gst_analytics_od_mtd_get_location (GstAnalyticsODMtd * instance,
} }
/** /**
* gst_analytics_od_mtd_get_type: * gst_analytics_od_mtd_get_obj_type:
* @handle: Instance handle * @handle: Instance handle
*
* Quark of the class of object associated with this location. * Quark of the class of object associated with this location.
*
* Returns: Quark different from on success and 0 on failure. * Returns: Quark different from on success and 0 on failure.
* *
* Since: 1.24 * Since: 1.24
*/ */
GQuark GQuark
gst_analytics_od_mtd_get_type (GstAnalyticsODMtd * handle) gst_analytics_od_mtd_get_obj_type (GstAnalyticsODMtd * handle)
{ {
GstAnalyticsODMtdData *data; GstAnalyticsODMtdData *data;
g_return_val_if_fail (handle != NULL, 0); g_return_val_if_fail (handle != NULL, 0);
data = gst_analytics_relation_meta_get_mtd_data (handle->meta, data = gst_analytics_relation_meta_get_mtd_data (handle->meta, handle->id);
handle->id);
g_return_val_if_fail (data != NULL, 0); g_return_val_if_fail (data != NULL, 0);
return data->object_type; return data->object_type;
} }
@ -161,10 +148,9 @@ gst_analytics_relation_meta_add_od_mtd (GstAnalyticsRelationMeta *
gfloat loc_conf_lvl, GstAnalyticsODMtd * od_mtd) gfloat loc_conf_lvl, GstAnalyticsODMtd * od_mtd)
{ {
g_return_val_if_fail (instance != NULL, FALSE); g_return_val_if_fail (instance != NULL, FALSE);
GstAnalyticsMtdType mtd_type = gst_analytics_od_mtd_get_type_quark ();
gsize size = sizeof (GstAnalyticsODMtdData); gsize size = sizeof (GstAnalyticsODMtdData);
GstAnalyticsODMtdData *od_mtd_data = (GstAnalyticsODMtdData *) GstAnalyticsODMtdData *od_mtd_data = (GstAnalyticsODMtdData *)
gst_analytics_relation_meta_add_mtd (instance, mtd_type, size, od_mtd); gst_analytics_relation_meta_add_mtd (instance, &od_impl, size, od_mtd);
if (od_mtd_data) { if (od_mtd_data) {
od_mtd_data->x = x; od_mtd_data->x = x;
od_mtd_data->y = y; od_mtd_data->y = y;
@ -195,5 +181,5 @@ gst_analytics_relation_meta_get_od_mtd (GstAnalyticsRelationMeta * meta,
guint an_meta_id, GstAnalyticsODMtd * rlt) guint an_meta_id, GstAnalyticsODMtd * rlt)
{ {
return gst_analytics_relation_meta_get_mtd (meta, an_meta_id, return gst_analytics_relation_meta_get_mtd (meta, an_meta_id,
gst_analytics_od_mtd_get_type_quark (), (GstAnalyticsODMtd *) rlt); gst_analytics_od_mtd_get_mtd_type (), (GstAnalyticsODMtd *) rlt);
} }

View file

@ -46,17 +46,14 @@ G_BEGIN_DECLS
typedef struct _GstAnalyticsMtd GstAnalyticsODMtd; typedef struct _GstAnalyticsMtd GstAnalyticsODMtd;
GST_ANALYTICS_META_API GST_ANALYTICS_META_API
GstAnalyticsMtdType gst_analytics_od_mtd_get_type_quark (void); GstAnalyticsMtdType gst_analytics_od_mtd_get_mtd_type (void);
GST_ANALYTICS_META_API
const gchar *gst_analytics_od_mtd_get_type_name (void);
GST_ANALYTICS_META_API GST_ANALYTICS_META_API
gboolean gst_analytics_od_mtd_get_location (GstAnalyticsODMtd * instance, gboolean gst_analytics_od_mtd_get_location (GstAnalyticsODMtd * instance,
gint * x, gint * y, gint * w, gint * h, gfloat * loc_conf_lvl); gint * x, gint * y, gint * w, gint * h, gfloat * loc_conf_lvl);
GST_ANALYTICS_META_API GST_ANALYTICS_META_API
GQuark gst_analytics_od_mtd_get_type (GstAnalyticsODMtd * handle); GQuark gst_analytics_od_mtd_get_obj_type (GstAnalyticsODMtd * handle);
GST_ANALYTICS_META_API GST_ANALYTICS_META_API
gboolean gst_analytics_relation_meta_add_od_mtd ( gboolean gst_analytics_relation_meta_add_od_mtd (

View file

@ -24,8 +24,6 @@
#include "gstanalyticsobjecttrackingmtd.h" #include "gstanalyticsobjecttrackingmtd.h"
#define GST_RELATABLE_MTD_TRACKING_TYPE_NAME "object-tracking"
typedef struct _GstAnalyticsTrackingMtdData GstAnalyticsTrackingMtdData; typedef struct _GstAnalyticsTrackingMtdData GstAnalyticsTrackingMtdData;
/** /**
@ -48,34 +46,23 @@ struct _GstAnalyticsTrackingMtdData
}; };
static char type[] = GST_RELATABLE_MTD_TRACKING_TYPE_NAME; static const GstAnalyticsMtdImpl tracking_impl = {
"object-tracking",
NULL
};
/** /**
* gst_analytics_tracking_mtd_get_type_quark: * gst_analytics_tracking_mtd_get_mtd_type:
* Returns: Quark representing the type of GstAnalyticsRelatableMtd * Returns: id representing the type of GstAnalyticsRelatableMtd
* *
* Get the quark identifying the relatable type * Get the opaque id identifying the relatable type
* *
* Since: 1.24 * Since: 1.24
*/ */
GstAnalyticsMtdType GstAnalyticsMtdType
gst_analytics_tracking_mtd_get_type_quark (void) gst_analytics_tracking_mtd_get_mtd_type (void)
{ {
return g_quark_from_static_string (type); return (GstAnalyticsMtdType) & tracking_impl;
}
/**
* gst_an_od_mtd_get_type_name:
* Returns: #GstAnalyticsMtd type name.
*
* Get the name identifying relatable type name
*
* Since: 1.24
*/
const gchar *
gst_analytics_tracking_mtd_get_type_name (void)
{
return GST_RELATABLE_MTD_TRACKING_TYPE_NAME;
} }
/** /**
@ -176,11 +163,10 @@ gst_analytics_relation_meta_add_tracking_mtd (GstAnalyticsRelationMeta *
{ {
g_return_val_if_fail (instance, FALSE); g_return_val_if_fail (instance, FALSE);
GstAnalyticsMtdType type = gst_analytics_tracking_mtd_get_type_quark ();
gsize size = sizeof (GstAnalyticsTrackingMtdData); gsize size = sizeof (GstAnalyticsTrackingMtdData);
GstAnalyticsTrackingMtdData *trk_mtd_data = (GstAnalyticsTrackingMtdData *) GstAnalyticsTrackingMtdData *trk_mtd_data = (GstAnalyticsTrackingMtdData *)
gst_analytics_relation_meta_add_mtd (instance, gst_analytics_relation_meta_add_mtd (instance, &tracking_impl, size,
type, size, trk_mtd); trk_mtd);
if (trk_mtd_data) { if (trk_mtd_data) {
trk_mtd_data->tracking_id = tracking_id; trk_mtd_data->tracking_id = tracking_id;
@ -210,6 +196,6 @@ gst_analytics_relation_meta_get_tracking_mtd (GstAnalyticsRelationMeta * meta,
guint an_meta_id, GstAnalyticsTrackingMtd * rlt) guint an_meta_id, GstAnalyticsTrackingMtd * rlt)
{ {
return gst_analytics_relation_meta_get_mtd (meta, an_meta_id, return gst_analytics_relation_meta_get_mtd (meta, an_meta_id,
gst_analytics_tracking_mtd_get_type_quark (), gst_analytics_tracking_mtd_get_mtd_type (),
(GstAnalyticsTrackingMtd *) rlt); (GstAnalyticsTrackingMtd *) rlt);
} }

View file

@ -46,10 +46,7 @@ G_BEGIN_DECLS
typedef struct _GstAnalyticsMtd GstAnalyticsTrackingMtd; typedef struct _GstAnalyticsMtd GstAnalyticsTrackingMtd;
GST_ANALYTICS_META_API GST_ANALYTICS_META_API
GQuark gst_analytics_tracking_mtd_get_type_quark (void); GstAnalyticsMtdType gst_analytics_tracking_mtd_get_mtd_type (void);
GST_ANALYTICS_META_API
const gchar *gst_analytics_tracking_mtd_get_type_name (void);
GST_ANALYTICS_META_API GST_ANALYTICS_META_API
gboolean gst_analytics_tracking_mtd_update_last_seen (GstAnalyticsTrackingMtd * instance, gboolean gst_analytics_tracking_mtd_update_last_seen (GstAnalyticsTrackingMtd * instance,

View file

@ -654,10 +654,10 @@ GST_START_TEST (test_od_cls_relation)
exist = gst_analytics_relation_meta_get_mtd (rmeta, ids[0], 0, &rlt_mtd); exist = gst_analytics_relation_meta_get_mtd (rmeta, ids[0], 0, &rlt_mtd);
fail_unless (exist == TRUE); fail_unless (exist == TRUE);
GQuark mtd_type = gst_analytics_mtd_get_type_quark (&rlt_mtd); GstAnalyticsMtdType mtd_type = gst_analytics_mtd_get_mtd_type (&rlt_mtd);
/* Verify relatable meta with id == 1 is of type Object Detection */ /* Verify relatable meta with id == 1 is of type Object Detection */
fail_unless (mtd_type == gst_analytics_od_mtd_get_type_quark ()); fail_unless (mtd_type == gst_analytics_od_mtd_get_mtd_type ());
gst_analytics_od_mtd_get_location ((GstAnalyticsODMtd *) & rlt_mtd, &_x, &_y, gst_analytics_od_mtd_get_location ((GstAnalyticsODMtd *) & rlt_mtd, &_x, &_y,
&_w, &_h, &_loc_conf_lvl); &_w, &_h, &_loc_conf_lvl);
@ -667,14 +667,14 @@ GST_START_TEST (test_od_cls_relation)
fail_unless (_h == h); fail_unless (_h == h);
fail_unless (_loc_conf_lvl == loc_conf_lvl); fail_unless (_loc_conf_lvl == loc_conf_lvl);
GST_LOG ("mtd_type:%s", g_quark_to_string (mtd_type)); GST_LOG ("mtd_type:%s", gst_analytics_mtd_type_get_name (mtd_type));
exist = gst_analytics_relation_meta_get_mtd (rmeta, ids[1], 0, &rlt_mtd); exist = gst_analytics_relation_meta_get_mtd (rmeta, ids[1], 0, &rlt_mtd);
fail_unless (exist == TRUE); fail_unless (exist == TRUE);
mtd_type = gst_analytics_mtd_get_type_quark (&rlt_mtd); mtd_type = gst_analytics_mtd_get_mtd_type (&rlt_mtd);
/* Verify relatable meta with id == 0 is of type classification */ /* Verify relatable meta with id == 0 is of type classification */
fail_unless (mtd_type == gst_analytics_cls_mtd_get_type_quark ()); fail_unless (mtd_type == gst_analytics_cls_mtd_get_mtd_type ());
gint index = gint index =
gst_analytics_cls_mtd_get_index_by_quark ((GstAnalyticsClsMtd *) & gst_analytics_cls_mtd_get_index_by_quark ((GstAnalyticsClsMtd *) &
rlt_mtd, rlt_mtd,
@ -691,7 +691,7 @@ GST_START_TEST (test_od_cls_relation)
gst_analytics_cls_mtd_get_level ((GstAnalyticsClsMtd *) & rlt_mtd, index); gst_analytics_cls_mtd_get_level ((GstAnalyticsClsMtd *) & rlt_mtd, index);
fail_unless (lvl == 0.3f); fail_unless (lvl == 0.3f);
GST_LOG ("mtd_type:%s", g_quark_to_string (mtd_type)); GST_LOG ("mtd_type:%s", gst_analytics_mtd_type_get_name (mtd_type));
GST_LOG ("cat %f [%d, %d %d, %d", lvl, _x, _y, _w, _h); GST_LOG ("cat %f [%d, %d %d, %d", lvl, _x, _y, _w, _h);
gst_buffer_unref (buf); gst_buffer_unref (buf);
@ -714,7 +714,8 @@ GST_START_TEST (test_multi_od_cls_relation)
GArray *path = NULL; GArray *path = NULL;
gfloat _loc_conf_lvl; gfloat _loc_conf_lvl;
gint x, _x, y, _y, w, _w, h, _h; gint x, _x, y, _y, w, _w, h, _h;
GQuark mtd_type, cls_type; GstAnalyticsMtdType mtd_type;
GQuark cls_type;
GstAnalyticsMtd mtd; GstAnalyticsMtd mtd;
gpointer state = NULL; gpointer state = NULL;
GQuark class_quarks[2]; GQuark class_quarks[2];
@ -810,8 +811,8 @@ GST_START_TEST (test_multi_od_cls_relation)
* the correct data. * the correct data.
*/ */
gst_analytics_relation_meta_get_mtd (rmeta, ids[0], 0, &mtd); gst_analytics_relation_meta_get_mtd (rmeta, ids[0], 0, &mtd);
mtd_type = gst_analytics_mtd_get_type_quark (&mtd); mtd_type = gst_analytics_mtd_get_mtd_type (&mtd);
fail_unless (mtd_type == gst_analytics_od_mtd_get_type_quark ()); fail_unless (mtd_type == gst_analytics_od_mtd_get_mtd_type ());
gst_analytics_od_mtd_get_location ((GstAnalyticsODMtd *) & mtd, &_x, &_y, &_w, gst_analytics_od_mtd_get_location ((GstAnalyticsODMtd *) & mtd, &_x, &_y, &_w,
&_h, &_loc_conf_lvl); &_h, &_loc_conf_lvl);
@ -821,14 +822,14 @@ GST_START_TEST (test_multi_od_cls_relation)
fail_unless (_h == 16); fail_unless (_h == 16);
fail_unless (_loc_conf_lvl == 0.7f); fail_unless (_loc_conf_lvl == 0.7f);
GST_LOG ("mtd_type:%s", g_quark_to_string (mtd_type)); GST_LOG ("mtd_type:%s", gst_analytics_mtd_type_get_name (mtd_type));
/* Verify the relatable metadata 2 is of correct type /* Verify the relatable metadata 2 is of correct type
* (ObjectDetection). * (ObjectDetection).
*/ */
gst_analytics_relation_meta_get_mtd (rmeta, ids[1], 0, &mtd); gst_analytics_relation_meta_get_mtd (rmeta, ids[1], 0, &mtd);
mtd_type = gst_analytics_mtd_get_type_quark (&mtd); mtd_type = gst_analytics_mtd_get_mtd_type (&mtd);
fail_unless (mtd_type == gst_analytics_cls_mtd_get_type_quark ()); fail_unless (mtd_type == gst_analytics_cls_mtd_get_mtd_type ());
/* Verify data of the CLASSIFICATION retrieved */ /* Verify data of the CLASSIFICATION retrieved */
gint index = gint index =
@ -843,7 +844,7 @@ GST_START_TEST (test_multi_od_cls_relation)
gst_analytics_cls_mtd_get_index_by_quark ((GstAnalyticsClsMtd *) & mtd, gst_analytics_cls_mtd_get_index_by_quark ((GstAnalyticsClsMtd *) & mtd,
g_quark_from_string ("cat")); g_quark_from_string ("cat"));
lvl = gst_analytics_cls_mtd_get_level ((GstAnalyticsClsMtd *) & mtd, index); lvl = gst_analytics_cls_mtd_get_level ((GstAnalyticsClsMtd *) & mtd, index);
GST_LOG ("mtd_type:%s", g_quark_to_string (mtd_type)); GST_LOG ("mtd_type:%s", gst_analytics_mtd_type_get_name (mtd_type));
GST_LOG ("cat %f [%d, %d %d, %d", lvl, _x, _y, _w, _h); GST_LOG ("cat %f [%d, %d %d, %d", lvl, _x, _y, _w, _h);
fail_unless (lvl == 0.9f); fail_unless (lvl == 0.9f);
@ -852,7 +853,7 @@ GST_START_TEST (test_multi_od_cls_relation)
* Verify it's the first classification metadata * Verify it's the first classification metadata
*/ */
gst_analytics_relation_meta_get_direct_related (rmeta, od_mtd[0].id, gst_analytics_relation_meta_get_direct_related (rmeta, od_mtd[0].id,
GST_ANALYTICS_REL_TYPE_CONTAIN, gst_analytics_cls_mtd_get_type_quark (), GST_ANALYTICS_REL_TYPE_CONTAIN, gst_analytics_cls_mtd_get_mtd_type (),
&state, &mtd); &state, &mtd);
cls_id = gst_analytics_mtd_get_id (&mtd); cls_id = gst_analytics_mtd_get_id (&mtd);
@ -865,7 +866,7 @@ GST_START_TEST (test_multi_od_cls_relation)
* Verify it's the first classification metadata * Verify it's the first classification metadata
*/ */
gst_analytics_relation_meta_get_direct_related (rmeta, od_mtd[1].id, gst_analytics_relation_meta_get_direct_related (rmeta, od_mtd[1].id,
GST_ANALYTICS_REL_TYPE_CONTAIN, gst_analytics_cls_mtd_get_type_quark (), GST_ANALYTICS_REL_TYPE_CONTAIN, gst_analytics_cls_mtd_get_mtd_type (),
&state, &mtd); &state, &mtd);
cls_id = gst_analytics_mtd_get_id (&mtd); cls_id = gst_analytics_mtd_get_id (&mtd);
@ -884,7 +885,7 @@ GST_START_TEST (test_multi_od_cls_relation)
state = NULL; state = NULL;
ret = gst_analytics_relation_meta_get_direct_related (rmeta, od_mtd[1].id, ret = gst_analytics_relation_meta_get_direct_related (rmeta, od_mtd[1].id,
GST_ANALYTICS_REL_TYPE_CONTAIN, gst_analytics_od_mtd_get_type_quark (), GST_ANALYTICS_REL_TYPE_CONTAIN, gst_analytics_od_mtd_get_mtd_type (),
&state, &mtd); &state, &mtd);
fail_unless (ret == FALSE); fail_unless (ret == FALSE);