mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
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
This commit is contained in:
parent
936b252253
commit
d6ae9c0feb
4 changed files with 43 additions and 0 deletions
|
@ -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
|
||||
<SUBSECTION Standard>
|
||||
GST_TYPE_SEGMENT
|
||||
GST_TYPE_SEGMENT_FLAGS
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue