mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 13:01:07 +00:00
Minor cleanup
This commit is contained in:
parent
62a237ff0c
commit
8d253fd46a
1 changed files with 18 additions and 16 deletions
|
@ -172,8 +172,14 @@ impl DemuxerWrapper {
|
||||||
demuxer_impl.get_duration(element)
|
demuxer_impl.get_duration(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn seek(&self, element: &RsDemuxer, start: u64, stop: u64, offset: &mut u64) -> bool {
|
fn seek(
|
||||||
let demuxer = element.get_impl().downcast_ref::<Demuxer>().unwrap();
|
&self,
|
||||||
|
demuxer: &Demuxer,
|
||||||
|
element: &RsDemuxer,
|
||||||
|
start: u64,
|
||||||
|
stop: u64,
|
||||||
|
offset: &mut u64,
|
||||||
|
) -> bool {
|
||||||
let stop = if stop == u64::MAX { None } else { Some(stop) };
|
let stop = if stop == u64::MAX { None } else { Some(stop) };
|
||||||
|
|
||||||
gst_debug!(self.cat, obj: element, "Seeking to {:?}-{:?}", start, stop);
|
gst_debug!(self.cat, obj: element, "Seeking to {:?}-{:?}", start, stop);
|
||||||
|
@ -212,8 +218,12 @@ impl DemuxerWrapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_buffer(&self, element: &RsDemuxer, buffer: gst::Buffer) -> gst::FlowReturn {
|
fn handle_buffer(
|
||||||
let demuxer = element.get_impl().downcast_ref::<Demuxer>().unwrap();
|
&self,
|
||||||
|
demuxer: &Demuxer,
|
||||||
|
element: &RsDemuxer,
|
||||||
|
buffer: gst::Buffer,
|
||||||
|
) -> gst::FlowReturn {
|
||||||
let mut res = {
|
let mut res = {
|
||||||
let mut demuxer_impl = &mut self.demuxer.lock().unwrap();
|
let mut demuxer_impl = &mut self.demuxer.lock().unwrap();
|
||||||
|
|
||||||
|
@ -499,18 +509,10 @@ impl Demuxer {
|
||||||
srcpads.clear();
|
srcpads.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sink_activate(_pad: &gst::Pad, parent: &Option<gst::Object>) -> bool {
|
fn sink_activate(pad: &gst::Pad, _parent: &Option<gst::Object>) -> bool {
|
||||||
let element = parent
|
|
||||||
.as_ref()
|
|
||||||
.map(|o| o.clone())
|
|
||||||
.unwrap()
|
|
||||||
.downcast::<RsElement>()
|
|
||||||
.unwrap();
|
|
||||||
let demuxer = element.get_impl().downcast_ref::<Demuxer>().unwrap();
|
|
||||||
|
|
||||||
let mode = {
|
let mode = {
|
||||||
let mut query = gst::Query::new_scheduling();
|
let mut query = gst::Query::new_scheduling();
|
||||||
if !demuxer.sinkpad.peer_query(query.get_mut().unwrap()) {
|
if !pad.peer_query(query.get_mut().unwrap()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,7 +526,7 @@ impl Demuxer {
|
||||||
gst::PadMode::Push
|
gst::PadMode::Push
|
||||||
};
|
};
|
||||||
|
|
||||||
match demuxer.sinkpad.activate_mode(mode, true) {
|
match pad.activate_mode(mode, true) {
|
||||||
Ok(_) => true,
|
Ok(_) => true,
|
||||||
Err(_) => false,
|
Err(_) => false,
|
||||||
}
|
}
|
||||||
|
@ -590,7 +592,7 @@ impl Demuxer {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let demuxer = element.get_impl().downcast_ref::<Demuxer>().unwrap();
|
let demuxer = element.get_impl().downcast_ref::<Demuxer>().unwrap();
|
||||||
let wrap = demuxer.get_wrap();
|
let wrap = demuxer.get_wrap();
|
||||||
wrap.handle_buffer(&element, buffer)
|
wrap.handle_buffer(demuxer, &element, buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sink_event(pad: &gst::Pad, parent: &Option<gst::Object>, event: gst::Event) -> bool {
|
fn sink_event(pad: &gst::Pad, parent: &Option<gst::Object>, event: gst::Event) -> bool {
|
||||||
|
|
Loading…
Reference in a new issue