Update for ObjectImpl::get_property() being infallible now

This commit is contained in:
Sebastian Dröge 2020-11-19 17:55:57 +02:00
parent df6a229f58
commit d56ae71e0e
35 changed files with 203 additions and 198 deletions

View file

@ -223,25 +223,25 @@ impl ObjectImpl for AudioEcho {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("max-delay", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.max_delay.to_value())
settings.max_delay.to_value()
}
subclass::Property("delay", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.delay.to_value())
settings.delay.to_value()
}
subclass::Property("intensity", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.intensity.to_value())
settings.intensity.to_value()
}
subclass::Property("feedback", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.feedback.to_value())
settings.feedback.to_value()
}
_ => unimplemented!(),
}

View file

@ -1866,25 +1866,25 @@ impl ObjectImpl for AudioLoudNorm {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("loudness-target", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.loudness_target.to_value())
settings.loudness_target.to_value()
}
subclass::Property("loudness-range-target", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.loudness_range_target.to_value())
settings.loudness_range_target.to_value()
}
subclass::Property("max-true-peak", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.max_true_peak.to_value())
settings.max_true_peak.to_value()
}
subclass::Property("offset", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.offset.to_value())
settings.offset.to_value()
}
_ => unimplemented!(),
}

View file

@ -465,25 +465,25 @@ impl ObjectImpl for CsoundFilter {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("loop", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.loop_.to_value())
settings.loop_.to_value()
}
subclass::Property("location", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.location.to_value())
settings.location.to_value()
}
subclass::Property("csd-text", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.csd_text.to_value())
settings.csd_text.to_value()
}
subclass::Property("score_offset", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.offset.to_value())
settings.offset.to_value()
}
_ => unimplemented!(),
}

View file

@ -179,7 +179,7 @@ impl ObjectImpl for FileSink {
};
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("location", ..) => {
@ -189,7 +189,7 @@ impl ObjectImpl for FileSink {
.as_ref()
.map(|location| location.to_string());
Ok(location.to_value())
location.to_value()
}
_ => unimplemented!(),
}

View file

@ -193,7 +193,7 @@ impl ObjectImpl for FileSrc {
};
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("location", ..) => {
@ -203,7 +203,7 @@ impl ObjectImpl for FileSrc {
.as_ref()
.map(|location| location.to_string());
Ok(location.to_value())
location.to_value()
}
_ => unimplemented!(),
}

View file

@ -670,13 +670,13 @@ impl ObjectImpl for Decrypter {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("receiver-key", ..) => {
let props = self.props.lock().unwrap();
Ok(props.receiver_key.to_value())
props.receiver_key.to_value()
}
_ => unimplemented!(),

View file

@ -506,18 +506,18 @@ impl ObjectImpl for Encrypter {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("receiver-key", ..) => {
let props = self.props.lock().unwrap();
Ok(props.receiver_key.to_value())
props.receiver_key.to_value()
}
subclass::Property("block-size", ..) => {
let props = self.props.lock().unwrap();
Ok(props.block_size.to_value())
props.block_size.to_value()
}
_ => unimplemented!(),

View file

@ -667,16 +667,16 @@ impl ObjectImpl for AppSrc {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
let settings = self.settings.lock().unwrap();
match *prop {
subclass::Property("context", ..) => Ok(settings.context.to_value()),
subclass::Property("context-wait", ..) => Ok(settings.context_wait.to_value()),
subclass::Property("caps", ..) => Ok(settings.caps.to_value()),
subclass::Property("max-buffers", ..) => Ok(settings.max_buffers.to_value()),
subclass::Property("do-timestamp", ..) => Ok(settings.do_timestamp.to_value()),
subclass::Property("context", ..) => settings.context.to_value(),
subclass::Property("context-wait", ..) => settings.context_wait.to_value(),
subclass::Property("caps", ..) => settings.caps.to_value(),
subclass::Property("max-buffers", ..) => settings.max_buffers.to_value(),
subclass::Property("do-timestamp", ..) => settings.do_timestamp.to_value(),
_ => unimplemented!(),
}
}

View file

@ -527,22 +527,22 @@ impl ObjectImpl for InputSelector {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("context", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.context.to_value())
settings.context.to_value()
}
subclass::Property("context-wait", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.context_wait.to_value())
settings.context_wait.to_value()
}
subclass::Property("active-pad", ..) => {
let state = self.state.lock().unwrap();
let active_pad = state.active_sinkpad.clone();
Ok(active_pad.to_value())
active_pad.to_value()
}
_ => unimplemented!(),
}

