mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-31 20:38:44 +00:00
utils/streamproducer: Add StreamProducer::error()
to signal an error message to all consumers
This commit is contained in:
parent
e263bd8945
commit
98cc289bcc
1 changed files with 15 additions and 0 deletions
|
@ -118,6 +118,21 @@ impl StreamProducer {
|
|||
pub fn appsink(&self) -> &gst_app::AppSink {
|
||||
&self.appsink
|
||||
}
|
||||
|
||||
/// Signals an error on all consumers
|
||||
pub fn error(&self, error: &gst::glib::Error, debug: Option<&str>) {
|
||||
let consumers = self.consumers.lock().unwrap();
|
||||
|
||||
for consumer in consumers.consumers.keys() {
|
||||
let mut msg_builder =
|
||||
gst::message::Error::builder_from_error(error.clone()).src(consumer);
|
||||
if let Some(debug) = debug {
|
||||
msg_builder = msg_builder.debug(debug);
|
||||
}
|
||||
|
||||
let _ = consumer.post_message(msg_builder.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a gst_app::AppSink> for StreamProducer {
|
||||
|
|
Loading…
Reference in a new issue