Update for Value trait refactoring

This commit is contained in:
Sebastian Dröge 2021-04-25 15:41:22 +03:00
parent 40765f7c53
commit 15cf738616
59 changed files with 242 additions and 311 deletions

View file

@ -147,20 +147,20 @@ impl ObjectImpl for AudioEcho {
"max-delay" => {
let mut settings = self.settings.lock().unwrap();
if self.state.lock().unwrap().is_none() {
settings.max_delay = value.get_some().expect("type checked upstream");
settings.max_delay = value.get().expect("type checked upstream");
}
}
"delay" => {
let mut settings = self.settings.lock().unwrap();
settings.delay = value.get_some().expect("type checked upstream");
settings.delay = value.get().expect("type checked upstream");
}
"intensity" => {
let mut settings = self.settings.lock().unwrap();
settings.intensity = value.get_some().expect("type checked upstream");
settings.intensity = value.get().expect("type checked upstream");
}
"feedback" => {
let mut settings = self.settings.lock().unwrap();
settings.feedback = value.get_some().expect("type checked upstream");
settings.feedback = value.get().expect("type checked upstream");
}
_ => unimplemented!(),
}

View file

@ -1813,19 +1813,19 @@ impl ObjectImpl for AudioLoudNorm {
match pspec.name() {
"loudness-target" => {
let mut settings = self.settings.lock().unwrap();
settings.loudness_target = value.get_some().expect("type checked upstream");
settings.loudness_target = value.get().expect("type checked upstream");
}
"loudness-range-target" => {
let mut settings = self.settings.lock().unwrap();
settings.loudness_range_target = value.get_some().expect("type checked upstream");
settings.loudness_range_target = value.get().expect("type checked upstream");
}
"max-true-peak" => {
let mut settings = self.settings.lock().unwrap();
settings.max_true_peak = value.get_some().expect("type checked upstream");
settings.max_true_peak = value.get().expect("type checked upstream");
}
"offset" => {
let mut settings = self.settings.lock().unwrap();
settings.offset = value.get_some().expect("type checked upstream");
settings.offset = value.get().expect("type checked upstream");
}
_ => unimplemented!(),
}

View file

@ -129,7 +129,7 @@ impl ObjectImpl for EbuR128Level {
glib::subclass::Signal::builder("reset", &[], glib::Type::UNIT.into())
.action()
.class_handler(|_token, args| {
let this = args[0].get::<super::EbuR128Level>().unwrap().unwrap();
let this = args[0].get::<super::EbuR128Level>().unwrap();
let imp = EbuR128Level::from_instance(&this);
gst_info!(CAT, obj: &this, "Resetting measurements",);
@ -187,7 +187,7 @@ impl ObjectImpl for EbuR128Level {
let mut settings = self.settings.lock().unwrap();
match pspec.name() {
"mode" => {
let mode = value.get_some().expect("type checked upstream");
let mode = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -198,7 +198,7 @@ impl ObjectImpl for EbuR128Level {
settings.mode = mode;
}
"post-messages" => {
let post_messages = value.get_some().expect("type checked upstream");
let post_messages = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -209,7 +209,7 @@ impl ObjectImpl for EbuR128Level {
settings.post_messages = post_messages;
}
"interval" => {
let interval = value.get_some().expect("type checked upstream");
let interval = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,

View file

@ -121,23 +121,23 @@ fn run_test(layout: gst_audio::AudioLayout, format: gst_audio::AudioFormat) {
let s = msg.structure().unwrap();
if s.name() == "ebur128-level" {
num_msgs += 1;
let timestamp = s.get_some::<u64>("timestamp").unwrap();
let running_time = s.get_some::<u64>("running-time").unwrap();
let stream_time = s.get_some::<u64>("stream-time").unwrap();
let timestamp = s.get::<u64>("timestamp").unwrap();
let running_time = s.get::<u64>("running-time").unwrap();
let stream_time = s.get::<u64>("stream-time").unwrap();
assert_eq!(timestamp, num_msgs * 500 * gst::MSECOND_VAL);
assert_eq!(running_time, num_msgs * 500 * gst::MSECOND_VAL);
assert_eq!(stream_time, num_msgs * 500 * gst::MSECOND_VAL);
// Check if all these exist
let _momentary_loudness = s.get_some::<f64>("momentary-loudness").unwrap();
let _shortterm_loudness = s.get_some::<f64>("shortterm-loudness").unwrap();
let _global_loudness = s.get_some::<f64>("global-loudness").unwrap();
let _relative_threshold = s.get_some::<f64>("relative-threshold").unwrap();
let _loudness_range = s.get_some::<f64>("loudness-range").unwrap();
let sample_peak = s.get::<gst::Array>("sample-peak").unwrap().unwrap();
let _momentary_loudness = s.get::<f64>("momentary-loudness").unwrap();
let _shortterm_loudness = s.get::<f64>("shortterm-loudness").unwrap();
let _global_loudness = s.get::<f64>("global-loudness").unwrap();
let _relative_threshold = s.get::<f64>("relative-threshold").unwrap();
let _loudness_range = s.get::<f64>("loudness-range").unwrap();
let sample_peak = s.get::<gst::Array>("sample-peak").unwrap();
assert_eq!(sample_peak.as_slice().len(), 2);
assert_eq!(sample_peak.as_slice()[0].type_(), glib::Type::F64);
let true_peak = s.get::<gst::Array>("true-peak").unwrap().unwrap();
let true_peak = s.get::<gst::Array>("true-peak").unwrap();
assert_eq!(true_peak.as_slice().len(), 2);
assert_eq!(true_peak.as_slice()[0].type_(), glib::Type::F64);
}

View file

@ -137,7 +137,7 @@ impl AudioDecoderImpl for ClaxonDec {
"Not enough streamheaders, trying in-band"
);
} else {
let ident_buf = streamheaders[0].get::<gst::Buffer>();
let ident_buf = streamheaders[0].get::<Option<gst::Buffer>>();
if let Ok(Some(ident_buf)) = ident_buf {
gst_debug!(CAT, obj: element, "Got streamheader buffers");
let inmap = ident_buf.map_readable().unwrap();

View file

@ -390,12 +390,12 @@ impl ObjectImpl for CsoundFilter {
match pspec.name() {
"loop" => {
let mut settings = self.settings.lock().unwrap();
settings.loop_ = value.get_some().expect("type checked upstream");
settings.loop_ = value.get().expect("type checked upstream");
}
"location" => {
let mut settings = self.settings.lock().unwrap();
if self.state.lock().unwrap().is_none() {
settings.location = match value.get::<String>() {
settings.location = match value.get::<Option<String>>() {
Ok(location) => location,
_ => unreachable!("type checked upstream"),
};
@ -404,7 +404,7 @@ impl ObjectImpl for CsoundFilter {
"csd-text" => {
let mut settings = self.settings.lock().unwrap();
if self.state.lock().unwrap().is_none() {
settings.csd_text = match value.get::<String>() {
settings.csd_text = match value.get::<Option<String>>() {
Ok(text) => text,
_ => unreachable!("type checked upstream"),
};
@ -412,7 +412,7 @@ impl ObjectImpl for CsoundFilter {
}
"score_offset" => {
let mut settings = self.settings.lock().unwrap();
settings.offset = value.get_some().expect("type checked upstream");
settings.offset = value.get().expect("type checked upstream");
}
_ => unimplemented!(),
}

View file

@ -148,9 +148,9 @@ impl AudioDecoderImpl for LewtonDec {
return Ok(());
}
let ident_buf = streamheaders[0].get::<gst::Buffer>();
let comment_buf = streamheaders[1].get::<gst::Buffer>();
let setup_buf = streamheaders[2].get::<gst::Buffer>();
let ident_buf = streamheaders[0].get::<Option<gst::Buffer>>();
let comment_buf = streamheaders[1].get::<Option<gst::Buffer>>();
let setup_buf = streamheaders[2].get::<Option<gst::Buffer>>();
if let (Ok(Some(ident_buf)), Ok(Some(comment_buf)), Ok(Some(setup_buf))) =
(ident_buf, comment_buf, setup_buf)
{

View file

@ -138,7 +138,7 @@ impl ObjectImpl for FileSink {
) {
match pspec.name() {
"location" => {
let res = match value.get::<String>() {
let res = match value.get::<Option<String>>() {
Ok(Some(location)) => FileLocation::try_from_path_str(location)
.and_then(|file_location| self.set_location(obj, Some(file_location))),
Ok(None) => self.set_location(obj, None),

View file

@ -152,7 +152,7 @@ impl ObjectImpl for FileSrc {
) {
match pspec.name() {
"location" => {
let res = match value.get::<String>() {
let res = match value.get::<Option<String>>() {
Ok(Some(location)) => FileLocation::try_from_path_str(location)
.and_then(|file_location| self.set_location(obj, Some(file_location))),
Ok(None) => self.set_location(obj, None),

View file

@ -449,7 +449,7 @@ impl ObjectImpl for Encrypter {
"block-size" => {
let mut props = self.props.lock().unwrap();
props.block_size = value.get_some().expect("type checked upstream");
props.block_size = value.get().expect("type checked upstream");
}
_ => unimplemented!(),

View file

@ -584,14 +584,8 @@ impl ObjectImpl for AppSrc {
)
.action()
.class_handler(|_, args| {
let element = args[0]
.get::<super::AppSrc>()
.expect("signal arg")
.expect("missing signal arg");
let buffer = args[1]
.get::<gst::Buffer>()
.expect("signal arg")
.expect("missing signal arg");
let element = args[0].get::<super::AppSrc>().expect("signal arg");
let buffer = args[1].get::<gst::Buffer>().expect("signal arg");
let appsrc = AppSrc::from_instance(&element);
Some(appsrc.push_buffer(&element, buffer).to_value())
@ -600,10 +594,7 @@ impl ObjectImpl for AppSrc {
glib::subclass::Signal::builder("end-of-stream", &[], bool::static_type().into())
.action()
.class_handler(|_, args| {
let element = args[0]
.get::<super::AppSrc>()
.expect("signal arg")
.expect("missing signal arg");
let element = args[0].get::<super::AppSrc>().expect("signal arg");
let appsrc = AppSrc::from_instance(&element);
Some(appsrc.end_of_stream(&element).to_value())
@ -626,21 +617,21 @@ impl ObjectImpl for AppSrc {
match pspec.name() {
"context" => {
settings.context = value
.get()
.get::<Option<String>>()
.expect("type checked upstream")
.unwrap_or_else(|| "".into());
}
"context-wait" => {
settings.context_wait = value.get_some().expect("type checked upstream");
settings.context_wait = value.get().expect("type checked upstream");
}
"caps" => {
settings.caps = value.get().expect("type checked upstream");
}
"max-buffers" => {
settings.max_buffers = value.get_some().expect("type checked upstream");
settings.max_buffers = value.get().expect("type checked upstream");
}
"do-timestamp" => {
settings.do_timestamp = value.get_some().expect("type checked upstream");
settings.do_timestamp = value.get().expect("type checked upstream");
}
_ => unimplemented!(),
}

View file

@ -453,16 +453,18 @@ impl ObjectImpl for InputSelector {
"context" => {
let mut settings = self.settings.lock().unwrap();
settings.context = value
.get()
.get::<Option<String>>()
.expect("type checked upstream")
.unwrap_or_else(|| "".into());
}
"context-wait" => {
let mut settings = self.settings.lock().unwrap();
settings.context_wait = value.get_some().expect("type checked upstream");
settings.context_wait = value.get().expect("type checked upstream");
}
"active-pad" => {
let pad = value.get::<gst::Pad>().expect("type checked upstream");
let pad = value
.get::<Option<gst::Pad>>()
.expect("type checked upstream");
let mut state = self.state.lock().unwrap();
let pads = self.pads.lock().unwrap();
let mut old_pad = None;

View file

@ -183,9 +183,7 @@ impl SinkHandler {
gst_info!(CAT, obj: element, "Parsing {:?}", caps);
let payload = s
.get_some::<i32>("payload")
.map_err(|_| gst::FlowError::Error)?;
let payload = s.get::<i32>("payload").map_err(|_| gst::FlowError::Error)?;
if pt != 0 && payload as u8 != pt {
return Err(gst::FlowError::Error);
@ -193,7 +191,7 @@ impl SinkHandler {
inner.last_pt = Some(pt);
let clock_rate = s
.get_some::<i32>("clock-rate")
.get::<i32>("clock-rate")
.map_err(|_| gst::FlowError::Error)?;
if clock_rate <= 0 {
@ -376,7 +374,7 @@ impl SinkHandler {
.emit_by_name("request-pt-map", &[&(pt as u32)])
.map_err(|_| gst::FlowError::Error)?
.ok_or(gst::FlowError::Error)?
.get::<gst::Caps>()
.get::<Option<gst::Caps>>()
.map_err(|_| gst::FlowError::Error)?
.ok_or(gst::FlowError::Error)?;
let mut state = jb.state.lock().unwrap();
@ -1430,10 +1428,7 @@ impl ObjectImpl for JitterBuffer {
)
.action()
.class_handler(|_, args| {
let element = args[0]
.get::<super::JitterBuffer>()
.expect("signal arg")
.expect("missing signal arg");
let element = args[0].get::<super::JitterBuffer>().expect("signal arg");
let jb = JitterBuffer::from_instance(&element);
jb.clear_pt_map(&element);
None
@ -1455,7 +1450,7 @@ impl ObjectImpl for JitterBuffer {
"latency" => {
let latency_ms = {
let mut settings = self.settings.lock().unwrap();
settings.latency_ms = value.get_some().expect("type checked upstream");
settings.latency_ms = value.get().expect("type checked upstream");
settings.latency_ms as u64
};
@ -1466,26 +1461,26 @@ impl ObjectImpl for JitterBuffer {
}
"do-lost" => {
let mut settings = self.settings.lock().unwrap();
settings.do_lost = value.get_some().expect("type checked upstream");
settings.do_lost = value.get().expect("type checked upstream");
}
"max-dropout-time" => {
let mut settings = self.settings.lock().unwrap();
settings.max_dropout_time = value.get_some().expect("type checked upstream");
settings.max_dropout_time = value.get().expect("type checked upstream");
}
"max-misorder-time" => {
let mut settings = self.settings.lock().unwrap();
settings.max_misorder_time = value.get_some().expect("type checked upstream");
settings.max_misorder_time = value.get().expect("type checked upstream");
}
"context" => {
let mut settings = self.settings.lock().unwrap();
settings.context = value
.get()
.get::<Option<String>>()
.expect("type checked upstream")
.unwrap_or_else(|| "".into());
}
"context-wait" => {
let mut settings = self.settings.lock().unwrap();
settings.context_wait = value.get_some().expect("type checked upstream");
settings.context_wait = value.get().expect("type checked upstream");
}
_ => unimplemented!(),
}

View file

@ -613,7 +613,7 @@ impl ObjectImpl for ProxySink {
match pspec.name() {
"proxy-context" => {
settings.proxy_context = value
.get()
.get::<Option<String>>()
.expect("type checked upstream")
.unwrap_or_else(|| "".into());
}
@ -1196,26 +1196,26 @@ impl ObjectImpl for ProxySrc {
let mut settings = self.settings.lock().unwrap();
match pspec.name() {
"max-size-buffers" => {
settings.max_size_buffers = value.get_some().expect("type checked upstream");
settings.max_size_buffers = value.get().expect("type checked upstream");
}
"max-size-bytes" => {
settings.max_size_bytes = value.get_some().expect("type checked upstream");
settings.max_size_bytes = value.get().expect("type checked upstream");
}
"max-size-time" => {
settings.max_size_time = value.get_some().expect("type checked upstream");
settings.max_size_time = value.get().expect("type checked upstream");
}
"context" => {
settings.context = value
.get()
.get::<Option<String>>()
.expect("type checked upstream")
.unwrap_or_else(|| "".into());
}
"context-wait" => {
settings.context_wait = value.get_some().expect("type checked upstream");
settings.context_wait = value.get().expect("type checked upstream");
}
"proxy-context" => {
settings.proxy_context = value
.get()
.get::<Option<String>>()
.expect("type checked upstream")
.unwrap_or_else(|| "".into());
}

View file

@ -777,22 +777,22 @@ impl ObjectImpl for Queue {
let mut settings = self.settings.lock().unwrap();
match pspec.name() {
"max-size-buffers" => {
settings.max_size_buffers = value.get_some().expect("type checked upstream");
settings.max_size_buffers = value.get().expect("type checked upstream");
}
"max-size-bytes" => {
settings.max_size_bytes = value.get_some().expect("type checked upstream");
settings.max_size_bytes = value.get().expect("type checked upstream");
}
"max-size-time" => {
settings.max_size_time = value.get_some().expect("type checked upstream");
settings.max_size_time = value.get().expect("type checked upstream");
}
"context" => {
settings.context = value
.get()
.get::<Option<String>>()
.expect("type checked upstream")
.unwrap_or_else(|| "".into());
}
"context-wait" => {
settings.context_wait = value.get_some().expect("type checked upstream");
settings.context_wait = value.get().expect("type checked upstream");
}
_ => unimplemented!(),
}

View file

@ -636,22 +636,22 @@ impl ObjectImpl for TcpClientSrc {
settings.host = value.get().expect("type checked upstream");
}
"port" => {
settings.port = value.get_some().expect("type checked upstream");
settings.port = value.get().expect("type checked upstream");
}
"caps" => {
settings.caps = value.get().expect("type checked upstream");
}
"blocksize" => {
settings.blocksize = value.get_some().expect("type checked upstream");
settings.blocksize = value.get().expect("type checked upstream");
}
"context" => {
settings.context = value
.get()
.get::<Option<String>>()
.expect("type checked upstream")
.unwrap_or_else(|| "".into());
}
"context-wait" => {
settings.context_wait = value.get_some().expect("type checked upstream");
settings.context_wait = value.get().expect("type checked upstream");
}
_ => unimplemented!(),
}

View file

@ -1116,18 +1116,9 @@ impl ObjectImpl for UdpSink {
)
.action()
.class_handler(|_, args| {
let element = args[0]
.get::<super::UdpSink>()
.expect("signal arg")
.expect("missing signal arg");
let host = args[1]
.get::<String>()
.expect("signal arg")
.expect("missing signal arg");
let port = args[2]
.get::<i32>()
.expect("signal arg")
.expect("missing signal arg");
let element = args[0].get::<super::UdpSink>().expect("signal arg");
let host = args[1].get::<String>().expect("signal arg");
let port = args[2].get::<i32>().expect("signal arg");
if let Ok(addr) = try_into_socket_addr(&element, &host, port) {
let udpsink = UdpSink::from_instance(&element);
@ -1144,18 +1135,9 @@ impl ObjectImpl for UdpSink {
)
.action()
.class_handler(|_, args| {
let element = args[0]
.get::<super::UdpSink>()
.expect("signal arg")
.expect("missing signal arg");
let host = args[1]
.get::<String>()
.expect("signal arg")
.expect("missing signal arg");
let port = args[2]
.get::<i32>()
.expect("signal arg")
.expect("missing signal arg");
let element = args[0].get::<super::UdpSink>().expect("signal arg");
let host = args[1].get::<String>().expect("signal arg");
let port = args[2].get::<i32>().expect("signal arg");
if let Ok(addr) = try_into_socket_addr(&element, &host, port) {
let udpsink = UdpSink::from_instance(&element);
@ -1168,10 +1150,7 @@ impl ObjectImpl for UdpSink {
glib::subclass::Signal::builder("clear", &[], glib::types::Type::UNIT.into())
.action()
.class_handler(|_, args| {
let element = args[0]
.get::<super::UdpSink>()
.expect("signal arg")
.expect("missing signal arg");
let element = args[0].get::<super::UdpSink>().expect("signal arg");
let udpsink = UdpSink::from_instance(&element);
udpsink.clear_clients(std::iter::empty());
@ -1195,29 +1174,29 @@ impl ObjectImpl for UdpSink {
let mut settings = self.settings.lock().unwrap();
match pspec.name() {
"sync" => {
settings.sync = value.get_some().expect("type checked upstream");
settings.sync = value.get().expect("type checked upstream");
}
"bind-address" => {
settings.bind_address = value
.get()
.get::<Option<String>>()
.expect("type checked upstream")
.unwrap_or_else(|| "".into());
}
"bind-port" => {
settings.bind_port = value.get_some().expect("type checked upstream");
settings.bind_port = value.get().expect("type checked upstream");
}
"bind-address-v6" => {
settings.bind_address_v6 = value
.get()
.get::<Option<String>>()
.expect("type checked upstream")
.unwrap_or_else(|| "".into());
}
"bind-port-v6" => {
settings.bind_port_v6 = value.get_some().expect("type checked upstream");
settings.bind_port_v6 = value.get().expect("type checked upstream");
}
"socket" => {
settings.socket = value
.get::<gio::Socket>()
.get::<Option<gio::Socket>>()
.expect("type checked upstream")
.map(|socket| GioSocketWrapper::new(&socket));
}
@ -1226,7 +1205,7 @@ impl ObjectImpl for UdpSink {
}
"socket-v6" => {
settings.socket_v6 = value
.get::<gio::Socket>()
.get::<Option<gio::Socket>>()
.expect("type checked upstream")
.map(|socket| GioSocketWrapper::new(&socket));
}
@ -1234,23 +1213,23 @@ impl ObjectImpl for UdpSink {
unreachable!();
}
"auto-multicast" => {
settings.auto_multicast = value.get_some().expect("type checked upstream");
settings.auto_multicast = value.get().expect("type checked upstream");
}
"loop" => {
settings.multicast_loop = value.get_some().expect("type checked upstream");
settings.multicast_loop = value.get().expect("type checked upstream");
}
"ttl" => {
settings.ttl = value.get_some().expect("type checked upstream");
settings.ttl = value.get().expect("type checked upstream");
}
"ttl-mc" => {
settings.ttl_mc = value.get_some().expect("type checked upstream");
settings.ttl_mc = value.get().expect("type checked upstream");
}
"qos-dscp" => {
settings.qos_dscp = value.get_some().expect("type checked upstream");
settings.qos_dscp = value.get().expect("type checked upstream");
}
"clients" => {
let clients: String = value
.get()
let clients = value
.get::<Option<String>>()
.expect("type checked upstream")
.unwrap_or_else(|| "".into());
@ -1275,12 +1254,12 @@ impl ObjectImpl for UdpSink {
}
"context" => {
settings.context = value
.get()
.get::<Option<String>>()
.expect("type checked upstream")
.unwrap_or_else(|| "".into());
}
"context-wait" => {
settings.context_wait = value.get_some().expect("type checked upstream");
settings.context_wait = value.get().expect("type checked upstream");
}
_ => unimplemented!(),
}

View file

@ -811,20 +811,20 @@ impl ObjectImpl for UdpSrc {
settings.address = value.get().expect("type checked upstream");
}
"port" => {
settings.port = value.get_some().expect("type checked upstream");
settings.port = value.get().expect("type checked upstream");
}
"reuse" => {
settings.reuse = value.get_some().expect("type checked upstream");
settings.reuse = value.get().expect("type checked upstream");
}
"caps" => {
settings.caps = value.get().expect("type checked upstream");
}
"mtu" => {
settings.mtu = value.get_some().expect("type checked upstream");
settings.mtu = value.get().expect("type checked upstream");
}
"socket" => {
settings.socket = value
.get::<gio::Socket>()
.get::<Option<gio::Socket>>()
.expect("type checked upstream")
.map(|socket| GioSocketWrapper::new(&socket));
}
@ -833,15 +833,15 @@ impl ObjectImpl for UdpSrc {
}
"context" => {
settings.context = value
.get()
.get::<Option<String>>()
.expect("type checked upstream")
.unwrap_or_else(|| "".into());
}
"context-wait" => {
settings.context_wait = value.get_some().expect("type checked upstream");
settings.context_wait = value.get().expect("type checked upstream");
}
"retrieve-sender-address" => {
settings.retrieve_sender_address = value.get_some().expect("type checked upstream");
settings.retrieve_sender_address = value.get().expect("type checked upstream");
}
_ => unimplemented!(),
}

View file

@ -51,7 +51,7 @@ fn push() {
.emit_by_name("push-buffer", &[&gst::Buffer::new()])
.unwrap()
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap());
}
@ -59,7 +59,7 @@ fn push() {
.emit_by_name("end-of-stream", &[])
.unwrap()
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap());
}
@ -117,7 +117,7 @@ fn pause_regular() {
.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![1, 2, 3, 4])])
.unwrap()
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap());
let _ = h.pull().unwrap();
@ -127,7 +127,7 @@ fn pause_regular() {
.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![5, 6, 7])])
.unwrap()
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap());
appsrc
@ -139,7 +139,7 @@ fn pause_regular() {
.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![8, 9])])
.unwrap()
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap());
appsrc
@ -157,7 +157,7 @@ fn pause_regular() {
.emit_by_name("push-buffer", &[&gst::Buffer::new()])
.unwrap()
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap());
let _ = h.pull().unwrap();
@ -187,7 +187,7 @@ fn flush_regular() {
.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![1, 2, 3, 4])])
.unwrap()
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap());
let _ = h.pull().unwrap();
@ -200,7 +200,7 @@ fn flush_regular() {
.emit_by_name("push-buffer", &[&gst::Buffer::new()])
.unwrap()
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap());
assert!(h.try_pull().is_none());
@ -216,7 +216,7 @@ fn flush_regular() {
.emit_by_name("push-buffer", &[&gst::Buffer::new()])
.unwrap()
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap());
let _ = h.pull().unwrap();
@ -248,7 +248,7 @@ fn pause_flush() {
.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![1, 2, 3, 4])])
.unwrap()
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap());
let _ = h.pull().unwrap();
@ -265,7 +265,7 @@ fn pause_flush() {
.emit_by_name("push-buffer", &[&gst::Buffer::new()])
.unwrap()
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap());
assert!(h.try_pull().is_none());
@ -285,7 +285,7 @@ fn pause_flush() {
.emit_by_name("push-buffer", &[&gst::Buffer::new()])
.unwrap()
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap());
let _ = h.pull().unwrap();

View file

@ -40,16 +40,16 @@ fn test_active_pad() {
let active_pad = is
.property("active-pad")
.unwrap()
.get::<gst::Pad>()
.get::<Option<gst::Pad>>()
.unwrap();
assert_eq!(active_pad, h1.srcpad().unwrap().peer());
is.set_property("active-pad", &h2.srcpad().unwrap().peer())
is.set_property("active-pad", h2.srcpad().unwrap().peer())
.unwrap();
let active_pad = is
.property("active-pad")
.unwrap()
.get::<gst::Pad>()
.get::<Option<gst::Pad>>()
.unwrap();
assert_eq!(active_pad, h2.srcpad().unwrap().peer());
@ -86,7 +86,7 @@ fn test_active_pad() {
/* Switch the active pad and push a buffer, we should receive stream-start, segment and caps
* again */
let buf = gst::Buffer::new();
is.set_property("active-pad", &h1.srcpad().unwrap().peer())
is.set_property("active-pad", h1.srcpad().unwrap().peer())
.unwrap();
assert_eq!(h1.push(buf), Ok(gst::FlowSuccess::Ok));
assert_eq!(h1.buffers_received(), 3);

View file

@ -83,7 +83,6 @@ fn jb_pipeline() {
.unwrap()
.unwrap()
.get::<gst::Sample>()
.unwrap()
.unwrap();
sender.send(()).unwrap();
@ -150,7 +149,6 @@ fn jb_ts_pipeline() {
.unwrap()
.unwrap()
.get::<gst::Sample>()
.unwrap()
.unwrap();
sender.send(()).unwrap();

View file

@ -345,7 +345,7 @@ mod imp_src {
match pspec.name() {
"context" => {
let context = value
.get()
.get::<Option<String>>()
.expect("type checked upstream")
.unwrap_or_else(|| "".into());
@ -677,7 +677,6 @@ mod imp_sink {
let ItemSender { sender } = value
.get::<&ItemSender>()
.expect("type checked upstream")
.expect("ItemSender not found")
.clone();
*futures::executor::block_on(self.sender.lock()) = Some(sender);
}

View file

@ -92,7 +92,6 @@ fn multiple_contexts_queue() {
.unwrap()
.unwrap()
.get::<gst::Sample>()
.unwrap()
.unwrap();
sender_clone.send(()).unwrap();
@ -251,7 +250,6 @@ fn multiple_contexts_proxy() {
.unwrap()
.unwrap()
.get::<gst::Sample>()
.unwrap()
.unwrap();
sender_clone.send(()).unwrap();
@ -370,7 +368,6 @@ fn eos() {
.unwrap()
.unwrap()
.get::<gst::Sample>()
.unwrap()
.unwrap();
sample_notifier.send(()).unwrap();
@ -385,7 +382,7 @@ fn eos() {
src.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![0; 1024])])
.unwrap()
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap()
}
@ -401,7 +398,7 @@ fn eos() {
.emit_by_name("end-of-stream", &[])
.unwrap()
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap());
eos_notif_rcv.recv().unwrap();
@ -514,7 +511,6 @@ fn premature_shutdown() {
.unwrap()
.unwrap()
.get::<gst::Sample>()
.unwrap()
.unwrap();
appsink_sender.send(()).unwrap();
@ -532,7 +528,7 @@ fn premature_shutdown() {
src.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![0; 1024])])
.unwrap()
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap()
}

View file

@ -62,7 +62,6 @@ fn test_push() {
.unwrap()
.unwrap()
.get::<gst::Sample>()
.unwrap()
.unwrap();
samples_clone.lock().unwrap().push(sample);

View file

@ -57,7 +57,6 @@ fn test_push() {
.unwrap()
.unwrap()
.get::<gst::Sample>()
.unwrap()
.unwrap();
samples_clone.lock().unwrap().push(sample);

View file

@ -79,7 +79,6 @@ fn test_push() {
.unwrap()
.unwrap()
.get::<gst::Sample>()
.unwrap()
.unwrap();
let mut samples = samples_clone.lock().unwrap();

View file

@ -40,7 +40,6 @@ fn test_client_management() {
.property("clients")
.unwrap()
.get::<String>()
.unwrap()
.unwrap();
assert_eq!(clients, "127.0.0.1:5004");
@ -52,7 +51,6 @@ fn test_client_management() {
.property("clients")
.unwrap()
.get::<String>()
.unwrap()
.unwrap();
assert_eq!(clients, "127.0.0.1:5004,192.168.1.1:57");
@ -64,7 +62,6 @@ fn test_client_management() {
.property("clients")
.unwrap()
.get::<String>()
.unwrap()
.unwrap();
assert_eq!(clients, "127.0.0.1:5004,192.168.1.1:57");
@ -75,7 +72,6 @@ fn test_client_management() {
.property("clients")
.unwrap()
.get::<String>()
.unwrap()
.unwrap();
assert_eq!(clients, "127.0.0.1:5004");
@ -87,7 +83,6 @@ fn test_client_management() {
.property("clients")
.unwrap()
.get::<String>()
.unwrap()
.unwrap();
assert_eq!(clients, "127.0.0.1:5004");
@ -99,7 +94,6 @@ fn test_client_management() {
.property("clients")
.unwrap()
.get::<String>()
.unwrap()
.unwrap();
assert_eq!(clients, "");
@ -111,7 +105,6 @@ fn test_client_management() {
.property("clients")
.unwrap()
.get::<String>()
.unwrap()
.unwrap();
assert_eq!(clients, "127.0.0.1:5004,192.168.1.1:57");
@ -120,7 +113,6 @@ fn test_client_management() {
.property("clients")
.unwrap()
.get::<String>()
.unwrap()
.unwrap();
assert_eq!(clients, "");
}

View file

@ -304,8 +304,8 @@ impl ReqwestHttpSrc {
let mut append_header = |field: &HeaderName, value: &glib::Value| {
let value = match value.transform::<String>() {
Some(value) => value,
None => {
Ok(value) => value,
Err(_) => {
gst_warning!(
CAT,
obj: src,
@ -316,7 +316,7 @@ impl ReqwestHttpSrc {
}
};
let value = value.get::<&str>().unwrap().unwrap_or("");
let value = value.get::<Option<&str>>().unwrap().unwrap_or("");
let value = match HeaderValue::from_str(value) {
Ok(value) => value,
@ -334,11 +334,11 @@ impl ReqwestHttpSrc {
headers.append(field.clone(), value);
};
if let Ok(Some(values)) = value.get::<gst::Array>() {
if let Ok(values) = value.get::<gst::Array>() {
for value in values.as_slice() {
append_header(&field, value);
}
} else if let Ok(Some(values)) = value.get::<gst::List>() {
} else if let Ok(values) = value.get::<gst::List>() {
for value in values.as_slice() {
append_header(&field, value);
}
@ -673,7 +673,7 @@ impl ObjectImpl for ReqwestHttpSrc {
) {
match pspec.name() {
"location" => {
let location = value.get::<&str>().expect("type checked upstream");
let location = value.get::<Option<&str>>().expect("type checked upstream");
if let Err(err) = self.set_location(obj, location) {
gst_error!(
CAT,
@ -686,13 +686,13 @@ impl ObjectImpl for ReqwestHttpSrc {
"user-agent" => {
let mut settings = self.settings.lock().unwrap();
let user_agent = value
.get()
.get::<Option<String>>()
.expect("type checked upstream")
.unwrap_or_else(|| DEFAULT_USER_AGENT.into());
settings.user_agent = user_agent;
}
"is-live" => {
let is_live = value.get_some().expect("type checked upstream");
let is_live = value.get().expect("type checked upstream");
obj.set_live(is_live);
}
"user-id" => {
@ -707,12 +707,12 @@ impl ObjectImpl for ReqwestHttpSrc {
}
"timeout" => {
let mut settings = self.settings.lock().unwrap();
let timeout = value.get_some().expect("type checked upstream");
let timeout = value.get().expect("type checked upstream");
settings.timeout = timeout;
}
"compress" => {
let mut settings = self.settings.lock().unwrap();
let compress = value.get_some().expect("type checked upstream");
let compress = value.get().expect("type checked upstream");
settings.compress = compress;
}
"extra-headers" => {
@ -722,17 +722,16 @@ impl ObjectImpl for ReqwestHttpSrc {
}
"cookies" => {
let mut settings = self.settings.lock().unwrap();
let cookies = value.get().expect("type checked upstream");
settings.cookies = cookies.unwrap_or_else(Vec::new);
settings.cookies = value.get::<Vec<String>>().expect("type checked upstream");
}
"iradio-mode" => {
let mut settings = self.settings.lock().unwrap();
let iradio_mode = value.get_some().expect("type checked upstream");
let iradio_mode = value.get().expect("type checked upstream");
settings.iradio_mode = iradio_mode;
}
"keep-alive" => {
let mut settings = self.settings.lock().unwrap();
let keep_alive = value.get_some().expect("type checked upstream");
let keep_alive = value.get().expect("type checked upstream");
settings.keep_alive = keep_alive;
}
_ => unimplemented!(),
@ -831,7 +830,7 @@ impl ElementImpl for ReqwestHttpSrc {
let mut external_client = self.external_client.lock().unwrap();
let s = context.structure();
*external_client = s
.get_some::<&ClientContext>("client")
.get::<&ClientContext>("client")
.map(|c| Some(c.clone()))
.unwrap_or(None);
}

View file

@ -655,14 +655,11 @@ fn test_iradio_mode() {
let tag_event = srcpad.sticky_event(gst::EventType::Tag, 0).unwrap();
if let EventView::Tag(tags) = tag_event.view() {
let tags = tags.tag();
assert_eq!(
tags.get::<gst::tags::Organization>().unwrap().get(),
Some("Name")
);
assert_eq!(tags.get::<gst::tags::Genre>().unwrap().get(), Some("Genre"));
assert_eq!(tags.get::<gst::tags::Organization>().unwrap().get(), "Name");
assert_eq!(tags.get::<gst::tags::Genre>().unwrap().get(), "Genre");
assert_eq!(
tags.get::<gst::tags::Location>().unwrap().get(),
Some("http://www.example.com"),
"http://www.example.com",
);
} else {
unreachable!();

View file

@ -822,7 +822,7 @@ impl Transcriber {
let in_caps = self.sinkpad.current_caps().unwrap();
let s = in_caps.structure(0).unwrap();
let sample_rate: i32 = s.get("rate").unwrap().unwrap();
let sample_rate = s.get::<i32>("rate").unwrap();
let settings = self.settings.lock().unwrap();
@ -1075,11 +1075,11 @@ impl ObjectImpl for Transcriber {
}
"latency" => {
let mut settings = self.settings.lock().unwrap();
settings.latency_ms = value.get_some().expect("type checked upstream");
settings.latency_ms = value.get().expect("type checked upstream");
}
"use-partial-results" => {
let mut settings = self.settings.lock().unwrap();
settings.use_partial_results = value.get_some().expect("type checked upstream");
settings.use_partial_results = value.get().expect("type checked upstream");
}
"vocabulary-name" => {
let mut settings = self.settings.lock().unwrap();

View file

@ -399,22 +399,22 @@ impl ObjectImpl for S3Sink {
match pspec.name() {
"bucket" => {
settings.bucket = value.get::<String>().expect("type checked upstream");
settings.bucket = value
.get::<Option<String>>()
.expect("type checked upstream");
}
"key" => {
settings.key = value.get::<String>().expect("type checked upstream");
settings.key = value
.get::<Option<String>>()
.expect("type checked upstream");
}
"region" => {
settings.region = Region::from_str(
&value
.get::<String>()
.expect("type checked upstream")
.expect("set_property(\"region\"): no value provided"),
)
.unwrap();
settings.region =
Region::from_str(&value.get::<String>().expect("type checked upstream"))
.unwrap();
}
"part-size" => {
settings.buffer_size = value.get_some::<u64>().expect("type checked upstream");
settings.buffer_size = value.get::<u64>().expect("type checked upstream");
}
_ => unimplemented!(),
}

View file

@ -184,7 +184,7 @@ impl JsonGstEnc {
let mut state = self.state.lock().unwrap();
let caps = e.caps();
let s = caps.structure(0).unwrap();
state.format = match s.get::<String>("format") {
state.format = match s.get::<Option<String>>("format") {
Err(_) => None,
Ok(format) => format,
};

View file

@ -191,10 +191,10 @@ impl ObjectImpl for RegEx {
"commands" => {
let mut state = self.state.lock().unwrap();
state.commands = vec![];
let commands: gst::Array = value.get_some().expect("type checked upstream");
let commands: gst::Array = value.get().expect("type checked upstream");
for command in commands.as_slice() {
let s = match command
.get::<gst::Structure>()
.get::<Option<gst::Structure>>()
.expect("type checked upstream")
{
Some(s) => s,
@ -204,7 +204,7 @@ impl ObjectImpl for RegEx {
};
let operation = s.name();
let pattern = match s.get::<String>("pattern") {
let pattern = match s.get::<Option<String>>("pattern") {
Ok(Some(pattern)) => pattern,
Ok(None) | Err(_) => {
gst_error!(CAT, "All commands require a pattern field as a string");
@ -222,7 +222,7 @@ impl ObjectImpl for RegEx {
match operation {
"replace-all" | "replace_all" => {
let replacement = match s.get::<String>("replacement") {
let replacement = match s.get::<Option<String>>("replacement") {
Ok(Some(pattern)) => pattern,
Ok(None) | Err(_) => {
gst_error!(

View file

@ -540,17 +540,17 @@ impl ObjectImpl for TextWrap {
"columns" => {
let mut settings = self.settings.lock().unwrap();
let mut state = self.state.lock().unwrap();
settings.columns = value.get_some().expect("type checked upstream");
settings.columns = value.get().expect("type checked upstream");
state.options = None;
}
"lines" => {
let mut settings = self.settings.lock().unwrap();
settings.lines = value.get_some().expect("type checked upstream");
settings.lines = value.get().expect("type checked upstream");
}
"accumulate-time" => {
let mut settings = self.settings.lock().unwrap();
let old_accumulate_time = settings.accumulate_time;
settings.accumulate_time = match value.get_some().expect("type checked upstream") {
settings.accumulate_time = match value.get().expect("type checked upstream") {
-1i64 => gst::CLOCK_TIME_NONE,
time => (time as u64).into(),
};

View file

@ -108,7 +108,7 @@ impl ObjectImpl for ProgressBin {
"output" => {
let mut output_type = self.output_type.lock().unwrap();
let new_output_type = value
.get_some::<ProgressBinOutput>()
.get::<ProgressBinOutput>()
.expect("type checked upstream");
gst_info!(
CAT,
@ -230,7 +230,7 @@ impl BinImpl for ProgressBin {
.unwrap_or(false) =>
{
let s = msg.structure().unwrap();
if let Ok(percent) = s.get_some::<f64>("percent-double") {
if let Ok(percent) = s.get::<f64>("percent-double") {
let output_type = *self.output_type.lock().unwrap();
match output_type {
ProgressBinOutput::Println => println!("progress: {:5.1}%", percent),

View file

@ -137,7 +137,7 @@ impl ObjectImpl for Rgb2Gray {
match pspec.name() {
"invert" => {
let mut settings = self.settings.lock().unwrap();
let invert = value.get_some().expect("type checked upstream");
let invert = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -149,7 +149,7 @@ impl ObjectImpl for Rgb2Gray {
}
"shift" => {
let mut settings = self.settings.lock().unwrap();
let shift = value.get_some().expect("type checked upstream");
let shift = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,

View file

@ -236,7 +236,7 @@ impl ObjectImpl for SineSrc {
match pspec.name() {
"samples-per-buffer" => {
let mut settings = self.settings.lock().unwrap();
let samples_per_buffer = value.get_some().expect("type checked upstream");
let samples_per_buffer = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -251,7 +251,7 @@ impl ObjectImpl for SineSrc {
}
"freq" => {
let mut settings = self.settings.lock().unwrap();
let freq = value.get_some().expect("type checked upstream");
let freq = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -263,7 +263,7 @@ impl ObjectImpl for SineSrc {
}
"volume" => {
let mut settings = self.settings.lock().unwrap();
let volume = value.get_some().expect("type checked upstream");
let volume = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -275,7 +275,7 @@ impl ObjectImpl for SineSrc {
}
"mute" => {
let mut settings = self.settings.lock().unwrap();
let mute = value.get_some().expect("type checked upstream");
let mute = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -287,7 +287,7 @@ impl ObjectImpl for SineSrc {
}
"is-live" => {
let mut settings = self.settings.lock().unwrap();
let is_live = value.get_some().expect("type checked upstream");
let is_live = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,

View file

@ -70,7 +70,7 @@ fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element, gtk::Widget) {
{
let sink = gst::ElementFactory::make("gtksink", None).unwrap();
let widget = sink.property("widget").unwrap();
(sink, widget.get::<gtk::Widget>().unwrap().unwrap())
(sink, widget.get::<gtk::Widget>().unwrap())
};
pipeline

View file

@ -66,7 +66,6 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
value
.get()
.expect("AggregatorExtManual::min_upstream_latency")
.unwrap()
}
}

View file

@ -129,7 +129,6 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
value
.get()
.expect("Return Value for property `start-time` getter")
.unwrap()
}
}

View file

@ -110,7 +110,6 @@ impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {
value
.get()
.expect("Return Value for property `emit-signals` getter")
.unwrap()
}
}

View file

@ -85,7 +85,7 @@ impl ObjectImpl for CustomSource {
) {
match pspec.name() {
"source" => {
let source = value.get::<gst::Element>().unwrap().unwrap();
let source = value.get::<gst::Element>().unwrap();
self.source.set(source.clone()).unwrap();
obj.add(&source).unwrap();
}

View file

@ -302,7 +302,7 @@ impl ObjectImpl for FallbackSrc {
match pspec.name() {
"enable-audio" => {
let mut settings = self.settings.lock().unwrap();
let new_value = value.get_some().expect("type checked upstream");
let new_value = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -314,7 +314,7 @@ impl ObjectImpl for FallbackSrc {
}
"enable-video" => {
let mut settings = self.settings.lock().unwrap();
let new_value = value.get_some().expect("type checked upstream");
let new_value = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -362,7 +362,7 @@ impl ObjectImpl for FallbackSrc {
}
"timeout" => {
let mut settings = self.settings.lock().unwrap();
let new_value = value.get_some().expect("type checked upstream");
let new_value = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -374,7 +374,7 @@ impl ObjectImpl for FallbackSrc {
}
"restart-timeout" => {
let mut settings = self.settings.lock().unwrap();
let new_value = value.get_some().expect("type checked upstream");
let new_value = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -386,7 +386,7 @@ impl ObjectImpl for FallbackSrc {
}
"retry-timeout" => {
let mut settings = self.settings.lock().unwrap();
let new_value = value.get_some().expect("type checked upstream");
let new_value = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -398,7 +398,7 @@ impl ObjectImpl for FallbackSrc {
}
"restart-on-eos" => {
let mut settings = self.settings.lock().unwrap();
let new_value = value.get_some().expect("type checked upstream");
let new_value = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -410,7 +410,7 @@ impl ObjectImpl for FallbackSrc {
}
"min-latency" => {
let mut settings = self.settings.lock().unwrap();
let new_value = value.get_some().expect("type checked upstream");
let new_value = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -422,7 +422,7 @@ impl ObjectImpl for FallbackSrc {
}
"buffer-duration" => {
let mut settings = self.settings.lock().unwrap();
let new_value = value.get_some().expect("type checked upstream");
let new_value = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -1764,7 +1764,7 @@ impl FallbackSrc {
.fallback_input
.property("uri")
.unwrap()
.get::<String>()
.get::<Option<String>>()
.unwrap();
// This means previously videotestsrc was configured
@ -1777,7 +1777,7 @@ impl FallbackSrc {
fallback_input.call_async(|fallback_input| {
// Re-run video fallback input with videotestsrc
let _ = fallback_input.set_state(gst::State::Null);
let _ = fallback_input.set_property("uri", &None::<&str>);
let _ = fallback_input.set_property("uri", None::<&str>);
let _ = fallback_input.sync_state_with_parent();
});
@ -2116,7 +2116,7 @@ impl FallbackSrc {
s.switch
.property("active-pad")
.unwrap()
.get::<gst::Pad>()
.get::<Option<gst::Pad>>()
.unwrap()
})
.map(|p| p.name() == "fallback_sink")
@ -2130,7 +2130,7 @@ impl FallbackSrc {
s.switch
.property("active-pad")
.unwrap()
.get::<gst::Pad>()
.get::<Option<gst::Pad>>()
.unwrap()
})
.map(|p| p.name() == "fallback_sink")

View file

@ -128,7 +128,7 @@ impl ObjectImpl for VideoFallbackSource {
}
"min-latency" => {
let mut settings = self.settings.lock().unwrap();
let new_value = value.get_some().expect("type checked upstream");
let new_value = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -358,9 +358,9 @@ impl VideoFallbackSource {
let videoconvert_weak = videoconvert.downgrade();
typefind
.connect("have-type", false, move |args| {
let typefind = args[0].get::<gst::Element>().unwrap().unwrap();
let _probability = args[1].get_some::<u32>().unwrap();
let caps = args[2].get::<gst::Caps>().unwrap().unwrap();
let typefind = args[0].get::<gst::Element>().unwrap();
let _probability = args[1].get::<u32>().unwrap();
let caps = args[2].get::<gst::Caps>().unwrap();
let element = match element_weak.upgrade() {
Some(element) => element,

View file

@ -731,7 +731,7 @@ impl ObjectImpl for FallbackSwitch {
match pspec.name() {
"timeout" => {
let mut settings = self.settings.lock().unwrap();
let timeout = value.get_some().expect("type checked upstream");
let timeout = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -751,7 +751,9 @@ impl ObjectImpl for FallbackSwitch {
"active-pad property setting ignored, because auto-switch=true"
);
} else {
let active_pad = value.get::<gst::Pad>().expect("type checked upstream");
let active_pad = value
.get::<Option<gst::Pad>>()
.expect("type checked upstream");
/* Trigger a pad switch if needed */
let mut cur_active_pad = self.active_sinkpad.lock().unwrap();
if *cur_active_pad != active_pad {
@ -763,7 +765,7 @@ impl ObjectImpl for FallbackSwitch {
}
"auto-switch" => {
let mut settings = self.settings.lock().unwrap();
settings.auto_switch = value.get_some().expect("type checked upstream");
settings.auto_switch = value.get().expect("type checked upstream");
}
_ => unimplemented!(),
}

View file

@ -53,11 +53,11 @@ fn create_pipeline() -> (
glsinkbin.set_property("sink", &gtkglsink).unwrap();
let widget = gtkglsink.property("widget").unwrap();
(glsinkbin, widget.get::<gtk::Widget>().unwrap().unwrap())
(glsinkbin, widget.get::<gtk::Widget>().unwrap())
} else {
let sink = gst::ElementFactory::make("gtksink", None).unwrap();
let widget = sink.property("widget").unwrap();
(sink, widget.get::<gtk::Widget>().unwrap().unwrap())
(sink, widget.get::<gtk::Widget>().unwrap())
};
let video_enc = gst::ElementFactory::make("x264enc", None).unwrap();
@ -259,7 +259,7 @@ fn create_ui(app: &gtk::Application) {
let recording = !togglerecord
.property("record")
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap();
togglerecord.set_property("record", &recording).unwrap();

View file

@ -1728,7 +1728,7 @@ impl ObjectImpl for ToggleRecord {
match pspec.name() {
"record" => {
let mut settings = self.settings.lock();
let record = value.get_some().expect("type checked upstream");
let record = value.get().expect("type checked upstream");
gst_debug!(
CAT,
obj: obj,

View file

@ -1203,7 +1203,7 @@ fn test_two_stream_main_eos() {
let recording = togglerecord
.property("recording")
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap();
assert_eq!(recording, true);
@ -1222,7 +1222,7 @@ fn test_two_stream_main_eos() {
let recording = togglerecord
.property("recording")
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap();
assert_eq!(recording, false);
@ -1286,7 +1286,7 @@ fn test_two_stream_secondary_eos_first() {
let recording = togglerecord
.property("recording")
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap();
assert_eq!(recording, true);
@ -1297,7 +1297,7 @@ fn test_two_stream_secondary_eos_first() {
let recording = togglerecord
.property("recording")
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap();
assert_eq!(recording, false);
@ -1365,7 +1365,7 @@ fn test_three_stream_main_eos() {
let recording = togglerecord
.property("recording")
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap();
assert_eq!(recording, true);
@ -1384,7 +1384,7 @@ fn test_three_stream_main_eos() {
let recording = togglerecord
.property("recording")
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap();
assert_eq!(recording, true);
@ -1399,7 +1399,7 @@ fn test_three_stream_main_eos() {
let recording = togglerecord
.property("recording")
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap();
assert_eq!(recording, false);
@ -1478,7 +1478,7 @@ fn test_three_stream_main_and_second_eos() {
let recording = togglerecord
.property("recording")
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap();
assert_eq!(recording, true);
@ -1490,7 +1490,7 @@ fn test_three_stream_main_and_second_eos() {
let recording = togglerecord
.property("recording")
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap();
assert_eq!(recording, true);
@ -1511,7 +1511,7 @@ fn test_three_stream_main_and_second_eos() {
let recording = togglerecord
.property("recording")
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap();
assert_eq!(recording, false);
@ -1594,7 +1594,7 @@ fn test_three_stream_secondary_eos_first() {
let recording = togglerecord
.property("recording")
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap();
assert_eq!(recording, true);
@ -1606,7 +1606,7 @@ fn test_three_stream_secondary_eos_first() {
let recording = togglerecord
.property("recording")
.unwrap()
.get_some::<bool>()
.get::<bool>()
.unwrap();
assert_eq!(recording, false);

View file

@ -264,7 +264,7 @@ impl ObjectImpl for CCDetect {
match pspec.name() {
"window" => {
let mut settings = self.settings.lock().unwrap();
settings.window = value.get_some().expect("type checked upstream");
settings.window = value.get().expect("type checked upstream");
}
_ => unimplemented!(),
}
@ -417,7 +417,7 @@ impl BaseTransformImpl for CCDetect {
.structure(0)
.ok_or_else(|| gst::loggable_error!(CAT, "Failed to parse input caps"))?;
let format_str = s
.get::<&str>("format")
.get::<Option<&str>>("format")
.map_err(|_| gst::loggable_error!(CAT, "Failed to parse input caps"))?
.ok_or_else(|| gst::loggable_error!(CAT, "Failed to parse input caps"))?;
let cc_format = match format_str {

View file

@ -604,7 +604,7 @@ impl ObjectImpl for Cea608Overlay {
let mut settings = self.settings.lock().unwrap();
let mut state = self.state.lock().unwrap();
settings.field = value.get_some().expect("type checked upstream");
settings.field = value.get().expect("type checked upstream");
state.selected_field = match settings.field {
-1 => None,
val => Some(val as u8),

View file

@ -92,11 +92,7 @@ impl MccEnc {
.sinkpad
.current_caps()
.ok_or(gst::FlowError::NotNegotiated)?;
let framerate = match caps
.structure(0)
.unwrap()
.get_some::<gst::Fraction>("framerate")
{
let framerate = match caps.structure(0).unwrap().get::<gst::Fraction>("framerate") {
Ok(framerate) => framerate,
Err(structure::GetError::FieldNotFound { .. }) => {
return Err(gst::FlowError::NotNegotiated);
@ -371,7 +367,7 @@ impl MccEnc {
EventView::Caps(ev) => {
let caps = ev.caps();
let s = caps.structure(0).unwrap();
let framerate = match s.get_some::<gst::Fraction>("framerate") {
let framerate = match s.get::<gst::Fraction>("framerate") {
Ok(framerate) => framerate,
Err(structure::GetError::FieldNotFound { .. }) => {
gst_error!(CAT, obj: pad, "Caps without framerate");

View file

@ -254,7 +254,7 @@ impl SccEnc {
EventView::Caps(ev) => {
let caps = ev.caps();
let s = caps.structure(0).unwrap();
let framerate = match s.get_some::<gst::Fraction>("framerate") {
let framerate = match s.get::<gst::Fraction>("framerate") {
Ok(framerate) => Some(framerate),
Err(structure::GetError::FieldNotFound { .. }) => {
gst_error!(CAT, obj: pad, "Caps without framerate");

View file

@ -925,7 +925,7 @@ impl TtToCea608 {
s.fixate();
let mut state = self.state.lock().unwrap();
state.framerate = s.get_some::<gst::Fraction>("framerate").unwrap();
state.framerate = s.get::<gst::Fraction>("framerate").unwrap();
let upstream_caps = e.caps();
let s = upstream_caps.structure(0).unwrap();
@ -1090,19 +1090,17 @@ impl ObjectImpl for TtToCea608 {
match pspec.name() {
"mode" => {
let mut settings = self.settings.lock().unwrap();
settings.mode = value
.get_some::<Cea608Mode>()
.expect("type checked upstream");
settings.mode = value.get::<Cea608Mode>().expect("type checked upstream");
self.state.lock().unwrap().force_clear = true;
}
"origin-row" => {
let mut settings = self.settings.lock().unwrap();
settings.origin_row = value.get_some().expect("type checked upstream");
settings.origin_row = value.get().expect("type checked upstream");
self.state.lock().unwrap().force_clear = true;
}
"origin-column" => {
let mut settings = self.settings.lock().unwrap();
settings.origin_column = value.get_some().expect("type checked upstream");
settings.origin_column = value.get().expect("type checked upstream");
let mut state = self.state.lock().unwrap();
state.force_clear = true;
state.column = settings.origin_column;

View file

@ -256,9 +256,7 @@ impl ObjectImpl for TtToJson {
match pspec.name() {
"mode" => {
let mut settings = self.settings.lock().unwrap();
settings.mode = value
.get_some::<Cea608Mode>()
.expect("type checked upstream");
settings.mode = value.get::<Cea608Mode>().expect("type checked upstream");
}
_ => unimplemented!(),
}

View file

@ -164,7 +164,7 @@ impl ObjectImpl for GifEnc {
match pspec.name() {
"repeat" => {
let mut settings = self.settings.lock().unwrap();
settings.repeat = value.get_some().expect("type checked upstream");
settings.repeat = value.get().expect("type checked upstream");
}
_ => unimplemented!(),
}

View file

@ -156,7 +156,7 @@ impl ObjectImpl for HsvDetector {
match pspec.name() {
"hue-ref" => {
let mut settings = self.settings.lock().unwrap();
let hue_ref = value.get_some().expect("type checked upstream");
let hue_ref = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -168,7 +168,7 @@ impl ObjectImpl for HsvDetector {
}
"hue-var" => {
let mut settings = self.settings.lock().unwrap();
let hue_var = value.get_some().expect("type checked upstream");
let hue_var = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -180,7 +180,7 @@ impl ObjectImpl for HsvDetector {
}
"saturation-ref" => {
let mut settings = self.settings.lock().unwrap();
let saturation_ref = value.get_some().expect("type checked upstream");
let saturation_ref = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -192,7 +192,7 @@ impl ObjectImpl for HsvDetector {
}
"saturation-var" => {
let mut settings = self.settings.lock().unwrap();
let saturation_var = value.get_some().expect("type checked upstream");
let saturation_var = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -204,7 +204,7 @@ impl ObjectImpl for HsvDetector {
}
"value-ref" => {
let mut settings = self.settings.lock().unwrap();
let value_ref = value.get_some().expect("type checked upstream");
let value_ref = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -216,7 +216,7 @@ impl ObjectImpl for HsvDetector {
}
"value-var" => {
let mut settings = self.settings.lock().unwrap();
let value_var = value.get_some().expect("type checked upstream");
let value_var = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,

View file

@ -142,7 +142,7 @@ impl ObjectImpl for HsvFilter {
match pspec.name() {
"hue-shift" => {
let mut settings = self.settings.lock().unwrap();
let hue_shift = value.get_some().expect("type checked upstream");
let hue_shift = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -154,7 +154,7 @@ impl ObjectImpl for HsvFilter {
}
"saturation-mul" => {
let mut settings = self.settings.lock().unwrap();
let saturation_mul = value.get_some().expect("type checked upstream");
let saturation_mul = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -166,7 +166,7 @@ impl ObjectImpl for HsvFilter {
}
"saturation-off" => {
let mut settings = self.settings.lock().unwrap();
let saturation_off = value.get_some().expect("type checked upstream");
let saturation_off = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -178,7 +178,7 @@ impl ObjectImpl for HsvFilter {
}
"value-mul" => {
let mut settings = self.settings.lock().unwrap();
let value_mul = value.get_some().expect("type checked upstream");
let value_mul = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,
@ -190,7 +190,7 @@ impl ObjectImpl for HsvFilter {
}
"value-off" => {
let mut settings = self.settings.lock().unwrap();
let value_off = value.get_some().expect("type checked upstream");
let value_off = value.get().expect("type checked upstream");
gst_info!(
CAT,
obj: obj,

View file

@ -319,46 +319,43 @@ impl ObjectImpl for Rav1Enc {
match pspec.name() {
"speed-preset" => {
let mut settings = self.settings.lock().unwrap();
settings.speed_preset = value.get_some().expect("type checked upstream");
settings.speed_preset = value.get().expect("type checked upstream");
}
"low-latency" => {
let mut settings = self.settings.lock().unwrap();
settings.low_latency = value.get_some().expect("type checked upstream");
settings.low_latency = value.get().expect("type checked upstream");
}
"min-key-frame-interval" => {
let mut settings = self.settings.lock().unwrap();
settings.min_key_frame_interval = value.get_some().expect("type checked upstream");
settings.min_key_frame_interval = value.get().expect("type checked upstream");
}
"max-key-frame-interval" => {
let mut settings = self.settings.lock().unwrap();
settings.max_key_frame_interval = value.get_some().expect("type checked upstream");
settings.max_key_frame_interval = value.get().expect("type checked upstream");
}
"bitrate" => {
let mut settings = self.settings.lock().unwrap();
settings.bitrate = value.get_some().expect("type checked upstream");
settings.bitrate = value.get().expect("type checked upstream");
}
"quantizer" => {
let mut settings = self.settings.lock().unwrap();
settings.quantizer =
value.get_some::<u32>().expect("type checked upstream") as usize;
settings.quantizer = value.get::<u32>().expect("type checked upstream") as usize;
}
"tile-cols" => {
let mut settings = self.settings.lock().unwrap();
settings.tile_cols =
value.get_some::<u32>().expect("type checked upstream") as usize;
settings.tile_cols = value.get::<u32>().expect("type checked upstream") as usize;
}
"tile-rows" => {
let mut settings = self.settings.lock().unwrap();
settings.tile_rows =
value.get_some::<u32>().expect("type checked upstream") as usize;
settings.tile_rows = value.get::<u32>().expect("type checked upstream") as usize;
}
"tiles" => {
let mut settings = self.settings.lock().unwrap();
settings.tiles = value.get_some::<u32>().expect("type checked upstream") as usize;
settings.tiles = value.get::<u32>().expect("type checked upstream") as usize;
}
"threads" => {
let mut settings = self.settings.lock().unwrap();
settings.threads = value.get_some::<u32>().expect("type checked upstream") as usize;
settings.threads = value.get::<u32>().expect("type checked upstream") as usize;
}
_ => unimplemented!(),
}

View file

@ -209,14 +209,12 @@ impl ObjectImpl for PngEncoder {
"compression-level" => {
let mut settings = self.settings.lock();
settings.compression = value
.get_some::<CompressionLevel>()
.get::<CompressionLevel>()
.expect("type checked upstream");
}
"filter" => {
let mut settings = self.settings.lock();
settings.filter = value
.get_some::<FilterType>()
.expect("type checked upstream");
settings.filter = value.get::<FilterType>().expect("type checked upstream");
}
_ => unreachable!(),
}