View file

@ -1537,25 +1537,25 @@ impl ObjectImpl for JitterBuffer {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("latency", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.latency_ms.to_value())
settings.latency_ms.to_value()
}
subclass::Property("do-lost", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.do_lost.to_value())
settings.do_lost.to_value()
}
subclass::Property("max-dropout-time", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.max_dropout_time.to_value())
settings.max_dropout_time.to_value()
}
subclass::Property("max-misorder-time", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.max_misorder_time.to_value())
settings.max_misorder_time.to_value()
}
subclass::Property("stats", ..) => {
let state = self.state.lock().unwrap();
@ -1567,15 +1567,15 @@ impl ObjectImpl for JitterBuffer {
("num-late", &state.stats.num_late),
],
);
Ok(s.to_value())
s.to_value()
}
subclass::Property("context", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.context.to_value())
settings.context.to_value()
}
subclass::Property("context-wait", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.context_wait.to_value())
settings.context_wait.to_value()
}
_ => unimplemented!(),
}

View file

@ -709,12 +709,12 @@ impl ObjectImpl for ProxySink {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES_SINK[id];
let settings = self.settings.lock().unwrap();
match *prop {
subclass::Property("proxy-context", ..) => Ok(settings.proxy_context.to_value()),
subclass::Property("proxy-context", ..) => settings.proxy_context.to_value(),
_ => unimplemented!(),
}
}
@ -1248,17 +1248,17 @@ impl ObjectImpl for ProxySrc {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES_SRC[id];
let settings = self.settings.lock().unwrap();
match *prop {
subclass::Property("max-size-buffers", ..) => Ok(settings.max_size_buffers.to_value()),
subclass::Property("max-size-bytes", ..) => Ok(settings.max_size_bytes.to_value()),
subclass::Property("max-size-time", ..) => Ok(settings.max_size_time.to_value()),
subclass::Property("context", ..) => Ok(settings.context.to_value()),
subclass::Property("context-wait", ..) => Ok(settings.context_wait.to_value()),
subclass::Property("proxy-context", ..) => Ok(settings.proxy_context.to_value()),
subclass::Property("max-size-buffers", ..) => settings.max_size_buffers.to_value(),
subclass::Property("max-size-bytes", ..) => settings.max_size_bytes.to_value(),
subclass::Property("max-size-time", ..) => settings.max_size_time.to_value(),
subclass::Property("context", ..) => settings.context.to_value(),
subclass::Property("context-wait", ..) => settings.context_wait.to_value(),
subclass::Property("proxy-context", ..) => settings.proxy_context.to_value(),
_ => unimplemented!(),
}
}

View file

@ -836,16 +836,16 @@ impl ObjectImpl for Queue {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
let settings = self.settings.lock().unwrap();
match *prop {
subclass::Property("max-size-buffers", ..) => Ok(settings.max_size_buffers.to_value()),
subclass::Property("max-size-bytes", ..) => Ok(settings.max_size_bytes.to_value()),
subclass::Property("max-size-time", ..) => Ok(settings.max_size_time.to_value()),
subclass::Property("context", ..) => Ok(settings.context.to_value()),
subclass::Property("context-wait", ..) => Ok(settings.context_wait.to_value()),
subclass::Property("max-size-buffers", ..) => settings.max_size_buffers.to_value(),
subclass::Property("max-size-bytes", ..) => settings.max_size_bytes.to_value(),
subclass::Property("max-size-time", ..) => settings.max_size_time.to_value(),
subclass::Property("context", ..) => settings.context.to_value(),
subclass::Property("context-wait", ..) => settings.context_wait.to_value(),
_ => unimplemented!(),
}
}

