Commit 49627b8d authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Various nullability fixes everywhere and hide enum->string functions

parent 5108c941
......@@ -36,9 +36,6 @@ generate = [
"Gst.URIError",
"Gst.StructureChangeType",
"Gst.StreamStatusType",
"Gst.DeviceProvider",
"Gst.Device",
"Gst.DeviceMonitor",
"Gst.StreamType",
"Gst.StreamFlags",
"Gst.ProgressType",
......@@ -343,6 +340,16 @@ status = "generate"
# formatted value
ignore = true
[[object.function]]
name = "state_change_return_get_name"
# Wrong place
ignore = true
[[object.function]]
name = "state_get_name"
# Wrong place
ignore = true
[[object]]
name = "Gst.ElementFactory"
status = "generate"
......@@ -353,6 +360,35 @@ name = "Gst.DeviceProviderFactory"
status = "generate"
trait = false
[[object]]
name = "Gst.DeviceProvider"
status = "generate"
[[object.function]]
name = "get_bus"
[object.function.return]
nullable = false
[[object]]
name = "Gst.DeviceMonitor"
status = "generate"
[[object.function]]
name = "get_bus"
[object.function.return]
nullable = false
[[object]]
name = "Gst.Device"
status = "generate"
[[object.function]]
name = "get_display_name"
[object.function.return]
nullable = false
[[object.function]]
name = "get_device_class"
[object.function.return]
nullable = false
[[object]]
name = "Gst.Object"
# For renaming the trait...
......@@ -526,6 +562,11 @@ status = "generate"
# formatted value
ignore = true
[[object.function]]
name = "link_get_name"
# Wrong place
ignore = true
[[object]]
name = "Gst.PadTemplate"
status = "generate"
......@@ -635,11 +676,6 @@ trait = false
[object.function.return]
nullable = false
[[object.function]]
name = "get_release_date_string"
[object.function.return]
nullable = false
[[object.function]]
name = "get_source"
[object.function.return]
......@@ -873,6 +909,16 @@ status = "generate"
# newtype wrapper
ignore = true
[[object.function]]
name = "debug_bin_to_dot_data"
[object.function.return]
nullable = false
[[object.function]]
name = "version_string"
[object.function.return]
nullable = false
[[object]]
name = "Gst.StateChangeReturn"
status = "generate"
......
......@@ -37,9 +37,9 @@ pub trait DeviceExt {
fn get_caps(&self) -> Option<Caps>;
fn get_device_class(&self) -> Option<String>;
fn get_device_class(&self) -> String;
fn get_display_name(&self) -> Option<String>;
fn get_display_name(&self) -> String;
fn get_properties(&self) -> Option<Structure>;
......@@ -83,13 +83,13 @@ impl<O: IsA<Device> + IsA<glib::object::Object>> DeviceExt for O {
}
}
fn get_device_class(&self) -> Option<String> {
fn get_device_class(&self) -> String {
unsafe {
from_glib_full(ffi::gst_device_get_device_class(self.to_glib_none().0))
}
}
fn get_display_name(&self) -> Option<String> {
fn get_display_name(&self) -> String {
unsafe {
from_glib_full(ffi::gst_device_get_display_name(self.to_glib_none().0))
}
......
......@@ -50,7 +50,7 @@ unsafe impl Sync for DeviceMonitor {}
pub trait DeviceMonitorExt {
fn add_filter<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b Caps>>>(&self, classes: P, caps: Q) -> u32;
fn get_bus(&self) -> Option<Bus>;
fn get_bus(&self) -> Bus;
fn get_devices(&self) -> Vec<Device>;
......@@ -84,7 +84,7 @@ impl<O: IsA<DeviceMonitor> + IsA<glib::object::Object>> DeviceMonitorExt for O {
}
}
fn get_bus(&self) -> Option<Bus> {
fn get_bus(&self) -> Bus {
unsafe {
from_glib_full(ffi::gst_device_monitor_get_bus(self.to_glib_none().0))
}
......
......@@ -50,7 +50,7 @@ pub trait DeviceProviderExt {
fn device_remove(&self, device: &Device);
fn get_bus(&self) -> Option<Bus>;
fn get_bus(&self) -> Bus;
fn get_devices(&self) -> Vec<Device>;
......@@ -90,7 +90,7 @@ impl<O: IsA<DeviceProvider> + IsA<glib::object::Object>> DeviceProviderExt for O
}
}
fn get_bus(&self) -> Option<Bus> {
fn get_bus(&self) -> Bus {
unsafe {
from_glib_full(ffi::gst_device_provider_get_bus(self.to_glib_none().0))
}
......
......@@ -60,20 +60,6 @@ impl Element {
from_glib(ffi::gst_element_register(plugin.0, name.to_glib_none().0, rank, type_.to_glib()))
}
}
pub fn state_change_return_get_name(state_ret: StateChangeReturn) -> Option<String> {
assert_initialized_main_thread!();
unsafe {
from_glib_none(ffi::gst_element_state_change_return_get_name(state_ret.to_glib()))
}
}
pub fn state_get_name(state: State) -> Option<String> {
assert_initialized_main_thread!();
unsafe {
from_glib_none(ffi::gst_element_state_get_name(state.to_glib()))
}
}
}
unsafe impl Send for Element {}
......
......@@ -18,7 +18,7 @@ use std::mem;
use std::ptr;
pub fn debug_bin_to_dot_data<P: IsA<Bin>>(bin: &P, details: DebugGraphDetails) -> Option<String> {
pub fn debug_bin_to_dot_data<P: IsA<Bin>>(bin: &P, details: DebugGraphDetails) -> String {
skip_assert_initialized!();
unsafe {
from_glib_full(ffi::gst_debug_bin_to_dot_data(bin.to_glib_none().0, details.to_glib()))
......@@ -170,7 +170,7 @@ pub fn version() -> (u32, u32, u32, u32) {
}
}
pub fn version_string() -> Option<String> {
pub fn version_string() -> String {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_version_string())
......
......@@ -58,13 +58,6 @@ impl Pad {
from_glib_none(ffi::gst_pad_new_from_template(templ.to_glib_none().0, name.0))
}
}
pub fn link_get_name(ret: PadLinkReturn) -> Option<String> {
assert_initialized_main_thread!();
unsafe {
from_glib_none(ffi::gst_pad_link_get_name(ret.to_glib()))
}
}
}
unsafe impl Send for Pad {}
......
......@@ -69,7 +69,7 @@ impl Plugin {
}
}
pub fn get_release_date_string(&self) -> String {
pub fn get_release_date_string(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_plugin_get_release_date_string(self.to_glib_none().0))
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment