diff --git a/gstreamer/src/event.rs b/gstreamer/src/event.rs index 4df110538..8183f6368 100644 --- a/gstreamer/src/event.rs +++ b/gstreamer/src/event.rs @@ -58,6 +58,27 @@ impl From for Seqnum { } } +impl cmp::PartialOrd for Seqnum { + fn partial_cmp(&self, other: &Seqnum) -> Option { + Some(self.cmp(other)) + } +} + +impl cmp::Ord for Seqnum { + fn cmp(&self, other: &Seqnum) -> cmp::Ordering { + unsafe { + let ret = ffi::gst_util_seqnum_compare(self.0, other.0); + if ret < 0 { + cmp::Ordering::Less + } else if ret > 0 { + cmp::Ordering::Greater + } else { + cmp::Ordering::Equal + } + } + } +} + #[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] pub struct GroupId(pub u32); pub const GROUP_ID_INVALID: GroupId = GroupId(0);