mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-26 11:31:06 +00:00
gstreamer: typefind: add binding for gst_type_find_get_length()
This commit is contained in:
parent
043af60126
commit
1206dc5b15
1 changed files with 12 additions and 0 deletions
|
@ -83,6 +83,17 @@ impl<'a> TypeFind<'a> {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_length(&mut self) -> Option<u64> {
|
||||
unsafe {
|
||||
let len = gst_sys::gst_type_find_get_length(&mut self.0);
|
||||
if len == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(len)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl<'a> Send for TypeFind<'a> {}
|
||||
|
@ -270,6 +281,7 @@ mod tests {
|
|||
None,
|
||||
Some(&Caps::new_simple("test/test", &[])),
|
||||
|typefind| {
|
||||
assert_eq!(typefind.get_length(), Some(8));
|
||||
let mut found = false;
|
||||
if let Some(data) = typefind.peek(0, 8) {
|
||||
if data == b"abcdefgh" {
|
||||
|
|
Loading…
Reference in a new issue