X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gst%2Fgstmeta.c;h=4bcaa7aa512ba83d06b20936c5fa5cd846ac6542;hb=5470f6df00595f4ab44871e0e633bf15006abc5c;hp=84d9838f9048b01b6539f7a57b1185d1221928ec;hpb=b5028383ab9cc96e72595d193700a177a6587891;p=platform%2Fupstream%2Fgstreamer.git diff --git a/gst/gstmeta.c b/gst/gstmeta.c index 84d9838..4bcaa7a 100644 --- a/gst/gstmeta.c +++ b/gst/gstmeta.c @@ -70,7 +70,7 @@ _priv_gst_meta_initialize (void) /** * gst_meta_api_type_register: * @api: an API to register - * @tags: tags for @api + * @tags: (array zero-terminated=1): tags for @api * * Register and return a GType for the @api and associate it with * @tags. @@ -227,3 +227,51 @@ gst_meta_get_info (const gchar * impl) return info; } + +/** + * gst_meta_get_seqnum: + * @meta: a #GstMeta + * + * Gets seqnum for this meta. + * + * Since: 1.16 + */ +guint64 +gst_meta_get_seqnum (const GstMeta * meta) +{ + GstMetaItem *meta_item; + guint8 *p; + + g_return_val_if_fail (meta != NULL, 0); + + p = (guint8 *) meta; + p -= G_STRUCT_OFFSET (GstMetaItem, meta); + meta_item = (GstMetaItem *) p; + return meta_item->seq_num; +} + +/** + * gst_meta_compare_seqnum: + * @meta1: a #GstMeta + * @meta2: a #GstMeta + * + * Meta sequence number compare function. Can be used as #GCompareFunc + * or a #GCompareDataFunc. + * + * Returns: a negative number if @meta1 comes before @meta2, 0 if both metas + * have an equal sequence number, or a positive integer if @meta1 comes + * after @meta2. + * + * Since: 1.16 + */ +gint +gst_meta_compare_seqnum (const GstMeta * meta1, const GstMeta * meta2) +{ + guint64 seqnum1 = gst_meta_get_seqnum (meta1); + guint64 seqnum2 = gst_meta_get_seqnum (meta2); + + if (seqnum1 == seqnum2) + return 0; + + return (seqnum1 < seqnum2) ? -1 : 1; +}