mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-22 08:58:15 +00:00
webrtc: Move make_element to the utils
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1194>
This commit is contained in:
parent
ce42723ad2
commit
cf32d9d668
2 changed files with 13 additions and 13 deletions
|
@ -85,3 +85,16 @@ pub fn serialize_json_object(val: &serde_json::Map<String, serde_json::Value>) -
|
|||
|
||||
res
|
||||
}
|
||||
|
||||
/// Wrapper around `gst::ElementFactory::make` with a better error
|
||||
/// message
|
||||
pub fn make_element(element: &str, name: Option<&str>) -> Result<gst::Element, Error> {
|
||||
let mut builder = gst::ElementFactory::make(element);
|
||||
if let Some(name) = name {
|
||||
builder = builder.name(name);
|
||||
}
|
||||
|
||||
builder
|
||||
.build()
|
||||
.with_context(|| format!("Failed to make element {element}"))
|
||||
}
|
||||
|
|
|
@ -261,19 +261,6 @@ fn create_navigation_event(sink: &super::BaseWebRTCSink, msg: &str) {
|
|||
}
|
||||
}
|
||||
|
||||
/// Wrapper around `gst::ElementFactory::make` with a better error
|
||||
/// message
|
||||
fn make_element(element: &str, name: Option<&str>) -> Result<gst::Element, Error> {
|
||||
let mut builder = gst::ElementFactory::make(element);
|
||||
if let Some(name) = name {
|
||||
builder = builder.name(name);
|
||||
}
|
||||
|
||||
builder
|
||||
.build()
|
||||
.with_context(|| format!("Failed to make element {element}"))
|
||||
}
|
||||
|
||||
/// Simple utility for tearing down a pipeline cleanly
|
||||
struct PipelineWrapper(gst::Pipeline);
|
||||
|
||||
|
|
Loading…
Reference in a new issue