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" => { "max-delay" => {
let mut settings = self.settings.lock().unwrap(); let mut settings = self.settings.lock().unwrap();
if self.state.lock().unwrap().is_none() { 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" => { "delay" => {
let mut settings = self.settings.lock().unwrap(); 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" => { "intensity" => {
let mut settings = self.settings.lock().unwrap(); 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" => { "feedback" => {
let mut settings = self.settings.lock().unwrap(); 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!(), _ => unimplemented!(),
} }

View file

@ -1813,19 +1813,19 @@ impl ObjectImpl for AudioLoudNorm {
match pspec.name() { match pspec.name() {
"loudness-target" => { "loudness-target" => {
let mut settings = self.settings.lock().unwrap(); 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" => { "loudness-range-target" => {
let mut settings = self.settings.lock().unwrap(); 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" => { "max-true-peak" => {
let mut settings = self.settings.lock().unwrap(); 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" => { "offset" => {
let mut settings = self.settings.lock().unwrap(); 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!(), _ => unimplemented!(),
} }

View file

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

View file

@ -121,23 +121,23 @@ fn run_test(layout: gst_audio::AudioLayout, format: gst_audio::AudioFormat) {
let s = msg.structure().unwrap(); let s = msg.structure().unwrap();
if s.name() == "ebur128-level" { if s.name() == "ebur128-level" {
num_msgs += 1; num_msgs += 1;
let timestamp = s.get_some::<u64>("timestamp").unwrap(); let timestamp = s.get::<u64>("timestamp").unwrap();
let running_time = s.get_some::<u64>("running-time").unwrap(); let running_time = s.get::<u64>("running-time").unwrap();
let stream_time = s.get_some::<u64>("stream-time").unwrap(); let stream_time = s.get::<u64>("stream-time").unwrap();
assert_eq!(timestamp, num_msgs * 500 * gst::MSECOND_VAL); assert_eq!(timestamp, num_msgs * 500 * gst::MSECOND_VAL);
assert_eq!(running_time, 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); assert_eq!(stream_time, num_msgs * 500 * gst::MSECOND_VAL);
// Check if all these exist // Check if all these exist
let _momentary_loudness = s.get_some::<f64>("momentary-loudness").unwrap(); let _momentary_loudness = s.get::<f64>("momentary-loudness").unwrap();
let _shortterm_loudness = s.get_some::<f64>("shortterm-loudness").unwrap(); let _shortterm_loudness = s.get::<f64>("shortterm-loudness").unwrap();
let _global_loudness = s.get_some::<f64>("global-loudness").unwrap(); let _global_loudness = s.get::<f64>("global-loudness").unwrap();
let _relative_threshold = s.get_some::<f64>("relative-threshold").unwrap(); let _relative_threshold = s.get::<f64>("relative-threshold").unwrap();
let _loudness_range = s.get_some::<f64>("loudness-range").unwrap(); let _loudness_range = s.get::<f64>("loudness-range").unwrap();
let sample_peak = s.get::<gst::Array>("sample-peak").unwrap().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().len(), 2);
assert_eq!(sample_peak.as_slice()[0].type_(), glib::Type::F64); 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().len(), 2);
assert_eq!(true_peak.as_slice()[0].type_(), glib::Type::F64); 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" "Not enough streamheaders, trying in-band"
); );
} else { } 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 { if let Ok(Some(ident_buf)) = ident_buf {
gst_debug!(CAT, obj: element, "Got streamheader buffers"); gst_debug!(CAT, obj: element, "Got streamheader buffers");
let inmap = ident_buf.map_readable().unwrap(); let inmap = ident_buf.map_readable().unwrap();

View file

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

View file

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

View file

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

View file

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

View file

@ -449,7 +449,7 @@ impl ObjectImpl for Encrypter {
"block-size" => { "block-size" => {
let mut props = self.props.lock().unwrap(); 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!(), _ => unimplemented!(),

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -822,7 +822,7 @@ impl Transcriber {
let in_caps = self.sinkpad.current_caps().unwrap(); let in_caps = self.sinkpad.current_caps().unwrap();
let s = in_caps.structure(0).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(); let settings = self.settings.lock().unwrap();
@ -1075,11 +1075,11 @@ impl ObjectImpl for Transcriber {
} }
"latency" => { "latency" => {
let mut settings = self.settings.lock().unwrap(); 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" => { "use-partial-results" => {
let mut settings = self.settings.lock().unwrap(); 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" => { "vocabulary-name" => {
let mut settings = self.settings.lock().unwrap(); let mut settings = self.settings.lock().unwrap();

View file

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

View file

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

View file

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

View file

@ -540,17 +540,17 @@ impl ObjectImpl for TextWrap {
"columns" => { "columns" => {
let mut settings = self.settings.lock().unwrap(); let mut settings = self.settings.lock().unwrap();
let mut state = self.state.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; state.options = None;
} }
"lines" => { "lines" => {
let mut settings = self.settings.lock().unwrap(); 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" => { "accumulate-time" => {
let mut settings = self.settings.lock().unwrap(); let mut settings = self.settings.lock().unwrap();
let old_accumulate_time = settings.accumulate_time; 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, -1i64 => gst::CLOCK_TIME_NONE,
time => (time as u64).into(), time => (time as u64).into(),
}; };

View file

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

View file

@ -137,7 +137,7 @@ impl ObjectImpl for Rgb2Gray {
match pspec.name() { match pspec.name() {
"invert" => { "invert" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,
@ -149,7 +149,7 @@ impl ObjectImpl for Rgb2Gray {
} }
"shift" => { "shift" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,

View file

@ -236,7 +236,7 @@ impl ObjectImpl for SineSrc {
match pspec.name() { match pspec.name() {
"samples-per-buffer" => { "samples-per-buffer" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,
@ -251,7 +251,7 @@ impl ObjectImpl for SineSrc {
} }
"freq" => { "freq" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,
@ -263,7 +263,7 @@ impl ObjectImpl for SineSrc {
} }
"volume" => { "volume" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,
@ -275,7 +275,7 @@ impl ObjectImpl for SineSrc {
} }
"mute" => { "mute" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,
@ -287,7 +287,7 @@ impl ObjectImpl for SineSrc {
} }
"is-live" => { "is-live" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, 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 sink = gst::ElementFactory::make("gtksink", None).unwrap();
let widget = sink.property("widget").unwrap(); let widget = sink.property("widget").unwrap();
(sink, widget.get::<gtk::Widget>().unwrap().unwrap()) (sink, widget.get::<gtk::Widget>().unwrap())
}; };
pipeline pipeline

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1728,7 +1728,7 @@ impl ObjectImpl for ToggleRecord {
match pspec.name() { match pspec.name() {
"record" => { "record" => {
let mut settings = self.settings.lock(); 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!( gst_debug!(
CAT, CAT,
obj: obj, obj: obj,

View file

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

View file

@ -264,7 +264,7 @@ impl ObjectImpl for CCDetect {
match pspec.name() { match pspec.name() {
"window" => { "window" => {
let mut settings = self.settings.lock().unwrap(); 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!(), _ => unimplemented!(),
} }
@ -417,7 +417,7 @@ impl BaseTransformImpl for CCDetect {
.structure(0) .structure(0)
.ok_or_else(|| gst::loggable_error!(CAT, "Failed to parse input caps"))?; .ok_or_else(|| gst::loggable_error!(CAT, "Failed to parse input caps"))?;
let format_str = s let format_str = s
.get::<&str>("format") .get::<Option<&str>>("format")
.map_err(|_| gst::loggable_error!(CAT, "Failed to parse input caps"))? .map_err(|_| gst::loggable_error!(CAT, "Failed to parse input caps"))?
.ok_or_else(|| 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 { 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 settings = self.settings.lock().unwrap();
let mut state = self.state.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 { state.selected_field = match settings.field {
-1 => None, -1 => None,
val => Some(val as u8), val => Some(val as u8),

View file

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

View file

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

View file

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

View file

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

View file

@ -164,7 +164,7 @@ impl ObjectImpl for GifEnc {
match pspec.name() { match pspec.name() {
"repeat" => { "repeat" => {
let mut settings = self.settings.lock().unwrap(); 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!(), _ => unimplemented!(),
} }

View file

@ -156,7 +156,7 @@ impl ObjectImpl for HsvDetector {
match pspec.name() { match pspec.name() {
"hue-ref" => { "hue-ref" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,
@ -168,7 +168,7 @@ impl ObjectImpl for HsvDetector {
} }
"hue-var" => { "hue-var" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,
@ -180,7 +180,7 @@ impl ObjectImpl for HsvDetector {
} }
"saturation-ref" => { "saturation-ref" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,
@ -192,7 +192,7 @@ impl ObjectImpl for HsvDetector {
} }
"saturation-var" => { "saturation-var" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,
@ -204,7 +204,7 @@ impl ObjectImpl for HsvDetector {
} }
"value-ref" => { "value-ref" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,
@ -216,7 +216,7 @@ impl ObjectImpl for HsvDetector {
} }
"value-var" => { "value-var" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,

View file

@ -142,7 +142,7 @@ impl ObjectImpl for HsvFilter {
match pspec.name() { match pspec.name() {
"hue-shift" => { "hue-shift" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,
@ -154,7 +154,7 @@ impl ObjectImpl for HsvFilter {
} }
"saturation-mul" => { "saturation-mul" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,
@ -166,7 +166,7 @@ impl ObjectImpl for HsvFilter {
} }
"saturation-off" => { "saturation-off" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,
@ -178,7 +178,7 @@ impl ObjectImpl for HsvFilter {
} }
"value-mul" => { "value-mul" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,
@ -190,7 +190,7 @@ impl ObjectImpl for HsvFilter {
} }
"value-off" => { "value-off" => {
let mut settings = self.settings.lock().unwrap(); 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!( gst_info!(
CAT, CAT,
obj: obj, obj: obj,

View file

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

View file

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