View file

@ -685,17 +685,17 @@ impl ObjectImpl for TcpClientSrc {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
let settings = self.settings.lock().unwrap();
match *prop {
subclass::Property("host", ..) => Ok(settings.host.to_value()),
subclass::Property("port", ..) => Ok(settings.port.to_value()),
subclass::Property("caps", ..) => Ok(settings.caps.to_value()),
subclass::Property("blocksize", ..) => Ok(settings.blocksize.to_value()),
subclass::Property("context", ..) => Ok(settings.context.to_value()),
subclass::Property("context-wait", ..) => Ok(settings.context_wait.to_value()),
subclass::Property("host", ..) => settings.host.to_value(),
subclass::Property("port", ..) => settings.port.to_value(),
subclass::Property("caps", ..) => settings.caps.to_value(),
subclass::Property("blocksize", ..) => settings.blocksize.to_value(),
subclass::Property("context", ..) => settings.context.to_value(),
subclass::Property("context-wait", ..) => settings.context_wait.to_value(),
_ => unimplemented!(),
}
}

View file

@ -1341,41 +1341,41 @@ impl ObjectImpl for UdpSink {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
let settings = self.settings.lock().unwrap();
match *prop {
subclass::Property("sync", ..) => Ok(settings.sync.to_value()),
subclass::Property("bind-address", ..) => Ok(settings.bind_address.to_value()),
subclass::Property("bind-port", ..) => Ok(settings.bind_port.to_value()),
subclass::Property("bind-address-v6", ..) => Ok(settings.bind_address_v6.to_value()),
subclass::Property("bind-port-v6", ..) => Ok(settings.bind_port_v6.to_value()),
subclass::Property("socket", ..) => Ok(settings
subclass::Property("sync", ..) => settings.sync.to_value(),
subclass::Property("bind-address", ..) => settings.bind_address.to_value(),
subclass::Property("bind-port", ..) => settings.bind_port.to_value(),
subclass::Property("bind-address-v6", ..) => settings.bind_address_v6.to_value(),
subclass::Property("bind-port-v6", ..) => settings.bind_port_v6.to_value(),
subclass::Property("socket", ..) => settings
.socket
.as_ref()
.map(GioSocketWrapper::as_socket)
.to_value()),
subclass::Property("used-socket", ..) => Ok(settings
.to_value(),
subclass::Property("used-socket", ..) => settings
.used_socket
.as_ref()
.map(GioSocketWrapper::as_socket)
.to_value()),
subclass::Property("socket-v6", ..) => Ok(settings
.to_value(),
subclass::Property("socket-v6", ..) => settings
.socket_v6
.as_ref()
.map(GioSocketWrapper::as_socket)
.to_value()),
subclass::Property("used-socket-v6", ..) => Ok(settings
.to_value(),
subclass::Property("used-socket-v6", ..) => settings
.used_socket_v6
.as_ref()
.map(GioSocketWrapper::as_socket)
.to_value()),
subclass::Property("auto-multicast", ..) => Ok(settings.sync.to_value()),
subclass::Property("loop", ..) => Ok(settings.multicast_loop.to_value()),
subclass::Property("ttl", ..) => Ok(settings.ttl.to_value()),
subclass::Property("ttl-mc", ..) => Ok(settings.ttl_mc.to_value()),
subclass::Property("qos-dscp", ..) => Ok(settings.qos_dscp.to_value()),
.to_value(),
subclass::Property("auto-multicast", ..) => settings.sync.to_value(),
subclass::Property("loop", ..) => settings.multicast_loop.to_value(),
subclass::Property("ttl", ..) => settings.ttl.to_value(),
subclass::Property("ttl-mc", ..) => settings.ttl_mc.to_value(),
subclass::Property("qos-dscp", ..) => settings.qos_dscp.to_value(),
subclass::Property("clients", ..) => {
drop(settings);
@ -1386,10 +1386,10 @@ impl ObjectImpl for UdpSink {
.map(ToString::to_string)
.collect();
Ok(clients.join(",").to_value())
clients.join(",").to_value()
}
subclass::Property("context", ..) => Ok(settings.context.to_value()),
subclass::Property("context-wait", ..) => Ok(settings.context_wait.to_value()),
subclass::Property("context", ..) => settings.context.to_value(),
subclass::Property("context-wait", ..) => settings.context_wait.to_value(),
_ => unimplemented!(),
}
}

View file

@ -893,30 +893,30 @@ impl ObjectImpl for UdpSrc {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
let settings = self.settings.lock().unwrap();
match *prop {
subclass::Property("address", ..) => Ok(settings.address.to_value()),
subclass::Property("port", ..) => Ok((settings.port).to_value()),
subclass::Property("reuse", ..) => Ok(settings.reuse.to_value()),
subclass::Property("caps", ..) => Ok(settings.caps.to_value()),
subclass::Property("mtu", ..) => Ok(settings.mtu.to_value()),
subclass::Property("socket", ..) => Ok(settings
subclass::Property("address", ..) => settings.address.to_value(),
subclass::Property("port", ..) => settings.port.to_value(),
subclass::Property("reuse", ..) => settings.reuse.to_value(),
subclass::Property("caps", ..) => settings.caps.to_value(),
subclass::Property("mtu", ..) => settings.mtu.to_value(),
subclass::Property("socket", ..) => settings
.socket
.as_ref()
.map(GioSocketWrapper::as_socket)
.to_value()),
subclass::Property("used-socket", ..) => Ok(settings
.to_value(),
subclass::Property("used-socket", ..) => settings
.used_socket
.as_ref()
.map(GioSocketWrapper::as_socket)
.to_value()),
subclass::Property("context", ..) => Ok(settings.context.to_value()),
subclass::Property("context-wait", ..) => Ok(settings.context_wait.to_value()),
.to_value(),
subclass::Property("context", ..) => settings.context.to_value(),
subclass::Property("context-wait", ..) => settings.context_wait.to_value(),
subclass::Property("retrieve-sender-address", ..) => {
Ok(settings.retrieve_sender_address.to_value())
settings.retrieve_sender_address.to_value()
}
_ => unimplemented!(),
}

View file

@ -743,51 +743,51 @@ impl ObjectImpl for ReqwestHttpSrc {
};
}
fn get_property(&self, obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("location", ..) => {
let settings = self.settings.lock().unwrap();
let location = settings.location.as_ref().map(Url::to_string);
Ok(location.to_value())
location.to_value()
}
subclass::Property("user-agent", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.user_agent.to_value())
settings.user_agent.to_value()
}
subclass::Property("is-live", ..) => Ok(obj.is_live().to_value()),
subclass::Property("is-live", ..) => obj.is_live().to_value(),
subclass::Property("user-id", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.user_id.to_value())
settings.user_id.to_value()
}
subclass::Property("user-pw", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.user_pw.to_value())
settings.user_pw.to_value()
}
subclass::Property("timeout", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.timeout.to_value())
settings.timeout.to_value()
}
subclass::Property("compress", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.compress.to_value())
settings.compress.to_value()
}
subclass::Property("extra-headers", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.extra_headers.to_value())
settings.extra_headers.to_value()
}
subclass::Property("cookies", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.cookies.to_value())
settings.cookies.to_value()
}
subclass::Property("iradio-mode", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.iradio_mode.to_value())
settings.iradio_mode.to_value()
}
subclass::Property("keep-alive", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.keep_alive.to_value())
settings.keep_alive.to_value()
}
_ => unimplemented!(),
}

