mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-29 04:51:09 +00:00
Add support for Events in pad probes
This commit is contained in:
parent
421e648a27
commit
35160bedbc
2 changed files with 14 additions and 2 deletions
|
@ -7,7 +7,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use ffi;
|
use ffi;
|
||||||
use Object;
|
|
||||||
use miniobject::*;
|
use miniobject::*;
|
||||||
use structure::*;
|
use structure::*;
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ use BufferList;
|
||||||
use FlowReturn;
|
use FlowReturn;
|
||||||
use Query;
|
use Query;
|
||||||
use QueryRef;
|
use QueryRef;
|
||||||
|
use Event;
|
||||||
use miniobject::MiniObject;
|
use miniobject::MiniObject;
|
||||||
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
@ -60,7 +61,7 @@ pub enum PadProbeData<'a> {
|
||||||
Buffer(Buffer),
|
Buffer(Buffer),
|
||||||
BufferList(BufferList),
|
BufferList(BufferList),
|
||||||
Query(&'a mut QueryRef),
|
Query(&'a mut QueryRef),
|
||||||
// Event(&Event),
|
Event(Event),
|
||||||
Unknown,
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,6 +218,11 @@ unsafe extern "C" fn trampoline_pad_probe(
|
||||||
Some(PadProbeData::Query(
|
Some(PadProbeData::Query(
|
||||||
QueryRef::from_mut_ptr(data as *mut ffi::GstQuery),
|
QueryRef::from_mut_ptr(data as *mut ffi::GstQuery),
|
||||||
))
|
))
|
||||||
|
} else if (*data).type_ == Event::static_type().to_glib() {
|
||||||
|
data_type = Some(Event::static_type());
|
||||||
|
Some(PadProbeData::Event(
|
||||||
|
from_glib_none(data as *const ffi::GstEvent),
|
||||||
|
))
|
||||||
} else {
|
} else {
|
||||||
Some(PadProbeData::Unknown)
|
Some(PadProbeData::Unknown)
|
||||||
}
|
}
|
||||||
|
@ -240,6 +246,13 @@ unsafe extern "C" fn trampoline_pad_probe(
|
||||||
(*info).data = bufferlist.into_ptr() as *mut libc::c_void;
|
(*info).data = bufferlist.into_ptr() as *mut libc::c_void;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some(PadProbeData::Event(event)) => {
|
||||||
|
assert_eq!(data_type, Some(Event::static_type()));
|
||||||
|
if (*info).data != event.as_mut_ptr() as *mut _ {
|
||||||
|
ffi::gst_mini_object_unref((*info).data as *mut _);
|
||||||
|
(*info).data = event.into_ptr() as *mut libc::c_void;
|
||||||
|
}
|
||||||
|
}
|
||||||
None => {
|
None => {
|
||||||
assert_ne!(data_type, Some(Query::static_type()));
|
assert_ne!(data_type, Some(Query::static_type()));
|
||||||
if !(*info).data.is_null() {
|
if !(*info).data.is_null() {
|
||||||
|
|
Loading…
Reference in a new issue