threadshare: Use catch_panic_pad_function from gst-plugin crate

This commit is contained in:
Sebastian Dröge 2018-04-05 12:21:13 +03:00
parent 96bc778f72
commit a9d979a988
4 changed files with 0 additions and 60 deletions

View file

@ -225,21 +225,6 @@ impl AppSrc {
}) })
} }
fn catch_panic_pad_function<T, F: FnOnce(&Self, &Element) -> T, G: FnOnce() -> T>(
parent: &Option<gst::Object>,
fallback: G,
f: F,
) -> T {
let element = parent
.as_ref()
.cloned()
.unwrap()
.downcast::<Element>()
.unwrap();
let src = element.get_impl().downcast_ref::<AppSrc>().unwrap();
element.catch_panic(fallback, |element| f(src, element))
}
fn create_io_context_event(state: &State) -> Option<gst::Event> { fn create_io_context_event(state: &State) -> Option<gst::Event> {
if let (&Some(ref pending_future_id), &Some(ref io_context)) = if let (&Some(ref pending_future_id), &Some(ref io_context)) =
(&state.pending_future_id, &state.io_context) (&state.pending_future_id, &state.io_context)

View file

@ -355,21 +355,6 @@ impl ProxySink {
}) })
} }
fn catch_panic_pad_function<T, F: FnOnce(&Self, &Element) -> T, G: FnOnce() -> T>(
parent: &Option<gst::Object>,
fallback: G,
f: F,
) -> T {
let element = parent
.as_ref()
.cloned()
.unwrap()
.downcast::<Element>()
.unwrap();
let sink = element.get_impl().downcast_ref::<ProxySink>().unwrap();
element.catch_panic(fallback, |element| f(sink, element))
}
fn enqueue_item( fn enqueue_item(
&self, &self,
_pad: &gst::Pad, _pad: &gst::Pad,

View file

@ -247,21 +247,6 @@ impl Queue {
}) })
} }
fn catch_panic_pad_function<T, F: FnOnce(&Self, &Element) -> T, G: FnOnce() -> T>(
parent: &Option<gst::Object>,
fallback: G,
f: F,
) -> T {
let element = parent
.as_ref()
.cloned()
.unwrap()
.downcast::<Element>()
.unwrap();
let queue = element.get_impl().downcast_ref::<Queue>().unwrap();
element.catch_panic(fallback, |element| f(queue, element))
}
fn create_io_context_event(state: &State) -> Option<gst::Event> { fn create_io_context_event(state: &State) -> Option<gst::Event> {
if let (&Some(ref pending_future_id), &Some(ref io_context)) = if let (&Some(ref pending_future_id), &Some(ref io_context)) =
(&state.pending_future_id, &state.io_context) (&state.pending_future_id, &state.io_context)

View file

@ -210,21 +210,6 @@ impl UdpSrc {
}) })
} }
fn catch_panic_pad_function<T, F: FnOnce(&Self, &Element) -> T, G: FnOnce() -> T>(
parent: &Option<gst::Object>,
fallback: G,
f: F,
) -> T {
let element = parent
.as_ref()
.cloned()
.unwrap()
.downcast::<Element>()
.unwrap();
let udpsrc = element.get_impl().downcast_ref::<UdpSrc>().unwrap();
element.catch_panic(fallback, |element| f(udpsrc, element))
}
fn src_event(&self, pad: &gst::Pad, element: &Element, event: gst::Event) -> bool { fn src_event(&self, pad: &gst::Pad, element: &Element, event: gst::Event) -> bool {
use gst::EventView; use gst::EventView;