WIP: changed return type for status_change, start, stop, change_caps,...

This commit is contained in:
o-reo 2019-02-28 10:55:01 +01:00
parent 127dbca2f5
commit c1f0b8e941
2 changed files with 15 additions and 15 deletions

View file

@ -46,7 +46,7 @@ impl Default for Settings {
} }
static PROPERTIES: [subclass::Property; 3] = [ static PROPERTIES: [subclass::Property; 3] = [
subclass::Property("stream-name", || { subclass::Property("stream-name", |_| {
glib::ParamSpec::string( glib::ParamSpec::string(
"stream-name", "stream-name",
"Sream Name", "Sream Name",
@ -55,7 +55,7 @@ subclass::Property("stream-name", || {
glib::ParamFlags::READWRITE, glib::ParamFlags::READWRITE,
) )
}), }),
subclass::Property("ip", || { subclass::Property("ip", |_| {
glib::ParamSpec::string( glib::ParamSpec::string(
"ip", "ip",
"Stream IP", "Stream IP",
@ -64,7 +64,7 @@ subclass::Property("ip", || {
glib::ParamFlags::READWRITE, glib::ParamFlags::READWRITE,
) )
}), }),
subclass::Property("loss-threshold", || { subclass::Property("loss-threshold", |_| {
glib::ParamSpec::uint( glib::ParamSpec::uint(
"loss-threshold", "loss-threshold",
"Loss threshold", "Loss threshold",
@ -246,7 +246,7 @@ impl ObjectSubclass for NdiAudioSrc {
&self, &self,
element: &gst::Element, element: &gst::Element,
transition: gst::StateChange, transition: gst::StateChange,
) -> gst::StateChangeReturn { ) -> Result<gst::StateChangeSuccess, gst::StateChangeError> {
if transition == gst::StateChange::PausedToPlaying { if transition == gst::StateChange::PausedToPlaying {
let mut receivers = hashmap_receivers.lock().unwrap(); let mut receivers = hashmap_receivers.lock().unwrap();
let settings = self.settings.lock().unwrap(); let settings = self.settings.lock().unwrap();
@ -283,7 +283,7 @@ impl ObjectSubclass for NdiAudioSrc {
} }
impl BaseSrcImpl for NdiAudioSrc { impl BaseSrcImpl for NdiAudioSrc {
fn set_caps(&self, element: &gst_base::BaseSrc, caps: &gst::CapsRef) -> bool { fn set_caps(&self, element: &gst_base::BaseSrc, caps: &gst::CapsRef) -> Result<(), gst::LoggableError> {
let info = match gst_audio::AudioInfo::from_caps(caps) { let info = match gst_audio::AudioInfo::from_caps(caps) {
None => return false, None => return false,
Some(info) => info, Some(info) => info,
@ -297,7 +297,7 @@ impl ObjectSubclass for NdiAudioSrc {
true true
} }
fn start(&self, element: &gst_base::BaseSrc) -> bool { fn start(&self, element: &gst_base::BaseSrc) -> Result<(), gst::ErrorMessage> {
*self.state.lock().unwrap() = Default::default(); *self.state.lock().unwrap() = Default::default();
let mut settings = self.settings.lock().unwrap(); let mut settings = self.settings.lock().unwrap();
@ -311,7 +311,7 @@ impl ObjectSubclass for NdiAudioSrc {
settings.id_receiver != 0 settings.id_receiver != 0
} }
fn stop(&self, element: &gst_base::BaseSrc) -> bool { fn stop(&self, element: &gst_base::BaseSrc) -> Result<(), gst::ErrorMessage> {
*self.state.lock().unwrap() = Default::default(); *self.state.lock().unwrap() = Default::default();
let settings = self.settings.lock().unwrap(); let settings = self.settings.lock().unwrap();

View file

@ -47,7 +47,7 @@ impl Default for Settings {
} }
static PROPERTIES: [subclass::Property; 3] = [ static PROPERTIES: [subclass::Property; 3] = [
subclass::Property("stream-name", || { subclass::Property("stream-name", |_| {
glib::ParamSpec::string( glib::ParamSpec::string(
"stream-name", "stream-name",
"Stream Name", "Stream Name",
@ -56,7 +56,7 @@ subclass::Property("stream-name", || {
glib::ParamFlags::READWRITE, glib::ParamFlags::READWRITE,
) )
}), }),
subclass::Property("ip", || { subclass::Property("ip", |_| {
glib::ParamSpec::string( glib::ParamSpec::string(
"ip", "ip",
"Stream IP", "Stream IP",
@ -65,7 +65,7 @@ subclass::Property("ip", || {
glib::ParamFlags::READWRITE, glib::ParamFlags::READWRITE,
) )
}), }),
subclass::Property("loss-threshold", || { subclass::Property("loss-threshold", |_| {
glib::ParamSpec::uint( glib::ParamSpec::uint(
"loss-threshold", "loss-threshold",
"Loss threshold", "Loss threshold",
@ -256,7 +256,7 @@ impl ObjectSubclass for NdiVideoSrc {
&self, &self,
element: &gst::Element, element: &gst::Element,
transition: gst::StateChange, transition: gst::StateChange,
) -> gst::StateChangeReturn { ) -> Result<gst::StateChangeSuccess, gst::StateChangeError> {
if transition == gst::StateChange::PausedToPlaying { if transition == gst::StateChange::PausedToPlaying {
let mut receivers = hashmap_receivers.lock().unwrap(); let mut receivers = hashmap_receivers.lock().unwrap();
let settings = self.settings.lock().unwrap(); let settings = self.settings.lock().unwrap();
@ -293,7 +293,7 @@ impl ObjectSubclass for NdiVideoSrc {
} }
impl BaseSrcImpl for NdiVideoSrc { impl BaseSrcImpl for NdiVideoSrc {
fn set_caps(&self, element: &gst_base::BaseSrc, caps: &gst::CapsRef) -> bool { fn set_caps(&self, element: &gst_base::BaseSrc, caps: &gst::CapsRef) -> Result<(), gst::LoggableError> {
let info = match gst_video::VideoInfo::from_caps(caps) { let info = match gst_video::VideoInfo::from_caps(caps) {
None => return false, None => return false,
Some(info) => info, Some(info) => info,
@ -306,7 +306,7 @@ impl ObjectSubclass for NdiVideoSrc {
true true
} }
fn start(&self, element: &gst_base::BaseSrc) -> bool { fn start(&self, element: &gst_base::BaseSrc) -> Result<(), gst::ErrorMessage> {
*self.state.lock().unwrap() = Default::default(); *self.state.lock().unwrap() = Default::default();
let mut settings = self.settings.lock().unwrap(); let mut settings = self.settings.lock().unwrap();
settings.id_receiver = connect_ndi( settings.id_receiver = connect_ndi(
@ -319,7 +319,7 @@ impl ObjectSubclass for NdiVideoSrc {
settings.id_receiver != 0 settings.id_receiver != 0
} }
fn stop(&self, element: &gst_base::BaseSrc) -> bool { fn stop(&self, element: &gst_base::BaseSrc) -> Result<(), gst::ErrorMessage> {
*self.state.lock().unwrap() = Default::default(); *self.state.lock().unwrap() = Default::default();
let settings = self.settings.lock().unwrap(); let settings = self.settings.lock().unwrap();