mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 03:31:05 +00:00
analytics: Change indexes type from i32 -> gsize
- gst_analytics_cls_mtd_get_length() return a gsize, this type dicated index type for gst_analytics_cls_mtd_get_quark() and gst_analytics_cls_mtd_get_level(). - Minor cleanup/improvement on index validation. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6018>
This commit is contained in:
parent
f1d2147ba8
commit
8122f623f6
3 changed files with 9 additions and 7 deletions
|
@ -75,7 +75,7 @@ Get number of classes</doc>
|
|||
</instance-parameter>
|
||||
<parameter name="index" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.c">Object class index</doc>
|
||||
<type name="gint" c:type="gint"/>
|
||||
<type name="gsize" c:type="gsize"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
|
@ -93,7 +93,7 @@ Get number of classes</doc>
|
|||
<parameter name="index" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/analytics/gstanalyticsclassificationmtd.c">index of the class
|
||||
Get quark of the class at @index</doc>
|
||||
<type name="gint" c:type="gint"/>
|
||||
<type name="gsize" c:type="gsize"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
|
|
|
@ -78,10 +78,9 @@ gst_analytics_cls_mtd_get_mtd_type (void)
|
|||
* Since: 1.24
|
||||
*/
|
||||
gfloat
|
||||
gst_analytics_cls_mtd_get_level (GstAnalyticsClsMtd * handle, gint index)
|
||||
gst_analytics_cls_mtd_get_level (GstAnalyticsClsMtd * handle, gsize index)
|
||||
{
|
||||
g_return_val_if_fail (handle, -1.0);
|
||||
g_return_val_if_fail (index >= 0, -1.0);
|
||||
g_return_val_if_fail (handle->meta != NULL, -1.0);
|
||||
GstAnalyticsClsMtdData *cls_mtd_data;
|
||||
cls_mtd_data = gst_analytics_relation_meta_get_mtd_data (handle->meta,
|
||||
|
@ -148,13 +147,15 @@ gst_analytics_cls_mtd_get_length (GstAnalyticsClsMtd * handle)
|
|||
* Since: 1.24
|
||||
*/
|
||||
GQuark
|
||||
gst_analytics_cls_mtd_get_quark (GstAnalyticsClsMtd * handle, gint index)
|
||||
gst_analytics_cls_mtd_get_quark (GstAnalyticsClsMtd * handle, gsize index)
|
||||
{
|
||||
GstAnalyticsClsMtdData *cls_mtd_data;
|
||||
g_return_val_if_fail (handle, 0);
|
||||
cls_mtd_data = gst_analytics_relation_meta_get_mtd_data (handle->meta,
|
||||
handle->id);
|
||||
g_return_val_if_fail (cls_mtd_data != NULL, 0);
|
||||
g_return_val_if_fail (cls_mtd_data->length > index, 0);
|
||||
|
||||
return cls_mtd_data->confidence_levels_and_classes[index].class;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ GstAnalyticsMtdType gst_analytics_cls_mtd_get_mtd_type (void);
|
|||
|
||||
GST_ANALYTICS_META_API
|
||||
gfloat gst_analytics_cls_mtd_get_level (GstAnalyticsClsMtd * handle,
|
||||
gint index);
|
||||
gsize index);
|
||||
|
||||
GST_ANALYTICS_META_API
|
||||
gint gst_analytics_cls_mtd_get_index_by_quark (GstAnalyticsClsMtd * handle,
|
||||
|
@ -56,7 +56,8 @@ GST_ANALYTICS_META_API
|
|||
gsize gst_analytics_cls_mtd_get_length (GstAnalyticsClsMtd * handle);
|
||||
|
||||
GST_ANALYTICS_META_API
|
||||
GQuark gst_analytics_cls_mtd_get_quark (GstAnalyticsClsMtd * handle, gint index);
|
||||
GQuark gst_analytics_cls_mtd_get_quark (GstAnalyticsClsMtd * handle,
|
||||
gsize index);
|
||||
|
||||
GST_ANALYTICS_META_API
|
||||
gboolean
|
||||
|
|
Loading…
Reference in a new issue