mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 11:01:10 +00:00
Handle bufferlists in pad probes
And fix replacing of the previous buffer/bufferlist
This commit is contained in:
parent
a76c51ac5c
commit
29d4e3a56d
1 changed files with 25 additions and 2 deletions
|
@ -10,7 +10,9 @@ use Pad;
|
||||||
use PadProbeType;
|
use PadProbeType;
|
||||||
use PadProbeReturn;
|
use PadProbeReturn;
|
||||||
use Buffer;
|
use Buffer;
|
||||||
|
use BufferList;
|
||||||
use FlowReturn;
|
use FlowReturn;
|
||||||
|
use miniobject::MiniObject;
|
||||||
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::mem::transmute;
|
use std::mem::transmute;
|
||||||
|
@ -54,7 +56,7 @@ pub struct PadProbeInfo {
|
||||||
|
|
||||||
pub enum PadProbeData {
|
pub enum PadProbeData {
|
||||||
Buffer(Buffer),
|
Buffer(Buffer),
|
||||||
// BufferList(&BufferList),
|
BufferList(BufferList),
|
||||||
// Query(&Query),
|
// Query(&Query),
|
||||||
// Event(&Event),
|
// Event(&Event),
|
||||||
Unknown,
|
Unknown,
|
||||||
|
@ -165,6 +167,11 @@ unsafe extern "C" fn trampoline_pad_probe(
|
||||||
Some(PadProbeData::Buffer(
|
Some(PadProbeData::Buffer(
|
||||||
from_glib_borrow(data as *const ffi::GstBuffer),
|
from_glib_borrow(data as *const ffi::GstBuffer),
|
||||||
))
|
))
|
||||||
|
} else if (*data).type_ == BufferList::static_type().to_glib() {
|
||||||
|
data_type = Some(BufferList::static_type());
|
||||||
|
Some(PadProbeData::BufferList(
|
||||||
|
from_glib_borrow(data as *const ffi::GstBufferList),
|
||||||
|
))
|
||||||
} else {
|
} else {
|
||||||
Some(PadProbeData::Unknown)
|
Some(PadProbeData::Unknown)
|
||||||
}
|
}
|
||||||
|
@ -176,8 +183,24 @@ unsafe extern "C" fn trampoline_pad_probe(
|
||||||
match probe_info.data {
|
match probe_info.data {
|
||||||
Some(PadProbeData::Buffer(buffer)) => {
|
Some(PadProbeData::Buffer(buffer)) => {
|
||||||
assert_eq!(data_type, Some(Buffer::static_type()));
|
assert_eq!(data_type, Some(Buffer::static_type()));
|
||||||
|
if (*info).data != buffer.as_mut_ptr() as *mut _ {
|
||||||
|
ffi::gst_mini_object_unref((*info).data as *mut _);
|
||||||
(*info).data = buffer.into_ptr() as *mut libc::c_void;
|
(*info).data = buffer.into_ptr() as *mut libc::c_void;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Some(PadProbeData::BufferList(bufferlist)) => {
|
||||||
|
assert_eq!(data_type, Some(BufferList::static_type()));
|
||||||
|
if (*info).data != bufferlist.as_mut_ptr() as *mut _ {
|
||||||
|
ffi::gst_mini_object_unref((*info).data as *mut _);
|
||||||
|
(*info).data = bufferlist.into_ptr() as *mut libc::c_void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
if !(*info).data.is_null() {
|
||||||
|
ffi::gst_mini_object_unref((*info).data as *mut _);
|
||||||
|
(*info).data = ptr::null_mut();
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue