mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-30 14:00:29 +00:00
Update gstreamer-rs/gstreamer bool to Result changes
This commit is contained in:
parent
873d177322
commit
f5a398b21e
8 changed files with 28 additions and 24 deletions
|
@ -142,7 +142,7 @@ impl ObjectSubclass for FlvDemux {
|
||||||
sinkpad.set_activate_function(|pad, parent| {
|
sinkpad.set_activate_function(|pad, parent| {
|
||||||
FlvDemux::catch_panic_pad_function(
|
FlvDemux::catch_panic_pad_function(
|
||||||
parent,
|
parent,
|
||||||
|| false,
|
|| Err(glib_bool_error!("Panic activating sink pad")),
|
||||||
|demux, element| demux.sink_activate(pad, element),
|
|demux, element| demux.sink_activate(pad, element),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
@ -150,7 +150,7 @@ impl ObjectSubclass for FlvDemux {
|
||||||
sinkpad.set_activatemode_function(|pad, parent, mode, active| {
|
sinkpad.set_activatemode_function(|pad, parent, mode, active| {
|
||||||
FlvDemux::catch_panic_pad_function(
|
FlvDemux::catch_panic_pad_function(
|
||||||
parent,
|
parent,
|
||||||
|| false,
|
|| Err(glib_bool_error!("Panic activating sink pad with mode")),
|
||||||
|demux, element| demux.sink_activatemode(pad, element, mode, active),
|
|demux, element| demux.sink_activatemode(pad, element, mode, active),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
@ -286,11 +286,15 @@ impl ObjectImpl for FlvDemux {
|
||||||
impl ElementImpl for FlvDemux {}
|
impl ElementImpl for FlvDemux {}
|
||||||
|
|
||||||
impl FlvDemux {
|
impl FlvDemux {
|
||||||
fn sink_activate(&self, pad: &gst::Pad, _element: &gst::Element) -> bool {
|
fn sink_activate(
|
||||||
|
&self,
|
||||||
|
pad: &gst::Pad,
|
||||||
|
_element: &gst::Element,
|
||||||
|
) -> Result<(), glib::BoolError> {
|
||||||
let mode = {
|
let mode = {
|
||||||
let mut query = gst::Query::new_scheduling();
|
let mut query = gst::Query::new_scheduling();
|
||||||
if !pad.peer_query(&mut query) {
|
if !pad.peer_query(&mut query) {
|
||||||
return false;
|
return Err(glib_bool_error!("Scheduling query failed on peer"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: pull mode
|
// TODO: pull mode
|
||||||
|
@ -308,7 +312,7 @@ impl FlvDemux {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pad.activate_mode(mode, true).is_ok()
|
pad.activate_mode(mode, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sink_activatemode(
|
fn sink_activatemode(
|
||||||
|
@ -317,32 +321,30 @@ impl FlvDemux {
|
||||||
element: &gst::Element,
|
element: &gst::Element,
|
||||||
mode: gst::PadMode,
|
mode: gst::PadMode,
|
||||||
active: bool,
|
active: bool,
|
||||||
) -> bool {
|
) -> Result<(), glib::BoolError> {
|
||||||
if active {
|
if active {
|
||||||
if let Err(err) = self.start(element, mode) {
|
self.start(element, mode).map_err(|err| {
|
||||||
element.post_error_message(&err);
|
element.post_error_message(&err);
|
||||||
return false;
|
glib_bool_error!("Failed to start element with mode {:?}", mode)
|
||||||
}
|
})?;
|
||||||
|
|
||||||
if mode == gst::PadMode::Pull {
|
if mode == gst::PadMode::Pull {
|
||||||
// TODO implement pull mode
|
// TODO implement pull mode
|
||||||
// self.sinkpad.start_task(...)
|
// self.sinkpad.start_task(...)
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
true
|
|
||||||
} else {
|
} else {
|
||||||
if mode == gst::PadMode::Pull {
|
if mode == gst::PadMode::Pull {
|
||||||
let _ = self.sinkpad.stop_task();
|
let _ = self.sinkpad.stop_task();
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(err) = self.stop(element) {
|
self.stop(element).map_err(|err| {
|
||||||
element.post_error_message(&err);
|
element.post_error_message(&err);
|
||||||
return false;
|
glib_bool_error!("Failed to stop element")
|
||||||
}
|
})?;
|
||||||
|
|
||||||
true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start(&self, _element: &gst::Element, _mode: gst::PadMode) -> Result<(), gst::ErrorMessage> {
|
fn start(&self, _element: &gst::Element, _mode: gst::PadMode) -> Result<(), gst::ErrorMessage> {
|
||||||
|
|
|
@ -29,7 +29,7 @@ fn init() {
|
||||||
|
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| {
|
||||||
gst::init().unwrap();
|
gst::init().unwrap();
|
||||||
gstthreadshare::plugin_register_static();
|
gstthreadshare::plugin_register_static().expect("gstthreadshare appsrc test");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ fn init() {
|
||||||
|
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| {
|
||||||
gst::init().unwrap();
|
gst::init().unwrap();
|
||||||
gstthreadshare::plugin_register_static();
|
gstthreadshare::plugin_register_static().expect("gstthreadshare proxy test");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ fn init() {
|
||||||
|
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| {
|
||||||
gst::init().unwrap();
|
gst::init().unwrap();
|
||||||
gstthreadshare::plugin_register_static();
|
gstthreadshare::plugin_register_static().expect("gstthreadshare queue test");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ fn init() {
|
||||||
|
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| {
|
||||||
gst::init().unwrap();
|
gst::init().unwrap();
|
||||||
gstthreadshare::plugin_register_static();
|
gstthreadshare::plugin_register_static().expect("gstthreadshare tcpclientsrc test");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ fn init() {
|
||||||
|
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| {
|
||||||
gst::init().unwrap();
|
gst::init().unwrap();
|
||||||
gstthreadshare::plugin_register_static();
|
gstthreadshare::plugin_register_static().expect("gstthreadshare udpsrc test");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -753,8 +753,10 @@ impl ToggleRecord {
|
||||||
|
|
||||||
state.out_segment = state.in_segment.clone();
|
state.out_segment = state.in_segment.clone();
|
||||||
let offset = rec_state.running_time_offset.unwrap_or(0);
|
let offset = rec_state.running_time_offset.unwrap_or(0);
|
||||||
let res = state.out_segment.offset_running_time(-(offset as i64));
|
state
|
||||||
assert!(res);
|
.out_segment
|
||||||
|
.offset_running_time(-(offset as i64))
|
||||||
|
.expect("Adjusting record duration");
|
||||||
events.push(
|
events.push(
|
||||||
gst::Event::new_segment(&state.out_segment)
|
gst::Event::new_segment(&state.out_segment)
|
||||||
.seqnum(state.segment_seqnum)
|
.seqnum(state.segment_seqnum)
|
||||||
|
|
|
@ -35,7 +35,7 @@ fn init() {
|
||||||
|
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| {
|
||||||
gst::init().unwrap();
|
gst::init().unwrap();
|
||||||
gsttogglerecord::plugin_register_static();
|
gsttogglerecord::plugin_register_static().expect("gsttogglerecord tests");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue