mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-12 04:05:24 +00:00
Add caps from string binding
This commit is contained in:
parent
80ba9a8b8f
commit
0fabdf3774
1 changed files with 16 additions and 0 deletions
|
@ -86,6 +86,22 @@ impl Caps {
|
||||||
caps
|
caps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn from_string(value: &str) -> Option<Self> {
|
||||||
|
extern "C" {
|
||||||
|
fn gst_caps_from_string(value: *const c_char) -> *mut c_void;
|
||||||
|
}
|
||||||
|
|
||||||
|
let value_cstr = CString::new(value).unwrap();
|
||||||
|
|
||||||
|
let caps_ptr = unsafe { gst_caps_from_string(value_cstr.as_ptr()) };
|
||||||
|
|
||||||
|
if caps_ptr.is_null() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(Caps(caps_ptr))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_simple(&mut self, values: Vec<(&str, &Value)>) {
|
pub fn set_simple(&mut self, values: Vec<(&str, &Value)>) {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
fn gst_caps_set_value(caps: *mut c_void, name: *const c_char, value: *const GValue);
|
fn gst_caps_set_value(caps: *mut c_void, name: *const c_char, value: *const GValue);
|
||||||
|
|
Loading…
Reference in a new issue