View file

@ -1119,21 +1119,21 @@ impl ObjectImpl for Transcriber {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("language-code", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.language_code.to_value())
settings.language_code.to_value()
}
subclass::Property("latency", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.latency_ms.to_value())
settings.latency_ms.to_value()
}
subclass::Property("use-partial-results", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.use_partial_results.to_value())
settings.use_partial_results.to_value()
}
_ => unimplemented!(),
}

View file

@ -446,15 +446,15 @@ impl ObjectImpl for S3Sink {
}
}
fn get_property(&self, _: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id as usize];
let settings = self.settings.lock().unwrap();
match *prop {
subclass::Property("key", ..) => Ok(settings.key.to_value()),
subclass::Property("bucket", ..) => Ok(settings.bucket.to_value()),
subclass::Property("region", ..) => Ok(settings.region.name().to_value()),
subclass::Property("part-size", ..) => Ok(settings.buffer_size.to_value()),
subclass::Property("key", ..) => settings.key.to_value(),
subclass::Property("bucket", ..) => settings.bucket.to_value(),
subclass::Property("region", ..) => settings.region.name().to_value(),
subclass::Property("part-size", ..) => settings.buffer_size.to_value(),
_ => unimplemented!(),
}
}

View file

@ -259,7 +259,7 @@ impl ObjectImpl for S3Src {
}
}
fn get_property(&self, _: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id as usize];
match *prop {
@ -269,7 +269,7 @@ impl ObjectImpl for S3Src {
None => "".to_string(),
};
Ok(url.to_value())
url.to_value()
}
_ => unimplemented!(),
}

