From: Vincent Penquerc'h Date: Thu, 19 Mar 2015 10:45:56 +0000 (+0000) Subject: segment: add gst_segment_is_equal X-Git-Tag: 1.6.1~416 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d6ae9c0feba83f569b8fb22706b7f7a0aa8b89ac;p=platform%2Fupstream%2Fgstreamer.git segment: add gst_segment_is_equal It beats memcmp due to the 'reserved' fields. API: gst_segment_is_equal() Found via, but probably not directly linked to, https://bugzilla.gnome.org/show_bug.cgi?id=738216 --- diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 2929cb0..701e3ed 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -2516,6 +2516,7 @@ gst_segment_to_position gst_segment_set_running_time gst_segment_copy_into gst_segment_offset_running_time +gst_segment_is_equal GST_TYPE_SEGMENT GST_TYPE_SEGMENT_FLAGS diff --git a/gst/gstsegment.c b/gst/gstsegment.c index 7cecf68..01b3005 100644 --- a/gst/gstsegment.c +++ b/gst/gstsegment.c @@ -830,3 +830,43 @@ gst_segment_offset_running_time (GstSegment * segment, GstFormat format, } return TRUE; } + +/** + * gst_segment_is_equal: + * @s0: a #GstSegment structure. + * @s1: a #GstSegment structure. + * + * Checks for two segments being equal. Equality here is defined + * as perfect equality, including floating point values. + * + * Since: 1.6 + * + * Returns: %TRUE if the segments are equal, %FALSE otherwise. + */ +gboolean +gst_segment_is_equal (const GstSegment * s0, const GstSegment * s1) +{ + if (s0->flags != s1->flags) + return FALSE; + if (s0->rate != s1->rate) + return FALSE; + if (s0->applied_rate != s1->applied_rate) + return FALSE; + if (s0->format != s1->format) + return FALSE; + if (s0->base != s1->base) + return FALSE; + if (s0->offset != s1->offset) + return FALSE; + if (s0->start != s1->start) + return FALSE; + if (s0->stop != s1->stop) + return FALSE; + if (s0->time != s1->time) + return FALSE; + if (s0->position != s1->position) + return FALSE; + if (s0->duration != s1->duration) + return FALSE; + return TRUE; +} diff --git a/gst/gstsegment.h b/gst/gstsegment.h index d3c87c2..dfe6ace 100644 --- a/gst/gstsegment.h +++ b/gst/gstsegment.h @@ -234,6 +234,7 @@ gboolean gst_segment_do_seek (GstSegment * segment, gdouble rate GstFormat format, GstSeekFlags flags, GstSeekType start_type, guint64 start, GstSeekType stop_type, guint64 stop, gboolean * update); +gboolean gst_segment_is_equal (const GstSegment * s0, const GstSegment * s1); G_END_DECLS diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def index 6933676..feb7d2b 100644 --- a/win32/common/libgstreamer.def +++ b/win32/common/libgstreamer.def @@ -1115,6 +1115,7 @@ EXPORTS gst_search_mode_get_type gst_seek_flags_get_type gst_seek_type_get_type + gst_segment_is_equal gst_segment_clip gst_segment_copy gst_segment_copy_into