diff options
author | François Laignel <fengalin@free.fr> | 2021-04-12 15:49:54 +0300 |
---|---|---|
committer | François Laignel <fengalin@free.fr> | 2021-04-12 16:57:19 +0300 |
commit | 06accc8d98cc2876bcacfc6f9e097af690b4e64f (patch) | |
tree | e4f056143e5257d49b367dd28ef5fecaa1df9ebc /net | |
parent | c3fb55f235f7feb1ab737a64f8d3d53d03a81c7a (diff) |
fix-getters-{def,calls} pass
Diffstat (limited to 'net')
-rw-r--r-- | net/reqwest/src/reqwesthttpsrc/imp.rs | 16 | ||||
-rw-r--r-- | net/reqwest/tests/reqwesthttpsrc.rs | 88 | ||||
-rw-r--r-- | net/rusoto/src/aws_transcriber/imp.rs | 65 | ||||
-rw-r--r-- | net/rusoto/src/s3sink/imp.rs | 4 | ||||
-rw-r--r-- | net/rusoto/src/s3src/imp.rs | 4 |
5 files changed, 84 insertions, 93 deletions
diff --git a/net/reqwest/src/reqwesthttpsrc/imp.rs b/net/reqwest/src/reqwesthttpsrc/imp.rs index 7552a9d23..296949b92 100644 --- a/net/reqwest/src/reqwesthttpsrc/imp.rs +++ b/net/reqwest/src/reqwesthttpsrc/imp.rs @@ -181,7 +181,7 @@ impl ReqwestHttpSrc { let srcpad = src.get_static_pad("src").unwrap(); let mut q = gst::query::Context::new(REQWEST_CLIENT_CONTEXT); if srcpad.peer_query(&mut q) { - if let Some(context) = q.get_context_owned() { + if let Some(context) = q.context_owned() { src.set_context(&context); } } else { @@ -224,7 +224,7 @@ impl ReqwestHttpSrc { let mut context = gst::Context::new(REQWEST_CLIENT_CONTEXT, true); { let context = context.get_mut().unwrap(); - let s = context.get_mut_structure(); + let s = context.structure_mut(); s.set("client", &client); } src.set_context(&context); @@ -671,7 +671,7 @@ impl ObjectImpl for ReqwestHttpSrc { value: &glib::Value, pspec: &glib::ParamSpec, ) { - match pspec.get_name() { + match pspec.name() { "location" => { let location = value.get::<&str>().expect("type checked upstream"); if let Err(err) = self.set_location(obj, location) { @@ -740,7 +740,7 @@ impl ObjectImpl for ReqwestHttpSrc { } fn get_property(&self, obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value { - match pspec.get_name() { + match pspec.name() { "location" => { let settings = self.settings.lock().unwrap(); let location = settings.location.as_ref().map(Url::to_string); @@ -827,9 +827,9 @@ impl ElementImpl for ReqwestHttpSrc { } fn set_context(&self, element: &Self::Type, context: &gst::Context) { - if context.get_context_type() == REQWEST_CLIENT_CONTEXT { + if context.context_type() == REQWEST_CLIENT_CONTEXT { let mut external_client = self.external_client.lock().unwrap(); - let s = context.get_structure(); + let s = context.structure(); *external_client = s .get_some::<&ClientContext>("client") .map(|c| Some(c.clone())) @@ -946,8 +946,8 @@ impl BaseSrcImpl for ReqwestHttpSrc { } }; - let start = segment.get_start().expect("No start position given"); - let stop = segment.get_stop(); + let start = segment.start().expect("No start position given"); + let stop = segment.stop(); gst_debug!(CAT, obj: src, "Seeking to {}-{:?}", start, stop); diff --git a/net/reqwest/tests/reqwesthttpsrc.rs b/net/reqwest/tests/reqwesthttpsrc.rs index 96b08a051..4e51c184d 100644 --- a/net/reqwest/tests/reqwesthttpsrc.rs +++ b/net/reqwest/tests/reqwesthttpsrc.rs @@ -172,7 +172,7 @@ impl Harness { match msg.view() { MessageView::Error(err) => { - return err.get_error(); + return err.error(); } _ => (), } @@ -205,13 +205,13 @@ impl Harness { match msg.view() { MessageView::StateChanged(state) => { - return state.get_current(); + return state.current(); } MessageView::Error(err) => { panic!( "Got error: {} ({})", - err.get_error(), - err.get_debug().unwrap_or_else(|| String::from("None")) + err.error(), + err.debug().unwrap_or_else(|| String::from("None")) ); } _ => (), @@ -239,7 +239,7 @@ impl Harness { match ev.view() { EventView::Segment(seg) => { return seg - .get_segment() + .segment() .clone() .downcast::<gst::format::Bytes>() .unwrap(); @@ -254,8 +254,8 @@ impl Harness { MessageView::Error(err) => { panic!( "Got error: {} ({})", - err.get_error(), - err.get_debug().unwrap_or_else(|| String::from("None")) + err.error(), + err.debug().unwrap_or_else(|| String::from("None")) ); } _ => (), @@ -294,8 +294,8 @@ impl Harness { MessageView::Error(err) => { panic!( "Got error: {} ({})", - err.get_error(), - err.get_debug().unwrap_or_else(|| String::from("None")) + err.error(), + err.debug().unwrap_or_else(|| String::from("None")) ); } _ => (), @@ -316,7 +316,7 @@ impl Drop for Harness { fn drop(&mut self) { // Shut down everything that was set up for this test harness // and wait until the tokio runtime exited - let bus = self.src.get_bus().unwrap(); + let bus = self.src.bus().unwrap(); bus.set_flushing(true); // Drop the receiver first before setting the state so that @@ -376,8 +376,8 @@ fn test_basic_request() { // Map the buffer readable and check if it contains exactly the data we would expect at // this point after reading everything else we read in previous runs let map = buffer.map_readable().unwrap(); - let mut read_buf = vec![0; map.get_size()]; - assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size()); + let mut read_buf = vec![0; map.size()]; + assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size()); assert_eq!(&*map, &*read_buf); } @@ -434,8 +434,8 @@ fn test_basic_request_inverted_defaults() { // Map the buffer readable and check if it contains exactly the data we would expect at // this point after reading everything else we read in previous runs let map = buffer.map_readable().unwrap(); - let mut read_buf = vec![0; map.get_size()]; - assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size()); + let mut read_buf = vec![0; map.size()]; + assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size()); assert_eq!(&*map, &*read_buf); } @@ -512,8 +512,8 @@ fn test_extra_headers() { // Map the buffer readable and check if it contains exactly the data we would expect at // this point after reading everything else we read in previous runs let map = buffer.map_readable().unwrap(); - let mut read_buf = vec![0; map.get_size()]; - assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size()); + let mut read_buf = vec![0; map.size()]; + assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size()); assert_eq!(&*map, &*read_buf); } @@ -572,8 +572,8 @@ fn test_cookies_property() { // Map the buffer readable and check if it contains exactly the data we would expect at // this point after reading everything else we read in previous runs let map = buffer.map_readable().unwrap(); - let mut read_buf = vec![0; map.get_size()]; - assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size()); + let mut read_buf = vec![0; map.size()]; + assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size()); assert_eq!(&*map, &*read_buf); } @@ -632,8 +632,8 @@ fn test_iradio_mode() { // Map the buffer readable and check if it contains exactly the data we would expect at // this point after reading everything else we read in previous runs let map = buffer.map_readable().unwrap(); - let mut read_buf = vec![0; map.get_size()]; - assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size()); + let mut read_buf = vec![0; map.size()]; + assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size()); assert_eq!(&*map, &*read_buf); } @@ -641,7 +641,7 @@ fn test_iradio_mode() { assert_eq!(cursor.position(), 11); let srcpad = h.src.get_static_pad("src").unwrap(); - let caps = srcpad.get_current_caps().unwrap(); + let caps = srcpad.current_caps().unwrap(); assert_eq!( caps, gst::Caps::builder("application/x-icy") @@ -654,7 +654,7 @@ fn test_iradio_mode() { use gst::EventView; let tag_event = srcpad.get_sticky_event(gst::EventType::Tag, 0).unwrap(); if let EventView::Tag(tags) = tag_event.view() { - let tags = tags.get_tag(); + let tags = tags.tag(); assert_eq!( tags.get::<gst::tags::Organization>().unwrap().get(), Some("Name") @@ -713,8 +713,8 @@ fn test_audio_l16() { // Map the buffer readable and check if it contains exactly the data we would expect at // this point after reading everything else we read in previous runs let map = buffer.map_readable().unwrap(); - let mut read_buf = vec![0; map.get_size()]; - assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size()); + let mut read_buf = vec![0; map.size()]; + assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size()); assert_eq!(&*map, &*read_buf); } @@ -722,7 +722,7 @@ fn test_audio_l16() { assert_eq!(cursor.position(), 11); let srcpad = h.src.get_static_pad("src").unwrap(); - let caps = srcpad.get_current_caps().unwrap(); + let caps = srcpad.current_caps().unwrap(); assert_eq!( caps, gst::Caps::builder("audio/x-unaligned-raw") @@ -787,8 +787,8 @@ fn test_authorization() { // Map the buffer readable and check if it contains exactly the data we would expect at // this point after reading everything else we read in previous runs let map = buffer.map_readable().unwrap(); - let mut read_buf = vec![0; map.get_size()]; - assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size()); + let mut read_buf = vec![0; map.size()]; + assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size()); assert_eq!(&*map, &*read_buf); } @@ -936,7 +936,7 @@ fn test_seek_after_ready() { }); let segment = h.wait_for_segment(false); - assert_eq!(segment.get_start(), gst::format::Bytes::from(123)); + assert_eq!(segment.start(), gst::format::Bytes::from(123)); let mut expected_output = vec![0; 8192 - 123]; for (i, d) in expected_output.iter_mut().enumerate() { @@ -945,12 +945,12 @@ fn test_seek_after_ready() { let mut cursor = Cursor::new(expected_output); while let Some(buffer) = h.wait_buffer_or_eos() { - assert_eq!(buffer.get_offset(), 123 + cursor.position()); + assert_eq!(buffer.offset(), 123 + cursor.position()); let map = buffer.map_readable().unwrap(); - let mut read_buf = vec![0; map.get_size()]; + let mut read_buf = vec![0; map.size()]; - assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size()); + assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size()); assert_eq!(&*map, &*read_buf); } } @@ -1005,7 +1005,7 @@ fn test_seek_after_buffer_received() { //wait for a buffer let buffer = h.wait_buffer_or_eos().unwrap(); - assert_eq!(buffer.get_offset(), 0); + assert_eq!(buffer.offset(), 0); //seek to a position after a buffer is Received h.run(|src| { @@ -1014,7 +1014,7 @@ fn test_seek_after_buffer_received() { }); let segment = h.wait_for_segment(true); - assert_eq!(segment.get_start(), gst::format::Bytes::from(123)); + assert_eq!(segment.start(), gst::format::Bytes::from(123)); let mut expected_output = vec![0; 8192 - 123]; for (i, d) in expected_output.iter_mut().enumerate() { @@ -1023,12 +1023,12 @@ fn test_seek_after_buffer_received() { let mut cursor = Cursor::new(expected_output); while let Some(buffer) = h.wait_buffer_or_eos() { - assert_eq!(buffer.get_offset(), 123 + cursor.position()); + assert_eq!(buffer.offset(), 123 + cursor.position()); let map = buffer.map_readable().unwrap(); - let mut read_buf = vec![0; map.get_size()]; + let mut read_buf = vec![0; map.size()]; - assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size()); + assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size()); assert_eq!(&*map, &*read_buf); } } @@ -1083,7 +1083,7 @@ fn test_seek_with_stop_position() { //wait for a buffer let buffer = h.wait_buffer_or_eos().unwrap(); - assert_eq!(buffer.get_offset(), 0); + assert_eq!(buffer.offset(), 0); //seek to a position after a buffer is Received h.run(|src| { @@ -1099,8 +1099,8 @@ fn test_seek_with_stop_position() { }); let segment = h.wait_for_segment(true); - assert_eq!(segment.get_start(), gst::format::Bytes::from(123)); - assert_eq!(segment.get_stop(), gst::format::Bytes::from(131)); + assert_eq!(segment.start(), gst::format::Bytes::from(123)); + assert_eq!(segment.stop(), gst::format::Bytes::from(131)); let mut expected_output = vec![0; 8]; for (i, d) in expected_output.iter_mut().enumerate() { @@ -1109,12 +1109,12 @@ fn test_seek_with_stop_position() { let mut cursor = Cursor::new(expected_output); while let Some(buffer) = h.wait_buffer_or_eos() { - assert_eq!(buffer.get_offset(), 123 + cursor.position()); + assert_eq!(buffer.offset(), 123 + cursor.position()); let map = buffer.map_readable().unwrap(); - let mut read_buf = vec![0; map.get_size()]; + let mut read_buf = vec![0; map.size()]; - assert_eq!(cursor.read(&mut read_buf).unwrap(), map.get_size()); + assert_eq!(cursor.read(&mut read_buf).unwrap(), map.size()); assert_eq!(&*map, &*read_buf); } } @@ -1146,7 +1146,7 @@ fn test_cookies() { let mut num_bytes = 0; while let Some(buffer) = h.wait_buffer_or_eos() { - num_bytes += buffer.get_size(); + num_bytes += buffer.size(); } assert_eq!(num_bytes, 11); @@ -1182,7 +1182,7 @@ fn test_cookies() { let mut num_bytes = 0; while let Some(buffer) = h2.wait_buffer_or_eos() { - num_bytes += buffer.get_size(); + num_bytes += buffer.size(); } assert_eq!(num_bytes, 12); } diff --git a/net/rusoto/src/aws_transcriber/imp.rs b/net/rusoto/src/aws_transcriber/imp.rs index 9e19d9603..969798a12 100644 --- a/net/rusoto/src/aws_transcriber/imp.rs +++ b/net/rusoto/src/aws_transcriber/imp.rs @@ -212,7 +212,7 @@ impl Transcriber { let latency: gst::ClockTime = (self.settings.lock().unwrap().latency_ms as u64 - (2 * GRANULARITY_MS) as u64) * gst::MSECOND; - let now = element.get_current_running_time(); + let now = element.current_running_time(); if let Some(alternative) = state.partial_alternative.take() { self.enqueue(element, &mut state, &alternative, true, latency, now); @@ -221,7 +221,7 @@ impl Transcriber { let send_eos = state.send_eos && state.buffers.is_empty(); while let Some(buf) = state.buffers.front() { - if now - buf.get_pts() > latency { + if now - buf.pts() > latency { /* Safe unwrap, we know we have an item */ let buf = state.buffers.pop_front().unwrap(); items.push(buf); @@ -233,7 +233,7 @@ impl Transcriber { ( latency, now, - state.out_segment.get_position(), + state.out_segment.position(), send_eos, state.seqnum, ) @@ -249,31 +249,25 @@ impl Transcriber { } for mut buf in items.drain(..) { - if buf.get_pts() > last_position { - let gap_event = - gst::event::Gap::builder(last_position, buf.get_pts() - last_position) - .seqnum(seqnum) - .build(); - gst_debug!( - CAT, - "Pushing gap: {} -> {}", - last_position, - buf.get_pts() - ); + if buf.pts() > last_position { + let gap_event = gst::event::Gap::builder(last_position, buf.pts() - last_position) + .seqnum(seqnum) + .build(); + gst_debug!(CAT, "Pushing gap: {} -> {}", last_position, buf.pts()); if !self.srcpad.push_event(gap_event) { return false; } } - last_position = buf.get_pts() + buf.get_duration(); + last_position = buf.pts() + buf.duration(); { let buf = buf.get_mut().unwrap(); - buf.set_pts(buf.get_pts()); + buf.set_pts(buf.pts()); } gst_debug!( CAT, "Pushing buffer: {} -> {}", - buf.get_pts(), - buf.get_pts() + buf.get_duration() + buf.pts(), + buf.pts() + buf.duration() ); if self.srcpad.push(buf).is_err() { return false; @@ -341,15 +335,15 @@ impl Transcriber { state.discont = false; } - if start_time < state.out_segment.get_position() { + if start_time < state.out_segment.position() { gst_debug!( CAT, obj: element, "Adjusting item timing({:?} < {:?})", start_time, - state.out_segment.get_position() + state.out_segment.position() ); - start_time = state.out_segment.get_position(); + start_time = state.out_segment.position(); if end_time < start_time { end_time = start_time; } @@ -449,7 +443,7 @@ impl Transcriber { ((result.end_time as f64 * 1_000_000_000.0) as u64).into(); let mut state = self.state.lock().unwrap(); - let position = state.out_segment.get_position(); + let position = state.out_segment.position(); if end_time < position { gst_warning!(CAT, obj: element, @@ -617,7 +611,7 @@ impl Transcriber { let ret = self.sinkpad.peer_query(&mut peer_query); if ret { - let (_, min, _) = peer_query.get_result(); + let (_, min, _) = peer_query.result(); let our_latency: gst::ClockTime = self.settings.lock().unwrap().latency_ms as u64 * gst::MSECOND; q.set(true, our_latency + min, gst::CLOCK_TIME_NONE); @@ -625,12 +619,12 @@ impl Transcriber { ret } QueryView::Position(ref mut q) => { - if q.get_format() == gst::Format::Time { + if q.format() == gst::Format::Time { let state = self.state.lock().unwrap(); q.set( state .out_segment - .to_stream_time(state.out_segment.get_position()), + .to_stream_time(state.out_segment.position()), ); true } else { @@ -685,15 +679,12 @@ impl Transcriber { } } EventView::Segment(e) => { - let segment = match e.get_segment().clone().downcast::<gst::ClockTime>() { + let segment = match e.segment().clone().downcast::<gst::ClockTime>() { Err(segment) => { element_error!( element, gst::StreamError::Format, - [ - "Only Time segments supported, got {:?}", - segment.get_format(), - ] + ["Only Time segments supported, got {:?}", segment.format(),] ); return false; } @@ -703,13 +694,13 @@ impl Transcriber { let event = { let mut state = self.state.lock().unwrap(); - state.out_segment.set_time(segment.get_time()); + state.out_segment.set_time(segment.time()); state .out_segment .set_position(gst::ClockTime::from_nseconds(0)); state.in_segment = segment; - state.seqnum = e.get_seqnum(); + state.seqnum = e.seqnum(); gst::event::Segment::builder(&state.out_segment) .seqnum(state.seqnum) .build() @@ -745,8 +736,8 @@ impl Transcriber { let state = self.state.lock().unwrap(); if let Some(buffer) = &buffer { - let running_time = state.in_segment.to_running_time(buffer.get_pts()); - let now = element.get_current_running_time(); + let running_time = state.in_segment.to_running_time(buffer.pts()); + let now = element.current_running_time(); if now.is_some() && now < running_time { delay = Some(running_time - now); @@ -829,7 +820,7 @@ impl Transcriber { return Ok(()); } - let in_caps = self.sinkpad.get_current_caps().unwrap(); + let in_caps = self.sinkpad.current_caps().unwrap(); let s = in_caps.get_structure(0).unwrap(); let sample_rate: i32 = s.get("rate").unwrap().unwrap(); @@ -1079,7 +1070,7 @@ impl ObjectImpl for Transcriber { value: &glib::Value, pspec: &glib::ParamSpec, ) { - match pspec.get_name() { + match pspec.name() { "language_code" => { let mut settings = self.settings.lock().unwrap(); settings.language_code = value.get().expect("type checked upstream"); @@ -1101,7 +1092,7 @@ impl ObjectImpl for Transcriber { } fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value { - match pspec.get_name() { + match pspec.name() { "language-code" => { let settings = self.settings.lock().unwrap(); settings.language_code.to_value() diff --git a/net/rusoto/src/s3sink/imp.rs b/net/rusoto/src/s3sink/imp.rs index b738e1167..c078f12e5 100644 --- a/net/rusoto/src/s3sink/imp.rs +++ b/net/rusoto/src/s3sink/imp.rs @@ -397,7 +397,7 @@ impl ObjectImpl for S3Sink { ) { let mut settings = self.settings.lock().unwrap(); - match pspec.get_name() { + match pspec.name() { "bucket" => { settings.bucket = value.get::<String>().expect("type checked upstream"); } @@ -423,7 +423,7 @@ impl ObjectImpl for S3Sink { fn get_property(&self, _: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value { let settings = self.settings.lock().unwrap(); - match pspec.get_name() { + match pspec.name() { "key" => settings.key.to_value(), "bucket" => settings.bucket.to_value(), "region" => settings.region.name().to_value(), diff --git a/net/rusoto/src/s3src/imp.rs b/net/rusoto/src/s3src/imp.rs index ed1327849..6a4f9f96c 100644 --- a/net/rusoto/src/s3src/imp.rs +++ b/net/rusoto/src/s3src/imp.rs @@ -232,7 +232,7 @@ impl ObjectImpl for S3Src { value: &glib::Value, pspec: &glib::ParamSpec, ) { - match pspec.get_name() { + match pspec.name() { "uri" => { let _ = self.set_uri(obj, value.get().expect("type checked upstream")); } @@ -241,7 +241,7 @@ impl ObjectImpl for S3Src { } fn get_property(&self, _: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value { - match pspec.get_name() { + match pspec.name() { "uri" => { let url = match *self.url.lock().unwrap() { Some(ref url) => url.to_string(), |