View file

@ -362,21 +362,21 @@ impl ObjectImpl for TextWrap {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("dictionary", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.dictionary.to_value())
settings.dictionary.to_value()
}
subclass::Property("columns", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.columns.to_value())
settings.columns.to_value()
}
subclass::Property("lines", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.lines.to_value())
settings.lines.to_value()
}
_ => unimplemented!(),
}

View file

@ -168,13 +168,13 @@ impl ObjectImpl for ProgressBin {
// Called whenever a value of a property is read. It can be called
// at any time from any thread.
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("output", ..) => {
let output_type = self.output_type.lock().unwrap();
Ok(output_type.to_value())
output_type.to_value()
}
_ => unimplemented!(),
}

View file

@ -276,17 +276,17 @@ impl ObjectImpl for Rgb2Gray {
// Called whenever a value of a property is read. It can be called
// at any time from any thread.
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("invert", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.invert.to_value())
settings.invert.to_value()
}
subclass::Property("shift", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.shift.to_value())
settings.shift.to_value()
}
_ => unimplemented!(),
}

View file

@ -369,29 +369,29 @@ impl ObjectImpl for SineSrc {
// Called whenever a value of a property is read. It can be called
// at any time from any thread.
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("samples-per-buffer", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.samples_per_buffer.to_value())
settings.samples_per_buffer.to_value()
}
subclass::Property("freq", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.freq.to_value())
settings.freq.to_value()
}
subclass::Property("volume", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.volume.to_value())
settings.volume.to_value()
}
subclass::Property("mute", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.mute.to_value())
settings.mute.to_value()
}
subclass::Property("is-live", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.is_live.to_value())
settings.is_live.to_value()
}
_ => unimplemented!(),
}

View file

@ -855,17 +855,17 @@ impl ObjectImpl for Rgb2Gray {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("invert", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.invert.to_value())
settings.invert.to_value()
}
subclass::Property("shift", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.shift.to_value())
settings.shift.to_value()
}
_ => unimplemented!(),
}

View file

@ -320,29 +320,29 @@ impl ObjectImpl for SineSrc {
// Called whenever a value of a property is read. It can be called
// at any time from any thread.
fn get_property(&self, _obj: &Self::Type, id: u32) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: u32) -> glib::Value {
let prop = &PROPERTIES[id as usize];
match *prop {
Property::UInt("samples-per-buffer", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.samples_per_buffer.to_value())
settings.samples_per_buffer.to_value()
}
Property::UInt("freq", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.freq.to_value())
settings.freq.to_value()
}
Property::Double("volume", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.volume.to_value())
settings.volume.to_value()
}
Property::Boolean("mute", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.mute.to_value())
settings.mute.to_value()
}
Property::Boolean("is-live", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.is_live.to_value())
settings.is_live.to_value()
}
_ => unimplemented!(),
}

View file

@ -507,52 +507,52 @@ impl ObjectImpl for FallbackSrc {
// Called whenever a value of a property is read. It can be called
// at any time from any thread.
#[allow(clippy::blocks_in_if_conditions)]
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("enable-audio", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.enable_audio.to_value())
settings.enable_audio.to_value()
}
subclass::Property("enable-video", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.enable_video.to_value())
settings.enable_video.to_value()
}
subclass::Property("uri", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.uri.to_value())
settings.uri.to_value()
}
subclass::Property("source", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.source.to_value())
settings.source.to_value()
}
subclass::Property("fallback-uri", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.fallback_uri.to_value())
settings.fallback_uri.to_value()
}
subclass::Property("timeout", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.timeout.to_value())
settings.timeout.to_value()
}
subclass::Property("restart-timeout", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.restart_timeout.to_value())
settings.restart_timeout.to_value()
}
subclass::Property("retry-timeout", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.retry_timeout.to_value())
settings.retry_timeout.to_value()
}
subclass::Property("restart-on-eos", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.restart_on_eos.to_value())
settings.restart_on_eos.to_value()
}
subclass::Property("status", ..) => {
let state_guard = self.state.lock().unwrap();
// If we have no state then we'r stopped
let state = match &*state_guard {
None => return Ok(Status::Stopped.to_value()),
None => return Status::Stopped.to_value(),
Some(ref state) => state,
};
@ -561,7 +561,7 @@ impl ObjectImpl for FallbackSrc {
|| state.source_pending_restart_timeout.is_some()
|| state.source_retry_timeout.is_some()
{
return Ok(Status::Retrying.to_value());
return Status::Retrying.to_value();
}
// Otherwise if buffering < 100, we have no streams yet or of the expected
@ -593,21 +593,21 @@ impl ObjectImpl for FallbackSrc {
.map(|s| s.source_srcpad.is_none() || s.source_srcpad_block.is_some())
.unwrap_or(true))
{
return Ok(Status::Buffering.to_value());
return Status::Buffering.to_value();
}
// Otherwise we're running now
Ok(Status::Running.to_value())
Status::Running.to_value()
}
subclass::Property("min-latency", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.min_latency.to_value())
settings.min_latency.to_value()
}
subclass::Property("buffer-duration", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.buffer_duration.to_value())
settings.buffer_duration.to_value()
}
subclass::Property("statistics", ..) => Ok(self.get_stats().to_value()),
subclass::Property("statistics", ..) => self.get_stats().to_value(),
_ => unimplemented!(),
}
}

View file

@ -500,17 +500,17 @@ impl ObjectImpl for FallbackSwitch {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("timeout", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.timeout.to_value())
settings.timeout.to_value()
}
subclass::Property("active-pad", ..) => {
let active_pad = self.active_sinkpad.lock().unwrap().clone();
Ok(active_pad.to_value())
active_pad.to_value()
}
_ => unimplemented!(),
}

View file

@ -1702,17 +1702,17 @@ impl ObjectImpl for ToggleRecord {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("record", ..) => {
let settings = self.settings.lock();
Ok(settings.record.to_value())
settings.record.to_value()
}
subclass::Property("recording", ..) => {
let rec_state = self.state.lock();
Ok((rec_state.recording_state == RecordingState::Recording).to_value())
(rec_state.recording_state == RecordingState::Recording).to_value()
}
_ => unimplemented!(),
}

View file

@ -454,21 +454,21 @@ impl ObjectImpl for CCDetect {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("window", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.window.to_value())
settings.window.to_value()
}
subclass::Property("cc608", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.cc608.to_value())
settings.cc608.to_value()
}
subclass::Property("cc708", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.cc708.to_value())
settings.cc708.to_value()
}
_ => unimplemented!(),
}

View file

@ -591,17 +591,17 @@ impl ObjectImpl for MccEnc {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("uuid", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.uuid.to_value())
settings.uuid.to_value()
}
subclass::Property("creation-date", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.creation_date.to_value())
settings.creation_date.to_value()
}
_ => unimplemented!(),
}

View file

@ -84,7 +84,7 @@ impl State {
framerate: gst::Fraction,
element: &super::SccParse,
) -> Result<gst_video::ValidVideoTimeCode, gst::FlowError> {
use std::convert::TryInto;
use std::convert::TryFrom;
let timecode = gst_video::VideoTimeCode::new(
framerate,
@ -97,12 +97,17 @@ impl State {
tc.hours,
tc.minutes,
tc.seconds,
tc.frames,
0,
0,
);
match timecode.try_into() {
Ok(timecode) => Ok(timecode),
match gst_video::ValidVideoTimeCode::try_from(timecode) {
Ok(mut timecode) => {
// Add the number of frames here as sometimes it's higher than 30 and we simply
// want to wrap around in that case while keeping the timecode valid.
timecode.add_frames(tc.frames as i64);
Ok(timecode)
}
Err(timecode) => {
let last_timecode =
self.last_timecode

View file

@ -890,13 +890,13 @@ impl ObjectImpl for TtToCea608 {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("mode", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.mode.to_value())
settings.mode.to_value()
}
_ => unimplemented!(),
}

View file

@ -226,13 +226,13 @@ impl ObjectImpl for GifEnc {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("repeat", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.repeat.to_value())
settings.repeat.to_value()
}
_ => unimplemented!(),
}

View file

@ -422,49 +422,49 @@ impl ObjectImpl for Rav1Enc {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("speed-preset", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.speed_preset.to_value())
settings.speed_preset.to_value()
}
subclass::Property("low-latency", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.low_latency.to_value())
settings.low_latency.to_value()
}
subclass::Property("min-key-frame-interval", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.min_key_frame_interval.to_value())
settings.min_key_frame_interval.to_value()
}
subclass::Property("max-key-frame-interval", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.max_key_frame_interval.to_value())
settings.max_key_frame_interval.to_value()
}
subclass::Property("bitrate", ..) => {
let settings = self.settings.lock().unwrap();
Ok(settings.bitrate.to_value())
settings.bitrate.to_value()
}
subclass::Property("quantizer", ..) => {
let settings = self.settings.lock().unwrap();
Ok((settings.quantizer as u32).to_value())
(settings.quantizer as u32).to_value()
}
subclass::Property("tile-cols", ..) => {
let settings = self.settings.lock().unwrap();
Ok((settings.tile_cols as u32).to_value())
(settings.tile_cols as u32).to_value()
}
subclass::Property("tile-rows", ..) => {
let settings = self.settings.lock().unwrap();
Ok((settings.tile_rows as u32).to_value())
(settings.tile_rows as u32).to_value()
}
subclass::Property("tiles", ..) => {
let settings = self.settings.lock().unwrap();
Ok((settings.tiles as u32).to_value())
(settings.tiles as u32).to_value()
}
subclass::Property("threads", ..) => {
let settings = self.settings.lock().unwrap();
Ok((settings.threads as u32).to_value())
(settings.threads as u32).to_value()
}
_ => unimplemented!(),
}

View file

@ -279,17 +279,17 @@ impl ObjectImpl for PngEncoder {
}
}
fn get_property(&self, _obj: &Self::Type, id: usize) -> Result<glib::Value, ()> {
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
let prop = &PROPERTIES[id];
match *prop {
subclass::Property("compression-level", ..) => {
let settings = self.settings.lock();
Ok(settings.compression.to_value())
settings.compression.to_value()
}
subclass::Property("filter", ..) => {
let settings = self.settings.lock();
Ok(settings.filter.to_value())
settings.filter.to_value()
}
_ => unimplemented!(),
}