From 53be8e5f58aa348f8f5ac0d228088c35ea7159c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Sun, 11 Apr 2021 21:39:50 +0200 Subject: [PATCH] fix-getters-{def,calls} pass --- examples/src/bin/appsink.rs | 14 +- examples/src/bin/appsrc.rs | 12 +- examples/src/bin/custom_events.rs | 14 +- examples/src/bin/custom_meta.rs | 16 +- examples/src/bin/debug_ringbuffer.rs | 10 +- examples/src/bin/decodebin.rs | 40 ++-- examples/src/bin/discoverer.rs | 14 +- examples/src/bin/encodebin.rs | 43 ++-- examples/src/bin/events.rs | 8 +- examples/src/bin/futures.rs | 8 +- examples/src/bin/ges.rs | 15 +- examples/src/bin/glib-futures.rs | 8 +- examples/src/bin/glupload.rs | 36 ++-- examples/src/bin/gtksink.rs | 8 +- examples/src/bin/gtkvideooverlay.rs | 14 +- examples/src/bin/iterator.rs | 2 +- examples/src/bin/launch.rs | 10 +- examples/src/bin/launch_glib_main.rs | 8 +- examples/src/bin/overlay-composition.rs | 20 +- examples/src/bin/pad_probes.rs | 8 +- examples/src/bin/pango-cairo.rs | 14 +- examples/src/bin/playbin.rs | 15 +- examples/src/bin/queries.rs | 12 +- examples/src/bin/rtpfecclient.rs | 22 +- examples/src/bin/rtpfecserver.rs | 20 +- examples/src/bin/rtsp-server-record.rs | 4 +- examples/src/bin/rtsp-server-subclass.rs | 12 +- examples/src/bin/rtsp-server.rs | 4 +- examples/src/bin/subclass.rs | 12 +- examples/src/bin/tagsetter.rs | 14 +- examples/src/bin/thumbnail.rs | 16 +- examples/src/bin/toc.rs | 40 ++-- examples/src/bin/transmux.rs | 22 +- examples/src/bin/video_converter.rs | 8 +- gstreamer-app/src/app_src.rs | 8 +- gstreamer-audio/src/audio_converter.rs | 14 +- gstreamer-audio/src/audio_decoder.rs | 4 +- gstreamer-audio/src/audio_encoder.rs | 8 +- gstreamer-audio/src/audio_info.rs | 4 +- gstreamer-audio/src/audio_meta.rs | 52 ++--- gstreamer-audio/src/audio_ring_buffer_spec.rs | 32 +-- gstreamer-audio/src/subclass/audio_decoder.rs | 68 +++--- gstreamer-audio/src/subclass/audio_encoder.rs | 64 +++--- gstreamer-audio/src/subclass/audio_sink.rs | 28 +-- gstreamer-audio/src/subclass/audio_src.rs | 28 +-- gstreamer-base/src/aggregator.rs | 8 +- gstreamer-base/src/aggregator_pad.rs | 4 +- gstreamer-base/src/base_parse.rs | 16 +- gstreamer-base/src/base_parse_frame.rs | 24 +-- gstreamer-base/src/base_sink.rs | 4 +- gstreamer-base/src/base_src.rs | 8 +- gstreamer-base/src/base_transform.rs | 8 +- gstreamer-base/src/subclass/aggregator.rs | 84 ++++---- gstreamer-base/src/subclass/aggregator_pad.rs | 8 +- gstreamer-base/src/subclass/base_parse.rs | 22 +- gstreamer-base/src/subclass/base_sink.rs | 52 ++--- gstreamer-base/src/subclass/base_src.rs | 68 +++--- gstreamer-base/src/subclass/base_transform.rs | 86 ++++---- gstreamer-base/src/subclass/push_src.rs | 12 +- gstreamer-check/src/harness.rs | 18 +- gstreamer-gl/src/context.rs | 4 +- gstreamer-gl/src/gl_context.rs | 4 +- gstreamer-gl/src/gl_sync_meta.rs | 4 +- gstreamer-net/src/net_address_meta.rs | 24 +-- gstreamer-pbutils/src/discoverer.rs | 2 +- .../src/discoverer_stream_info.rs | 8 +- .../src/discoverer_video_info.rs | 4 +- gstreamer-pbutils/src/encoding_profile.rs | 64 +++--- gstreamer-player/src/config.rs | 6 +- gstreamer-player/src/player.rs | 2 +- gstreamer-player/src/player_video_info.rs | 4 +- .../player_video_overlay_video_renderer.rs | 2 +- .../src/subclass/player_video_renderer.rs | 2 +- gstreamer-rtp/src/rtp_buffer.rs | 56 ++--- gstreamer-rtsp-server/src/rtsp_token.rs | 8 +- .../src/subclass/rtsp_client.rs | 120 +++++------ .../src/subclass/rtsp_media.rs | 68 +++--- .../src/subclass/rtsp_media_factory.rs | 35 ++-- .../src/subclass/rtsp_server.rs | 8 +- gstreamer-sdp/src/sdp_media.rs | 24 +-- gstreamer-sdp/src/sdp_message.rs | 28 +-- gstreamer-video/src/functions.rs | 4 +- gstreamer-video/src/subclass/video_decoder.rs | 72 +++---- gstreamer-video/src/subclass/video_encoder.rs | 64 +++--- gstreamer-video/src/subclass/video_sink.rs | 4 +- gstreamer-video/src/utils.rs | 4 +- gstreamer-video/src/video_buffer_pool.rs | 24 +-- gstreamer-video/src/video_codec_frame.rs | 52 ++--- gstreamer-video/src/video_codec_state.rs | 36 ++-- gstreamer-video/src/video_color_matrix.rs | 2 +- gstreamer-video/src/video_converter.rs | 48 ++--- gstreamer-video/src/video_decoder.rs | 26 +-- gstreamer-video/src/video_encoder.rs | 26 +-- gstreamer-video/src/video_frame.rs | 4 +- gstreamer-video/src/video_info.rs | 4 +- gstreamer-video/src/video_meta.rs | 198 +++++++++--------- .../src/video_overlay_composition.rs | 16 +- gstreamer-video/src/video_time_code.rs | 42 ++-- .../src/video_time_code_interval.rs | 8 +- .../src/web_rtc_session_description.rs | 4 +- gstreamer/src/allocation_params.rs | 8 +- gstreamer/src/bin.rs | 12 +- gstreamer/src/buffer.rs | 128 ++++++----- gstreamer/src/buffer_cursor.rs | 18 +- gstreamer/src/buffer_pool.rs | 14 +- gstreamer/src/buffer_serde.rs | 48 ++--- gstreamer/src/bufferlist.rs | 14 +- gstreamer/src/bufferlist_serde.rs | 12 +- gstreamer/src/bus.rs | 8 +- gstreamer/src/bus_unix.rs | 4 +- gstreamer/src/bus_windows.rs | 4 +- gstreamer/src/caps.rs | 18 +- gstreamer/src/caps_features.rs | 8 +- gstreamer/src/clock.rs | 26 +-- gstreamer/src/context.rs | 10 +- gstreamer/src/date_time.rs | 110 +++++----- gstreamer/src/date_time_serde.rs | 44 ++-- gstreamer/src/element.rs | 88 ++++---- gstreamer/src/enums.rs | 2 +- gstreamer/src/event.rs | 106 +++++----- gstreamer/src/format.rs | 18 +- gstreamer/src/functions.rs | 4 +- gstreamer/src/ghost_pad.rs | 30 +-- gstreamer/src/log.rs | 14 +- gstreamer/src/memory.rs | 54 +++-- gstreamer/src/message.rs | 134 ++++++------ gstreamer/src/meta.rs | 52 +++-- gstreamer/src/object.rs | 6 +- gstreamer/src/pad.rs | 34 +-- gstreamer/src/parse_context.rs | 2 +- gstreamer/src/pipeline.rs | 4 +- gstreamer/src/plugin.rs | 10 +- gstreamer/src/plugin_feature.rs | 6 +- gstreamer/src/promise.rs | 6 +- gstreamer/src/query.rs | 164 +++++++-------- gstreamer/src/sample.rs | 38 ++-- gstreamer/src/sample_serde.rs | 46 ++-- gstreamer/src/segment.rs | 177 ++++++++-------- gstreamer/src/segment_serde.rs | 98 ++++----- gstreamer/src/static_pad_template.rs | 2 +- gstreamer/src/stream.rs | 10 +- gstreamer/src/stream_collection.rs | 2 +- gstreamer/src/structure.rs | 10 +- gstreamer/src/structure_serde.rs | 2 +- gstreamer/src/subclass/bin.rs | 12 +- gstreamer/src/subclass/child_proxy.rs | 10 +- gstreamer/src/subclass/clock.rs | 26 +-- gstreamer/src/subclass/device.rs | 8 +- gstreamer/src/subclass/device_provider.rs | 12 +- gstreamer/src/subclass/element.rs | 50 ++--- gstreamer/src/subclass/pad.rs | 10 +- gstreamer/src/subclass/uri_handler.rs | 4 +- gstreamer/src/tags.rs | 6 +- gstreamer/src/tags_serde.rs | 14 +- gstreamer/src/toc.rs | 60 +++--- gstreamer/src/toc_serde.rs | 160 +++++++------- gstreamer/src/typefind.rs | 14 +- tutorials/src/bin/basic-tutorial-1.rs | 8 +- tutorials/src/bin/basic-tutorial-12.rs | 10 +- tutorials/src/bin/basic-tutorial-13.rs | 2 +- tutorials/src/bin/basic-tutorial-2.rs | 8 +- tutorials/src/bin/basic-tutorial-3.rs | 28 +-- tutorials/src/bin/basic-tutorial-4.rs | 16 +- tutorials/src/bin/basic-tutorial-5.rs | 28 ++- tutorials/src/bin/basic-tutorial-6.rs | 30 ++- tutorials/src/bin/basic-tutorial-7.rs | 12 +- tutorials/src/bin/basic-tutorial-8.rs | 12 +- tutorials/src/bin/basic-tutorial-9.rs | 26 +-- tutorials/src/bin/playback-tutorial-4.rs | 12 +- 169 files changed, 2215 insertions(+), 2338 deletions(-) diff --git a/examples/src/bin/appsink.rs b/examples/src/bin/appsink.rs index de0c38dd6..2f96c36bf 100644 --- a/examples/src/bin/appsink.rs +++ b/examples/src/bin/appsink.rs @@ -74,7 +74,7 @@ fn create_pipeline() -> Result { .new_sample(|appsink| { // Pull the sample in question out of the appsink's buffer. let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?; - let buffer = sample.get_buffer().ok_or_else(|| { + let buffer = sample.buffer().ok_or_else(|| { element_error!( appsink, gst::ResourceError::Failed, @@ -138,7 +138,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { pipeline.set_state(gst::State::Playing)?; let bus = pipeline - .get_bus() + .bus() .expect("Pipeline without bus. Shouldn't happen!"); for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) { @@ -150,12 +150,12 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { pipeline.set_state(gst::State::Null)?; return Err(ErrorMessage { src: msg - .get_src() - .map(|s| String::from(s.get_path_string())) + .src() + .map(|s| String::from(s.path_string())) .unwrap_or_else(|| String::from("None")), - error: err.get_error().to_string(), - debug: err.get_debug(), - source: err.get_error(), + error: err.error().to_string(), + debug: err.debug(), + source: err.error(), } .into()); } diff --git a/examples/src/bin/appsrc.rs b/examples/src/bin/appsrc.rs index 4f5877b4b..cfcf86767 100644 --- a/examples/src/bin/appsrc.rs +++ b/examples/src/bin/appsrc.rs @@ -147,7 +147,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { pipeline.set_state(gst::State::Playing)?; let bus = pipeline - .get_bus() + .bus() .expect("Pipeline without bus. Shouldn't happen!"); for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) { @@ -159,12 +159,12 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { pipeline.set_state(gst::State::Null)?; return Err(ErrorMessage { src: msg - .get_src() - .map(|s| String::from(s.get_path_string())) + .src() + .map(|s| String::from(s.path_string())) .unwrap_or_else(|| String::from("None")), - error: err.get_error().to_string(), - debug: err.get_debug(), - source: err.get_error(), + error: err.error().to_string(), + debug: err.debug(), + source: err.error(), } .into()); } diff --git a/examples/src/bin/custom_events.rs b/examples/src/bin/custom_events.rs index 6d8132b7d..3a99dd42f 100644 --- a/examples/src/bin/custom_events.rs +++ b/examples/src/bin/custom_events.rs @@ -29,8 +29,8 @@ impl ExampleCustomEvent { pub fn parse(ev: &gst::EventRef) -> Option { match ev.view() { gst::EventView::CustomDownstream(e) => { - let s = match e.get_structure() { - Some(s) if s.get_name() == Self::EVENT_NAME => s, + let s = match e.structure() { + Some(s) if s.name() == Self::EVENT_NAME => s, _ => return None, // No structure in this event, or the name didn't match }; @@ -52,7 +52,7 @@ fn example_main() { "audiotestsrc name=src ! queue max-size-time=2000000000 ! fakesink name=sink sync=true", ) .unwrap(); - let bus = pipeline.get_bus().unwrap(); + let bus = pipeline.bus().unwrap(); pipeline .set_state(gst::State::Playing) @@ -77,7 +77,7 @@ fn example_main() { sinkpad.add_probe(gst::PadProbeType::EVENT_DOWNSTREAM, move |_, probe_info| { match probe_info.data { Some(gst::PadProbeData::Event(ref ev)) - if ev.get_type() == gst::EventType::CustomDownstream => + if ev.type_() == gst::EventType::CustomDownstream => { if let Some(custom_event) = ExampleCustomEvent::parse(ev) { if let Some(pipeline) = pipeline_weak.upgrade() { @@ -150,9 +150,9 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); main_loop.quit(); } diff --git a/examples/src/bin/custom_meta.rs b/examples/src/bin/custom_meta.rs index 6f0824642..6b828f987 100644 --- a/examples/src/bin/custom_meta.rs +++ b/examples/src/bin/custom_meta.rs @@ -45,7 +45,7 @@ mod custom_meta { } // Retrieve the stored label. - pub fn get_label(&self) -> &str { + pub fn label(&self) -> &str { self.0.label.as_str() } } @@ -62,7 +62,7 @@ mod custom_meta { impl fmt::Debug for CustomMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("CustomMeta") - .field("label", &self.get_label()) + .field("label", &self.label()) .finish() } } @@ -231,7 +231,7 @@ fn example_main() { .new_sample(|appsink| { // Pull the sample in question out of the appsink's buffer. let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?; - let buffer = sample.get_buffer().ok_or_else(|| { + let buffer = sample.buffer().ok_or_else(|| { element_error!( appsink, gst::ResourceError::Failed, @@ -245,7 +245,7 @@ fn example_main() { let meta = buffer .get_meta::() .expect("No custom meta found"); - println!("Got buffer with label: {}", meta.get_label()); + println!("Got buffer with label: {}", meta.label()); Ok(gst::FlowSuccess::Ok) }) @@ -259,7 +259,7 @@ fn example_main() { let pipeline = pipeline.dynamic_cast::().unwrap(); let bus = pipeline - .get_bus() + .bus() .expect("Pipeline without bus. Shouldn't happen!"); // And run until EOS or an error happened. @@ -271,9 +271,9 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); break; } diff --git a/examples/src/bin/debug_ringbuffer.rs b/examples/src/bin/debug_ringbuffer.rs index 62bdd97ea..9ab651ee8 100644 --- a/examples/src/bin/debug_ringbuffer.rs +++ b/examples/src/bin/debug_ringbuffer.rs @@ -32,7 +32,7 @@ fn example_main() { Ok(pipeline) => pipeline, Err(err) => { if let Some(gst::ParseError::NoSuchElement) = err.kind::() { - println!("Missing element(s): {:?}", context.get_missing_elements()); + println!("Missing element(s): {:?}", context.missing_elements()); } else { println!("Failed to parse pipeline: {}", err); } @@ -40,7 +40,7 @@ fn example_main() { process::exit(-1) } }; - let bus = pipeline.get_bus().unwrap(); + let bus = pipeline.bus().unwrap(); pipeline .set_state(gst::State::Playing) @@ -56,9 +56,9 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); break; } diff --git a/examples/src/bin/decodebin.rs b/examples/src/bin/decodebin.rs index 1c0c2df38..437ecffc9 100644 --- a/examples/src/bin/decodebin.rs +++ b/examples/src/bin/decodebin.rs @@ -111,9 +111,9 @@ fn example_main() -> Result<(), Error> { // Try to detect whether the raw stream decodebin provided us with // just now is either audio or video (or none of both, e.g. subtitles). let (is_audio, is_video) = { - let media_type = src_pad.get_current_caps().and_then(|caps| { + let media_type = src_pad.current_caps().and_then(|caps| { caps.get_structure(0).map(|s| { - let name = s.get_name(); + let name = s.name(); (name.starts_with("audio/"), name.starts_with("video/")) }) }); @@ -123,7 +123,7 @@ fn example_main() -> Result<(), Error> { element_warning!( dbin, gst::CoreError::Negotiation, - ("Failed to get media type from pad {}", src_pad.get_name()) + ("Failed to get media type from pad {}", src_pad.name()) ); return; @@ -229,7 +229,7 @@ fn example_main() -> Result<(), Error> { pipeline.set_state(gst::State::Playing)?; let bus = pipeline - .get_bus() + .bus() .expect("Pipeline without bus. Shouldn't happen!"); // This code iterates over all messages that are sent across our pipeline's bus. @@ -246,13 +246,13 @@ fn example_main() -> Result<(), Error> { #[cfg(feature = "v1_10")] { - match err.get_details() { + match err.details() { // This bus-message of type error contained our custom error-details struct // that we sent in the pad-added callback above. So we unpack it and log // the detailed error information here. details contains a glib::SendValue. // The unpacked error is the converted to a Result::Err, stopping the // application's execution. - Some(details) if details.get_name() == "error-details" => details + Some(details) if details.name() == "error-details" => details .get::<&ErrorValue>("error") .unwrap() .and_then(|v| v.0.lock().unwrap().take()) @@ -260,12 +260,12 @@ fn example_main() -> Result<(), Error> { .expect("error-details message without actual error"), _ => Err(ErrorMessage { src: msg - .get_src() - .map(|s| String::from(s.get_path_string())) + .src() + .map(|s| String::from(s.path_string())) .unwrap_or_else(|| String::from("None")), - error: err.get_error().to_string(), - debug: err.get_debug(), - source: err.get_error(), + error: err.error().to_string(), + debug: err.debug(), + source: err.error(), } .into()), }?; @@ -274,12 +274,12 @@ fn example_main() -> Result<(), Error> { { return Err(ErrorMessage { src: msg - .get_src() - .map(|s| String::from(s.get_path_string())) + .src() + .map(|s| String::from(s.path_string())) .unwrap_or_else(|| String::from("None")), - error: err.get_error().to_string(), - debug: err.get_debug(), - source: err.get_error(), + error: err.error().to_string(), + debug: err.debug(), + source: err.error(), } .into()); } @@ -287,10 +287,10 @@ fn example_main() -> Result<(), Error> { MessageView::StateChanged(s) => { println!( "State changed from {:?}: {:?} -> {:?} ({:?})", - s.get_src().map(|s| s.get_path_string()), - s.get_old(), - s.get_current(), - s.get_pending() + s.src().map(|s| s.path_string()), + s.old(), + s.current(), + s.pending() ); } _ => (), diff --git a/examples/src/bin/discoverer.rs b/examples/src/bin/discoverer.rs index b26ef6b30..1eba09575 100644 --- a/examples/src/bin/discoverer.rs +++ b/examples/src/bin/discoverer.rs @@ -28,7 +28,7 @@ struct DiscovererError(#[error(not(source))] &'static str); fn print_tags(info: &DiscovererInfo) { println!("Tags:"); - let tags = info.get_tags(); + let tags = info.tags(); match tags { Some(taglist) => { println!(" {}", taglist.to_string()); // FIXME use an iterator @@ -41,10 +41,10 @@ fn print_tags(info: &DiscovererInfo) { fn print_stream_info(stream: &DiscovererStreamInfo) { println!("Stream: "); - if let Some(id) = stream.get_stream_id() { + if let Some(id) = stream.stream_id() { println!(" Stream id: {}", id); } - let caps_str = match stream.get_caps() { + let caps_str = match stream.caps() { Some(caps) => caps.to_string(), None => String::from("--"), }; @@ -53,18 +53,18 @@ fn print_stream_info(stream: &DiscovererStreamInfo) { fn print_discoverer_info(info: &DiscovererInfo) -> Result<(), Error> { let uri = info - .get_uri() + .uri() .ok_or(DiscovererError("URI should not be null"))?; println!("URI: {}", uri); - println!("Duration: {}", info.get_duration()); + println!("Duration: {}", info.duration()); print_tags(info); print_stream_info( &info - .get_stream_info() + .stream_info() .ok_or(DiscovererError("Error while obtaining stream info"))?, ); - let children = info.get_stream_list(); + let children = info.stream_list(); println!("Children streams:"); for child in children { print_stream_info(&child); diff --git a/examples/src/bin/encodebin.rs b/examples/src/bin/encodebin.rs index 6a2948095..a547af925 100644 --- a/examples/src/bin/encodebin.rs +++ b/examples/src/bin/encodebin.rs @@ -145,9 +145,9 @@ fn example_main() -> Result<(), Error> { }; let (is_audio, is_video) = { - let media_type = dbin_src_pad.get_current_caps().and_then(|caps| { + let media_type = dbin_src_pad.current_caps().and_then(|caps| { caps.get_structure(0).map(|s| { - let name = s.get_name(); + let name = s.name(); (name.starts_with("audio/"), name.starts_with("video/")) }) }); @@ -157,10 +157,7 @@ fn example_main() -> Result<(), Error> { element_warning!( dbin, gst::CoreError::Negotiation, - ( - "Failed to get media type from pad {}", - dbin_src_pad.get_name() - ) + ("Failed to get media type from pad {}", dbin_src_pad.name()) ); return; @@ -266,7 +263,7 @@ fn example_main() -> Result<(), Error> { pipeline.set_state(gst::State::Playing)?; let bus = pipeline - .get_bus() + .bus() .expect("Pipeline without bus. Shouldn't happen!"); for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) { @@ -279,8 +276,8 @@ fn example_main() -> Result<(), Error> { #[cfg(feature = "v1_10")] { - match err.get_details() { - Some(details) if details.get_name() == "error-details" => details + match err.details() { + Some(details) if details.name() == "error-details" => details .get::<&ErrorValue>("error") .unwrap() .cloned() @@ -289,12 +286,12 @@ fn example_main() -> Result<(), Error> { .expect("error-details message without actual error"), _ => Err(ErrorMessage { src: msg - .get_src() - .map(|s| String::from(s.get_path_string())) + .src() + .map(|s| String::from(s.path_string())) .unwrap_or_else(|| String::from("None")), - error: err.get_error().to_string(), - debug: err.get_debug(), - source: err.get_error(), + error: err.error().to_string(), + debug: err.debug(), + source: err.error(), } .into()), }?; @@ -303,12 +300,12 @@ fn example_main() -> Result<(), Error> { { return Err(ErrorMessage { src: msg - .get_src() - .map(|s| String::from(s.get_path_string())) + .src() + .map(|s| String::from(s.path_string())) .unwrap_or_else(|| String::from("None")), - error: err.get_error().to_string(), - debug: err.get_debug(), - source: err.get_error(), + error: err.error().to_string(), + debug: err.debug(), + source: err.error(), } .into()); } @@ -316,10 +313,10 @@ fn example_main() -> Result<(), Error> { MessageView::StateChanged(s) => { println!( "State changed from {:?}: {:?} -> {:?} ({:?})", - s.get_src().map(|s| s.get_path_string()), - s.get_old(), - s.get_current(), - s.get_pending() + s.src().map(|s| s.path_string()), + s.old(), + s.current(), + s.pending() ); } _ => (), diff --git a/examples/src/bin/events.rs b/examples/src/bin/events.rs index c38d1d79c..62514a00d 100644 --- a/examples/src/bin/events.rs +++ b/examples/src/bin/events.rs @@ -31,7 +31,7 @@ fn example_main() { // This creates a pipeline by parsing the gst-launch pipeline syntax. let pipeline = gst::parse_launch("audiotestsrc ! fakesink").unwrap(); - let bus = pipeline.get_bus().unwrap(); + let bus = pipeline.bus().unwrap(); pipeline .set_state(gst::State::Playing) @@ -101,9 +101,9 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); main_loop.quit(); } diff --git a/examples/src/bin/futures.rs b/examples/src/bin/futures.rs index a28cd3d69..930993571 100644 --- a/examples/src/bin/futures.rs +++ b/examples/src/bin/futures.rs @@ -26,9 +26,9 @@ async fn message_loop(bus: gst::Bus) { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); break; } @@ -45,7 +45,7 @@ fn example_main() { // Create a pipeline from the launch-syntax given on the cli. let pipeline = gst::parse_launch(&pipeline_str).unwrap(); - let bus = pipeline.get_bus().unwrap(); + let bus = pipeline.bus().unwrap(); pipeline .set_state(gst::State::Playing) diff --git a/examples/src/bin/ges.rs b/examples/src/bin/ges.rs index 5ccfd19bf..0e57b2533 100644 --- a/examples/src/bin/ges.rs +++ b/examples/src/bin/ges.rs @@ -73,11 +73,8 @@ fn main_loop(uri: &str) -> Result<(), glib::BoolError> { // Retrieve the asset that was automatically used behind the scenes, to // extract the clip from. - let asset = clip.get_asset().unwrap(); - let duration = asset - .downcast::() - .unwrap() - .get_duration(); + let asset = clip.asset().unwrap(); + let duration = asset.downcast::().unwrap().duration(); println!( "Clip duration: {} - playing file from {} for {}", duration, @@ -96,7 +93,7 @@ fn main_loop(uri: &str) -> Result<(), glib::BoolError> { .set_state(gst::State::Playing) .expect("Unable to set the pipeline to the `Playing` state"); - let bus = pipeline.get_bus().unwrap(); + let bus = pipeline.bus().unwrap(); for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) { use gst::MessageView; @@ -105,9 +102,9 @@ fn main_loop(uri: &str) -> Result<(), glib::BoolError> { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); break; } diff --git a/examples/src/bin/glib-futures.rs b/examples/src/bin/glib-futures.rs index 731f46171..7163598d8 100644 --- a/examples/src/bin/glib-futures.rs +++ b/examples/src/bin/glib-futures.rs @@ -20,9 +20,9 @@ async fn message_handler(loop_: glib::MainLoop, bus: gst::Bus) { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); loop_.quit(); } @@ -45,7 +45,7 @@ fn example_main() { // Create a pipeline from the launch-syntax given on the cli. let pipeline = gst::parse_launch(&pipeline_str).unwrap(); - let bus = pipeline.get_bus().unwrap(); + let bus = pipeline.bus().unwrap(); pipeline .set_state(gst::State::Playing) diff --git a/examples/src/bin/glupload.rs b/examples/src/bin/glupload.rs index 4ca881673..911ccbe45 100644 --- a/examples/src/bin/glupload.rs +++ b/examples/src/bin/glupload.rs @@ -335,7 +335,7 @@ impl App { let (pipeline, appsink, glupload) = App::create_pipeline()?; let bus = pipeline - .get_bus() + .bus() .expect("Pipeline without bus. Shouldn't happen!"); let event_loop = glutin::event_loop::EventLoop::with_user_event(); @@ -356,7 +356,7 @@ impl App { use glutin::platform::unix::WindowExtUnix; use glutin::platform::ContextTraitExt; - let api = App::map_gl_api(windowed_context.get_api()); + let api = App::map_gl_api(windowed_context.api()); let (gl_context, gl_display, platform) = match unsafe { windowed_context.raw_handle() } { @@ -365,7 +365,7 @@ impl App { let mut gl_display = None; #[cfg(feature = "gst-gl-egl")] - if let Some(display) = unsafe { windowed_context.get_egl_display() } { + if let Some(display) = unsafe { windowed_context.egl_display() } { gl_display = Some( unsafe { gst_gl_egl::GLDisplayEGL::with_egl_display(display as usize) } .unwrap() @@ -425,10 +425,10 @@ impl App { bus.set_sync_handler(move |_, msg| { match msg.view() { gst::MessageView::NeedContext(ctxt) => { - let context_type = ctxt.get_context_type(); + let context_type = ctxt.context_type(); if context_type == *gst_gl::GL_DISPLAY_CONTEXT_TYPE { if let Some(el) = - msg.get_src().map(|s| s.downcast::().unwrap()) + msg.src().map(|s| s.downcast::().unwrap()) { let context = gst::Context::new(context_type, true); context.set_gl_display(&gl_display); @@ -437,12 +437,12 @@ impl App { } if context_type == "gst.gl.app_context" { if let Some(el) = - msg.get_src().map(|s| s.downcast::().unwrap()) + msg.src().map(|s| s.downcast::().unwrap()) { let mut context = gst::Context::new(context_type, true); { let context = context.get_mut().unwrap(); - let s = context.get_mut_structure(); + let s = context.structure_mut(); s.set("context", &gl_context); } el.set_context(&context); @@ -481,7 +481,7 @@ impl App { let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?; { - let _buffer = sample.get_buffer().ok_or_else(|| { + let _buffer = sample.buffer().ok_or_else(|| { element_error!( appsink, gst::ResourceError::Failed, @@ -492,7 +492,7 @@ impl App { })?; let _info = sample - .get_caps() + .caps() .and_then(|caps| gst_video::VideoInfo::from_caps(caps).ok()) .ok_or_else(|| { element_error!( @@ -567,7 +567,7 @@ impl App { let glupload = loop { match iter.next() { Ok(Some(element)) => { - if "glupload" == element.get_factory().unwrap().get_name() { + if "glupload" == element.factory().unwrap().name() { break Some(element); } } @@ -588,12 +588,12 @@ impl App { MessageView::Error(err) => { return Err(ErrorMessage { src: msg - .get_src() - .map(|s| String::from(s.get_path_string())) + .src() + .map(|s| String::from(s.path_string())) .unwrap_or_else(|| String::from("None")), - error: err.get_error().to_string(), - debug: err.get_debug(), - source: err.get_error(), + error: err.error().to_string(), + debug: err.debug(), + source: err.error(), } .into()); } @@ -610,7 +610,7 @@ fn main_loop(app: App) -> Result<(), Error> { println!( "Pixel format of the window's GL context {:?}", - app.windowed_context.get_pixel_format() + app.windowed_context.pixel_format() ); let gl = load(&app.windowed_context); @@ -657,9 +657,9 @@ fn main_loop(app: App) -> Result<(), Error> { glutin::event::Event::RedrawRequested(_) => needs_redraw = true, // Receive a frame glutin::event::Event::UserEvent(Message::Sample(sample)) => { - let buffer = sample.get_buffer_owned().unwrap(); + let buffer = sample.buffer_owned().unwrap(); let info = sample - .get_caps() + .caps() .and_then(|caps| gst_video::VideoInfo::from_caps(caps).ok()) .unwrap(); diff --git a/examples/src/bin/gtksink.rs b/examples/src/bin/gtksink.rs index 88b3ca7a0..fab01383a 100644 --- a/examples/src/bin/gtksink.rs +++ b/examples/src/bin/gtksink.rs @@ -98,7 +98,7 @@ fn create_ui(app: >k::Application) { glib::Continue(true) }); - let bus = pipeline.get_bus().unwrap(); + let bus = pipeline.bus().unwrap(); pipeline .set_state(gst::State::Playing) @@ -118,9 +118,9 @@ fn create_ui(app: >k::Application) { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); app.quit(); } diff --git a/examples/src/bin/gtkvideooverlay.rs b/examples/src/bin/gtkvideooverlay.rs index 109cfeb00..340a6c8c2 100644 --- a/examples/src/bin/gtkvideooverlay.rs +++ b/examples/src/bin/gtkvideooverlay.rs @@ -40,7 +40,7 @@ fn create_video_sink() -> gst::Element { } #[cfg(all(target_os = "linux", feature = "gtkvideooverlay-x11"))] fn set_window_handle(video_overlay: &gst_video::VideoOverlay, gdk_window: &gdk::Window) { - let display_type_name = gdk_window.get_display().get_type().name(); + let display_type_name = gdk_window.display().type_().name(); // Check if we're using X11 or ... if display_type_name == "GdkX11Display" { @@ -75,7 +75,7 @@ fn create_video_sink() -> gst::Element { #[cfg(all(target_os = "macos", feature = "gtkvideooverlay-quartz"))] fn set_window_handle(video_overlay: &gst_video::VideoOverlay, gdk_window: &gdk::Window) { - let display_type_name = gdk_window.get_display().get_type().name(); + let display_type_name = gdk_window.display().type_().name(); if display_type_name == "GdkQuartzDisplay" { extern "C" { @@ -149,7 +149,7 @@ fn create_ui(app: >k::Application) { // Gtk uses gdk under the hood, to handle its drawing. Drawing regions are // called gdk windows. We request this underlying drawing region from the // widget we will overlay with our video. - let gdk_window = video_window.get_window().unwrap(); + let gdk_window = video_window.window().unwrap(); // This is where we tell our window system about the drawing-region we // want it to overlay. Most often, the window system would only know @@ -205,7 +205,7 @@ fn create_ui(app: >k::Application) { glib::Continue(true) }); - let bus = pipeline.get_bus().unwrap(); + let bus = pipeline.bus().unwrap(); pipeline .set_state(gst::State::Playing) @@ -225,9 +225,9 @@ fn create_ui(app: >k::Application) { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); app.quit(); } diff --git a/examples/src/bin/iterator.rs b/examples/src/bin/iterator.rs index db6bc3fac..b8703b04d 100644 --- a/examples/src/bin/iterator.rs +++ b/examples/src/bin/iterator.rs @@ -20,7 +20,7 @@ fn example_main() { // In an endless-loop, we use the iterator until we either reach the end // or we hit an error. match iter.next() { - Ok(Some(pad)) => println!("Pad: {}", pad.get_name()), + Ok(Some(pad)) => println!("Pad: {}", pad.name()), Ok(None) => { // We reached the end of the iterator, there are no more pads println!("Done"); diff --git a/examples/src/bin/launch.rs b/examples/src/bin/launch.rs index 94f1e95e3..86fecfb9f 100644 --- a/examples/src/bin/launch.rs +++ b/examples/src/bin/launch.rs @@ -32,7 +32,7 @@ fn example_main() { Ok(pipeline) => pipeline, Err(err) => { if let Some(gst::ParseError::NoSuchElement) = err.kind::() { - println!("Missing element(s): {:?}", context.get_missing_elements()); + println!("Missing element(s): {:?}", context.missing_elements()); } else { println!("Failed to parse pipeline: {}", err); } @@ -40,7 +40,7 @@ fn example_main() { process::exit(-1) } }; - let bus = pipeline.get_bus().unwrap(); + let bus = pipeline.bus().unwrap(); pipeline .set_state(gst::State::Playing) @@ -54,9 +54,9 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); break; } diff --git a/examples/src/bin/launch_glib_main.rs b/examples/src/bin/launch_glib_main.rs index 125ac7b0f..c959337d4 100644 --- a/examples/src/bin/launch_glib_main.rs +++ b/examples/src/bin/launch_glib_main.rs @@ -25,7 +25,7 @@ fn example_main() { // Let GStreamer create a pipeline from the parsed launch syntax on the cli. let pipeline = gst::parse_launch(&pipeline_str).unwrap(); - let bus = pipeline.get_bus().unwrap(); + let bus = pipeline.bus().unwrap(); pipeline .set_state(gst::State::Playing) @@ -44,9 +44,9 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); main_loop.quit(); } diff --git a/examples/src/bin/overlay-composition.rs b/examples/src/bin/overlay-composition.rs index b5568d152..c48ee753f 100644 --- a/examples/src/bin/overlay-composition.rs +++ b/examples/src/bin/overlay-composition.rs @@ -141,8 +141,8 @@ fn create_pipeline() -> Result { // Get the signal's arguments let _overlay = args[0].get::().unwrap().unwrap(); let sample = args[1].get::().unwrap().unwrap(); - let buffer = sample.get_buffer().unwrap(); - let timestamp = buffer.get_pts(); + let buffer = sample.buffer().unwrap(); + let timestamp = buffer.pts(); let info = drawer.info.as_ref().unwrap(); let layout = drawer.layout.borrow(); @@ -171,7 +171,7 @@ fn create_pipeline() -> Result { let buffer = buffer.into_mapped_buffer_writable().unwrap(); let buffer = { - let buffer_ptr = unsafe { buffer.get_buffer().as_ptr() }; + let buffer_ptr = unsafe { buffer.buffer().as_ptr() }; let surface = cairo::ImageSurface::create_for_data( buffer, cairo::Format::ARgb32, @@ -218,7 +218,7 @@ fn create_pipeline() -> Result { // So e.g. that after a 90 degree rotation it knows that what was previously going // to end up as a 200x100 rectangle would now be 100x200. pangocairo::functions::update_layout(&cr, &**layout); - let (width, _height) = layout.get_size(); + let (width, _height) = layout.size(); // Using width and height of the text, we can properly possition it within // our canvas. cr.move_to( @@ -293,7 +293,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { pipeline.set_state(gst::State::Playing)?; let bus = pipeline - .get_bus() + .bus() .expect("Pipeline without bus. Shouldn't happen!"); for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) { @@ -305,12 +305,12 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { pipeline.set_state(gst::State::Null)?; return Err(ErrorMessage { src: msg - .get_src() - .map(|s| String::from(s.get_path_string())) + .src() + .map(|s| String::from(s.path_string())) .unwrap_or_else(|| String::from("None")), - error: err.get_error().to_string(), - debug: err.get_debug(), - source: err.get_error(), + error: err.error().to_string(), + debug: err.debug(), + source: err.error(), } .into()); } diff --git a/examples/src/bin/pad_probes.rs b/examples/src/bin/pad_probes.rs index 96a2c1569..361e93e69 100644 --- a/examples/src/bin/pad_probes.rs +++ b/examples/src/bin/pad_probes.rs @@ -76,7 +76,7 @@ fn example_main() { .set_state(gst::State::Playing) .expect("Unable to set the pipeline to the `Playing` state"); - let bus = pipeline.get_bus().unwrap(); + let bus = pipeline.bus().unwrap(); for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) { use gst::MessageView; @@ -85,9 +85,9 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); break; } diff --git a/examples/src/bin/pango-cairo.rs b/examples/src/bin/pango-cairo.rs index f1c9aa47f..645097584 100644 --- a/examples/src/bin/pango-cairo.rs +++ b/examples/src/bin/pango-cairo.rs @@ -178,7 +178,7 @@ fn create_pipeline() -> Result { // So e.g. that after a 90 degree rotation it knows that what was previously going // to end up as a 200x100 rectangle would now be 100x200. pangocairo::functions::update_layout(&cr, &**layout); - let (width, _height) = layout.get_size(); + let (width, _height) = layout.size(); // Using width and height of the text, we can properly possition it within // our canvas. cr.move_to( @@ -224,7 +224,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { pipeline.set_state(gst::State::Playing)?; let bus = pipeline - .get_bus() + .bus() .expect("Pipeline without bus. Shouldn't happen!"); for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) { @@ -236,12 +236,12 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { pipeline.set_state(gst::State::Null)?; return Err(ErrorMessage { src: msg - .get_src() - .map(|s| String::from(s.get_path_string())) + .src() + .map(|s| String::from(s.path_string())) .unwrap_or_else(|| String::from("None")), - error: err.get_error().to_string(), - debug: err.get_debug(), - source: err.get_error(), + error: err.error().to_string(), + debug: err.debug(), + source: err.error(), } .into()); } diff --git a/examples/src/bin/playbin.rs b/examples/src/bin/playbin.rs index 196ed1fb3..e2756b3cc 100644 --- a/examples/src/bin/playbin.rs +++ b/examples/src/bin/playbin.rs @@ -101,7 +101,7 @@ fn example_main() { // The playbin element itself is a playbin, so it can be used as one, despite being // created from an element factory. - let bus = playbin.get_bus().unwrap(); + let bus = playbin.bus().unwrap(); playbin .set_state(gst::State::Playing) @@ -115,20 +115,17 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); break; } MessageView::StateChanged(state_changed) => // We are only interested in state-changed messages from playbin { - if state_changed - .get_src() - .map(|s| s == playbin) - .unwrap_or(false) - && state_changed.get_current() == gst::State::Playing + if state_changed.src().map(|s| s == playbin).unwrap_or(false) + && state_changed.current() == gst::State::Playing { // Generate a dot graph of the pipeline to GST_DEBUG_DUMP_DOT_DIR if defined let bin_ref = playbin.downcast_ref::().unwrap(); diff --git a/examples/src/bin/queries.rs b/examples/src/bin/queries.rs index 6a419dac6..c340248f2 100644 --- a/examples/src/bin/queries.rs +++ b/examples/src/bin/queries.rs @@ -30,7 +30,7 @@ fn example_main() { // Let GStreamer create a pipeline from the parsed launch syntax on the cli. let pipeline = gst::parse_launch(&pipeline_str).unwrap(); - let bus = pipeline.get_bus().unwrap(); + let bus = pipeline.bus().unwrap(); pipeline .set_state(gst::State::Playing) @@ -64,7 +64,7 @@ fn example_main() { // capable of answering the query. let mut q = gst::query::Position::new(gst::Format::Time); if pipeline.query(&mut q) { - Some(q.get_result()) + Some(q.result()) } else { None } @@ -78,7 +78,7 @@ fn example_main() { // capable of answering the query. let mut q = gst::query::Duration::new(gst::Format::Time); if pipeline.query(&mut q) { - Some(q.get_result()) + Some(q.result()) } else { None } @@ -104,9 +104,9 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); main_loop.quit(); } diff --git a/examples/src/bin/rtpfecclient.rs b/examples/src/bin/rtpfecclient.rs index 8312beb4e..aa8426f41 100644 --- a/examples/src/bin/rtpfecclient.rs +++ b/examples/src/bin/rtpfecclient.rs @@ -48,7 +48,7 @@ fn get_static_pad(element: &gst::Element, pad_name: &'static str) -> Result Ok(pad), None => { - let element_name = element.get_name(); + let element_name = element.name(); Err(Error::from(NoSuchPad(pad_name, element_name.to_string()))) } } @@ -58,14 +58,14 @@ fn get_request_pad(element: &gst::Element, pad_name: &'static str) -> Result Ok(pad), None => { - let element_name = element.get_name(); + let element_name = element.name(); Err(Error::from(NoSuchPad(pad_name, element_name.to_string()))) } } } fn connect_rtpbin_srcpad(src_pad: &gst::Pad, sink: &gst::Element) -> Result<(), Error> { - let name = src_pad.get_name(); + let name = src_pad.name(); let split_name = name.split('_'); let split_name = split_name.collect::>(); let pt = split_name[5].parse::()?; @@ -242,7 +242,7 @@ fn example_main() -> Result<(), Error> { filter.set_property("caps", &video_caps)?; let bus = pipeline - .get_bus() + .bus() .expect("Pipeline without bus. Shouldn't happen!"); pipeline @@ -261,18 +261,18 @@ fn example_main() -> Result<(), Error> { return Err(ErrorMessage { src: msg - .get_src() - .map(|s| String::from(s.get_path_string())) + .src() + .map(|s| String::from(s.path_string())) .unwrap_or_else(|| String::from("None")), - error: err.get_error().to_string(), - debug: err.get_debug(), - source: err.get_error(), + error: err.error().to_string(), + debug: err.debug(), + source: err.error(), } .into()); } MessageView::StateChanged(s) => { - if let Some(element) = msg.get_src() { - if element == pipeline && s.get_current() == gst::State::Playing { + if let Some(element) = msg.src() { + if element == pipeline && s.current() == gst::State::Playing { eprintln!("PLAYING"); gst::debug_bin_to_dot_file( &pipeline, diff --git a/examples/src/bin/rtpfecserver.rs b/examples/src/bin/rtpfecserver.rs index e72eed3c6..e3f0cd1a8 100644 --- a/examples/src/bin/rtpfecserver.rs +++ b/examples/src/bin/rtpfecserver.rs @@ -44,7 +44,7 @@ fn get_static_pad(element: &gst::Element, pad_name: &'static str) -> Result Ok(pad), None => { - let element_name = element.get_name(); + let element_name = element.name(); Err(Error::from(NoSuchPad(pad_name, element_name.to_string()))) } } @@ -54,7 +54,7 @@ fn get_request_pad(element: &gst::Element, pad_name: &'static str) -> Result Ok(pad), None => { - let element_name = element.get_name(); + let element_name = element.name(); Err(Error::from(NoSuchPad(pad_name, element_name.to_string()))) } } @@ -163,7 +163,7 @@ fn example_main() -> Result<(), Error> { src.set_property("uri", &uri)?; let bus = pipeline - .get_bus() + .bus() .expect("Pipeline without bus. Shouldn't happen!"); pipeline @@ -182,18 +182,18 @@ fn example_main() -> Result<(), Error> { return Err(ErrorMessage { src: msg - .get_src() - .map(|s| String::from(s.get_path_string())) + .src() + .map(|s| String::from(s.path_string())) .unwrap_or_else(|| String::from("None")), - error: err.get_error().to_string(), - debug: err.get_debug(), - source: err.get_error(), + error: err.error().to_string(), + debug: err.debug(), + source: err.error(), } .into()); } MessageView::StateChanged(s) => { - if let Some(element) = msg.get_src() { - if element == pipeline && s.get_current() == gst::State::Playing { + if let Some(element) = msg.src() { + if element == pipeline && s.current() == gst::State::Playing { eprintln!("PLAYING"); gst::debug_bin_to_dot_file( &pipeline, diff --git a/examples/src/bin/rtsp-server-record.rs b/examples/src/bin/rtsp-server-record.rs index e5c201801..23ba09b02 100644 --- a/examples/src/bin/rtsp-server-record.rs +++ b/examples/src/bin/rtsp-server-record.rs @@ -39,7 +39,7 @@ fn main_loop() -> Result<(), Error> { // provide or take different streams. Here, we ask our server to give // us a reference to its list of endpoints, so we can add our // test endpoint. - let mounts = server.get_mount_points().ok_or(NoMountPoints)?; + let mounts = server.mount_points().ok_or(NoMountPoints)?; // Next, we create a factory for the endpoint we want to create. // The job of the factory is to create a new pipeline for each client that // connects, or (if configured to do so) to reuse an existing pipeline. @@ -134,7 +134,7 @@ fn main_loop() -> Result<(), Error> { println!( "Stream ready at rtsps://127.0.0.1:{}/test", - server.get_bound_port() + server.bound_port() ); // Start the mainloop. From this point on, the server will start to take diff --git a/examples/src/bin/rtsp-server-subclass.rs b/examples/src/bin/rtsp-server-subclass.rs index d3df47572..32de9e95f 100644 --- a/examples/src/bin/rtsp-server-subclass.rs +++ b/examples/src/bin/rtsp-server-subclass.rs @@ -30,7 +30,7 @@ fn main_loop() -> Result<(), Error> { // provide different streams. Here, we ask our server to give // us a reference to his list of endpoints, so we can add our // test endpoint, providing the pipeline from the cli. - let mounts = server.get_mount_points().ok_or(NoMountPoints)?; + let mounts = server.mount_points().ok_or(NoMountPoints)?; // Next, we create our custom factory for the endpoint we want to create. // The job of the factory is to create a new pipeline for each client that @@ -62,7 +62,7 @@ fn main_loop() -> Result<(), Error> { println!( "Stream ready at rtsp://127.0.0.1:{}/test", - server.get_bound_port() + server.bound_port() ); // Start the mainloop. From this point on, the server will start to serve @@ -247,10 +247,10 @@ mod server { let client = super::client::Client::default(); // Duplicated from the default implementation - client.set_session_pool(server.get_session_pool().as_ref()); - client.set_mount_points(server.get_mount_points().as_ref()); - client.set_auth(server.get_auth().as_ref()); - client.set_thread_pool(server.get_thread_pool().as_ref()); + client.set_session_pool(server.session_pool().as_ref()); + client.set_mount_points(server.mount_points().as_ref()); + client.set_auth(server.auth().as_ref()); + client.set_thread_pool(server.thread_pool().as_ref()); Some(client.upcast()) } diff --git a/examples/src/bin/rtsp-server.rs b/examples/src/bin/rtsp-server.rs index 0de8aaf70..78933507e 100644 --- a/examples/src/bin/rtsp-server.rs +++ b/examples/src/bin/rtsp-server.rs @@ -34,7 +34,7 @@ fn main_loop() -> Result<(), Error> { // provide different streams. Here, we ask our server to give // us a reference to his list of endpoints, so we can add our // test endpoint, providing the pipeline from the cli. - let mounts = server.get_mount_points().ok_or(NoMountPoints)?; + let mounts = server.mount_points().ok_or(NoMountPoints)?; // Next, we create a factory for the endpoint we want to create. // The job of the factory is to create a new pipeline for each client that @@ -70,7 +70,7 @@ fn main_loop() -> Result<(), Error> { println!( "Stream ready at rtsp://127.0.0.1:{}/test", - server.get_bound_port() + server.bound_port() ); // Start the mainloop. From this point on, the server will start to serve diff --git a/examples/src/bin/subclass.rs b/examples/src/bin/subclass.rs index ad15ccdbc..7ef0fd27a 100644 --- a/examples/src/bin/subclass.rs +++ b/examples/src/bin/subclass.rs @@ -313,7 +313,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { pipeline.set_state(gst::State::Playing)?; let bus = pipeline - .get_bus() + .bus() .expect("Pipeline without bus. Shouldn't happen!"); for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) { @@ -325,12 +325,12 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> { pipeline.set_state(gst::State::Null)?; return Err(ErrorMessage { src: msg - .get_src() - .map(|s| String::from(s.get_path_string())) + .src() + .map(|s| String::from(s.path_string())) .unwrap_or_else(|| String::from("None")), - error: err.get_error().to_string(), - debug: err.get_debug(), - source: err.get_error(), + error: err.error().to_string(), + debug: err.debug(), + source: err.error(), } .into()); } diff --git a/examples/src/bin/tagsetter.rs b/examples/src/bin/tagsetter.rs index 3cededb9e..830f60e07 100644 --- a/examples/src/bin/tagsetter.rs +++ b/examples/src/bin/tagsetter.rs @@ -53,7 +53,7 @@ fn example_main() -> Result<(), Error> { Ok(pipeline) => pipeline, Err(err) => { if let Some(gst::ParseError::NoSuchElement) = err.kind::() { - return Err(MissingElement(context.get_missing_elements().join(",")).into()); + return Err(MissingElement(context.missing_elements().join(",")).into()); } else { return Err(err.into()); } @@ -81,7 +81,7 @@ fn example_main() -> Result<(), Error> { // if there already is one. tagsetter.add::(&"Special randomized white-noise", gst::TagMergeMode::Append); - let bus = pipeline.get_bus().unwrap(); + let bus = pipeline.bus().unwrap(); pipeline.set_state(gst::State::Playing)?; @@ -93,13 +93,13 @@ fn example_main() -> Result<(), Error> { MessageView::Error(err) => { return Err(ErrorMessage { src: err - .get_src() - .map(|s| s.get_path_string()) + .src() + .map(|s| s.path_string()) .unwrap_or_else(|| "None".into()) .to_string(), - error: err.get_error().to_string(), - debug: err.get_debug(), - source: err.get_error(), + error: err.error().to_string(), + debug: err.debug(), + source: err.error(), } .into()); } diff --git a/examples/src/bin/thumbnail.rs b/examples/src/bin/thumbnail.rs index e9c0b9aa6..699c8c5a7 100644 --- a/examples/src/bin/thumbnail.rs +++ b/examples/src/bin/thumbnail.rs @@ -68,7 +68,7 @@ fn create_pipeline(uri: String, out_path: std::path::PathBuf) -> Result Result Result<(), Error> { pipeline.set_state(gst::State::Paused)?; let bus = pipeline - .get_bus() + .bus() .expect("Pipeline without bus. Shouldn't happen!"); let mut seeked = false; @@ -194,12 +194,12 @@ fn main_loop(pipeline: gst::Pipeline, position: u64) -> Result<(), Error> { pipeline.set_state(gst::State::Null)?; return Err(ErrorMessage { src: msg - .get_src() - .map(|s| String::from(s.get_path_string())) + .src() + .map(|s| String::from(s.path_string())) .unwrap_or_else(|| String::from("None")), - error: err.get_error().to_string(), - debug: err.get_debug(), - source: err.get_error(), + error: err.error().to_string(), + debug: err.debug(), + source: err.error(), } .into()); } diff --git a/examples/src/bin/toc.rs b/examples/src/bin/toc.rs index f7f39ddc4..bdb8916e1 100644 --- a/examples/src/bin/toc.rs +++ b/examples/src/bin/toc.rs @@ -80,7 +80,7 @@ fn example_main() { .set_state(gst::State::Paused) .expect("Unable to set the pipeline to the `Paused` state"); - let bus = pipeline.get_bus().unwrap(); + let bus = pipeline.bus().unwrap(); // Instead of using a main loop (like GLib's), we manually iterate over // GStreamer's bus messages in this example. We don't need any special @@ -95,23 +95,19 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); break; } MessageView::Toc(msg_toc) => { // Some element found a ToC in the current media stream and told // us by posting a message to GStreamer's bus. - let (toc, updated) = msg_toc.get_toc(); - println!( - "\nReceived toc: {:?} - updated: {}", - toc.get_scope(), - updated - ); + let (toc, updated) = msg_toc.toc(); + println!("\nReceived toc: {:?} - updated: {}", toc.scope(), updated); // Get a list of tags that are ToC specific. - if let Some(tags) = toc.get_tags() { + if let Some(tags) = toc.tags() { println!("- tags: {}", tags.to_string()); } // ToCs do not have a fixed structure. Depending on the format that @@ -121,34 +117,30 @@ fn example_main() { // interpreting the ToC manually. // In this example, we simply want to print the ToC structure, so // we iterate everything and don't try to interpret anything. - for toc_entry in toc.get_entries() { + for toc_entry in toc.entries() { // Every entry in a ToC has its own type. One type could for // example be Chapter. - println!( - "\t{:?} - {}", - toc_entry.get_entry_type(), - toc_entry.get_uid() - ); + println!("\t{:?} - {}", toc_entry.entry_type(), toc_entry.uid()); // Every ToC entry can have a set of timestamps (start, stop). - if let Some((start, stop)) = toc_entry.get_start_stop_times() { + if let Some((start, stop)) = toc_entry.start_stop_times() { println!("\t- start: {}, stop: {}", start, stop); } // Every ToC entry can have tags to it. - if let Some(tags) = toc_entry.get_tags() { + if let Some(tags) = toc_entry.tags() { println!("\t- tags: {}", tags.to_string()); } // Every ToC entry can have a set of child entries. // With this structure, you can create trees of arbitrary depth. - for toc_sub_entry in toc_entry.get_sub_entries() { + for toc_sub_entry in toc_entry.sub_entries() { println!( "\n\t\t{:?} - {}", - toc_sub_entry.get_entry_type(), - toc_sub_entry.get_uid() + toc_sub_entry.entry_type(), + toc_sub_entry.uid() ); - if let Some((start, stop)) = toc_sub_entry.get_start_stop_times() { + if let Some((start, stop)) = toc_sub_entry.start_stop_times() { println!("\t\t- start: {}, stop: {}", start, stop); } - if let Some(tags) = toc_sub_entry.get_tags() { + if let Some(tags) = toc_sub_entry.tags() { println!("\t\t- tags: {:?}", tags.to_string()); } } diff --git a/examples/src/bin/transmux.rs b/examples/src/bin/transmux.rs index efbb5f693..18f532363 100644 --- a/examples/src/bin/transmux.rs +++ b/examples/src/bin/transmux.rs @@ -105,7 +105,7 @@ fn example_main() -> Result<(), Error> { let format_name = caps .get_structure(0) .expect("Failed to get format name") - .get_name(); + .name(); let demuxer = match format_name { "video/x-matroska" | "video/webm" => { @@ -147,7 +147,7 @@ fn example_main() -> Result<(), Error> { pipeline.set_state(gst::State::Playing)?; let bus = pipeline - .get_bus() + .bus() .expect("Pipeline without bus. Shouldn't happen!"); for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) { @@ -160,22 +160,22 @@ fn example_main() -> Result<(), Error> { return Err(ErrorMessage { src: msg - .get_src() - .map(|s| String::from(s.get_path_string())) + .src() + .map(|s| String::from(s.path_string())) .unwrap_or_else(|| String::from("None")), - error: err.get_error().to_string(), - debug: err.get_debug(), - source: err.get_error(), + error: err.error().to_string(), + debug: err.debug(), + source: err.error(), } .into()); } MessageView::StateChanged(s) => { println!( "State changed from {:?}: {:?} -> {:?} ({:?})", - s.get_src().map(|s| s.get_path_string()), - s.get_old(), - s.get_current(), - s.get_pending() + s.src().map(|s| s.path_string()), + s.old(), + s.current(), + s.pending() ); } _ => (), diff --git a/examples/src/bin/video_converter.rs b/examples/src/bin/video_converter.rs index 88948c1dd..f3d2cf271 100644 --- a/examples/src/bin/video_converter.rs +++ b/examples/src/bin/video_converter.rs @@ -51,7 +51,7 @@ fn example_main() { /* Iterate messages on the bus until an error or EOS occurs, * although in this example the only error we'll hopefully * get is if the user closes the output window */ - let bus = pipeline.get_bus().unwrap(); + let bus = pipeline.bus().unwrap(); for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) { use gst::MessageView; @@ -64,9 +64,9 @@ fn example_main() { MessageView::Error(err) => { println!( "Error from {:?}: {} ({:?})", - err.get_src().map(|s| s.get_path_string()), - err.get_error(), - err.get_debug() + err.src().map(|s| s.path_string()), + err.error(), + err.debug() ); break; } diff --git a/gstreamer-app/src/app_src.rs b/gstreamer-app/src/app_src.rs index 807ad94af..28eaf84d5 100644 --- a/gstreamer-app/src/app_src.rs +++ b/gstreamer-app/src/app_src.rs @@ -286,7 +286,7 @@ impl AppSrc { } } - pub fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime) { + pub fn latency(&self) -> (gst::ClockTime, gst::ClockTime) { unsafe { let mut min = mem::MaybeUninit::uninit(); let mut max = mem::MaybeUninit::uninit(); @@ -356,8 +356,8 @@ impl Sink for AppSrcSink { None => return Poll::Ready(Err(gst::FlowError::Eos)), }; - let current_level_bytes = app_src.get_current_level_bytes(); - let max_bytes = app_src.get_max_bytes(); + let current_level_bytes = app_src.current_level_bytes(); + let max_bytes = app_src.max_bytes(); if current_level_bytes >= max_bytes && max_bytes != 0 { waker.replace(context.waker().to_owned()); @@ -417,7 +417,7 @@ mod tests { appsrc.link(&fakesink).unwrap(); - let mut bus_stream = pipeline.get_bus().unwrap().stream(); + let mut bus_stream = pipeline.bus().unwrap().stream(); let mut app_src_sink = appsrc.dynamic_cast::().unwrap().sink(); let sample_quantity = 5; diff --git a/gstreamer-audio/src/audio_converter.rs b/gstreamer-audio/src/audio_converter.rs index ec4bd8a85..e3fd409f4 100644 --- a/gstreamer-audio/src/audio_converter.rs +++ b/gstreamer-audio/src/audio_converter.rs @@ -45,7 +45,7 @@ impl convert::TryFrom for AudioConverterConfig { fn try_from(v: gst::Structure) -> Result { skip_assert_initialized!(); - if v.get_name() == "GstAudioConverter" { + if v.name() == "GstAudioConverter" { Ok(AudioConverterConfig(v)) } else { Err(glib::bool_error!("Structure is no AudioConverterConfig")) @@ -78,7 +78,7 @@ impl AudioConverterConfig { self.0.set("GstAudioConverter.dither-method", &v); } - pub fn get_dither_method(&self) -> crate::AudioDitherMethod { + pub fn dither_method(&self) -> crate::AudioDitherMethod { self.0 .get_optional("GstAudioConverter.dither-method") .expect("Wrong type") @@ -89,7 +89,7 @@ impl AudioConverterConfig { self.0.set("GstAudioConverter.noise-shaping-method", &v); } - pub fn get_noise_shaping_method(&self) -> crate::AudioNoiseShapingMethod { + pub fn noise_shaping_method(&self) -> crate::AudioNoiseShapingMethod { self.0 .get_optional("GstAudioConverter.noise-shaping-method") .expect("Wrong type") @@ -100,7 +100,7 @@ impl AudioConverterConfig { self.0.set("GstAudioConverter.quantization", &v); } - pub fn get_quantization(&self) -> u32 { + pub fn quantization(&self) -> u32 { self.0 .get_optional("GstAudioConverter.quantization") .expect("Wrong type") @@ -115,7 +115,7 @@ impl AudioConverterConfig { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] - pub fn get_resampler_method(&self) -> crate::AudioResamplerMethod { + pub fn resampler_method(&self) -> crate::AudioResamplerMethod { self.0 .get_optional("GstAudioConverter.resampler-method") .expect("Wrong type") @@ -141,7 +141,7 @@ impl AudioConverterConfig { self.0.set("GstAudioConverter.mix-matrix", &array); } - pub fn get_mix_matrix(&self) -> Vec> { + pub fn mix_matrix(&self) -> Vec> { self.0 .get_optional::("GstAudioConverter.mix-matrix") .expect("Wrong type") @@ -180,7 +180,7 @@ mod tests { let mut config = AudioConverterConfig::new(); config.set_mix_matrix(MATRIX); - let matrix = config.get_mix_matrix(); + let matrix = config.mix_matrix(); assert_eq!(matrix, MATRIX); config.set_mix_matrix(&matrix); diff --git a/gstreamer-audio/src/audio_decoder.rs b/gstreamer-audio/src/audio_decoder.rs index 79324bb9f..0d39304db 100644 --- a/gstreamer-audio/src/audio_decoder.rs +++ b/gstreamer-audio/src/audio_decoder.rs @@ -43,7 +43,7 @@ pub trait AudioDecoderExtManual: 'static { fn set_output_format(&self, info: &AudioInfo) -> Result<(), gst::FlowError>; - fn get_allocator(&self) -> (Option, gst::AllocationParams); + fn allocator(&self) -> (Option, gst::AllocationParams); #[allow(clippy::too_many_arguments)] fn error( @@ -132,7 +132,7 @@ impl> AudioDecoderExtManual for O { } } - fn get_allocator(&self) -> (Option, gst::AllocationParams) { + fn allocator(&self) -> (Option, gst::AllocationParams) { unsafe { let mut allocator = ptr::null_mut(); let mut params = mem::zeroed(); diff --git a/gstreamer-audio/src/audio_encoder.rs b/gstreamer-audio/src/audio_encoder.rs index 3a99a8373..7166446b2 100644 --- a/gstreamer-audio/src/audio_encoder.rs +++ b/gstreamer-audio/src/audio_encoder.rs @@ -17,9 +17,9 @@ pub trait AudioEncoderExtManual: 'static { fn set_output_format(&self, caps: &gst::Caps) -> Result<(), gst::FlowError>; - fn get_allocator(&self) -> (Option, gst::AllocationParams); + fn allocator(&self) -> (Option, gst::AllocationParams); - fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime); + fn latency(&self) -> (gst::ClockTime, gst::ClockTime); } impl> AudioEncoderExtManual for O { @@ -65,7 +65,7 @@ impl> AudioEncoderExtManual for O { } } - fn get_allocator(&self) -> (Option, gst::AllocationParams) { + fn allocator(&self) -> (Option, gst::AllocationParams) { unsafe { let mut allocator = ptr::null_mut(); let mut params = mem::zeroed(); @@ -78,7 +78,7 @@ impl> AudioEncoderExtManual for O { } } - fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime) { + fn latency(&self) -> (gst::ClockTime, gst::ClockTime) { unsafe { let mut min = mem::MaybeUninit::uninit(); let mut max = mem::MaybeUninit::uninit(); diff --git a/gstreamer-audio/src/audio_info.rs b/gstreamer-audio/src/audio_info.rs index cddd43735..b6914315d 100644 --- a/gstreamer-audio/src/audio_info.rs +++ b/gstreamer-audio/src/audio_info.rs @@ -181,7 +181,7 @@ impl AudioInfo { let mut dest_val = mem::MaybeUninit::uninit(); if from_glib(ffi::gst_audio_info_convert( &self.0, - src_val.get_format().to_glib(), + src_val.format().to_glib(), src_val.to_raw_value(), U::get_default_format().to_glib(), dest_val.as_mut_ptr(), @@ -205,7 +205,7 @@ impl AudioInfo { let mut dest_val = mem::MaybeUninit::uninit(); if from_glib(ffi::gst_audio_info_convert( &self.0, - src_val.get_format().to_glib(), + src_val.format().to_glib(), src_val.to_raw_value(), dest_fmt.to_glib(), dest_val.as_mut_ptr(), diff --git a/gstreamer-audio/src/audio_meta.rs b/gstreamer-audio/src/audio_meta.rs index c2a85d0a3..dc8e789ba 100644 --- a/gstreamer-audio/src/audio_meta.rs +++ b/gstreamer-audio/src/audio_meta.rs @@ -29,24 +29,24 @@ impl AudioClippingMeta { skip_assert_initialized!(); let start = start.into(); let end = end.into(); - assert_eq!(start.get_format(), end.get_format()); + assert_eq!(start.format(), end.format()); unsafe { let meta = ffi::gst_buffer_add_audio_clipping_meta( buffer.as_mut_ptr(), - start.get_format().to_glib(), - start.get_value() as u64, - end.get_value() as u64, + start.format().to_glib(), + start.value() as u64, + end.value() as u64, ); Self::from_mut_ptr(buffer, meta) } } - pub fn get_start(&self) -> gst::GenericFormattedValue { + pub fn start(&self) -> gst::GenericFormattedValue { unsafe { gst::GenericFormattedValue::new(from_glib(self.0.format), self.0.start as i64) } } - pub fn get_end(&self) -> gst::GenericFormattedValue { + pub fn end(&self) -> gst::GenericFormattedValue { unsafe { gst::GenericFormattedValue::new(from_glib(self.0.format), self.0.end as i64) } } } @@ -62,8 +62,8 @@ unsafe impl MetaAPI for AudioClippingMeta { impl fmt::Debug for AudioClippingMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("AudioClippingMeta") - .field("start", &self.get_start()) - .field("end", &self.get_end()) + .field("start", &self.start()) + .field("end", &self.end()) .finish() } } @@ -144,8 +144,8 @@ impl AudioMeta { max_offset.unwrap() }; - if max_offset + plane_size > buffer.get_size() { - return Err(glib::bool_error!("Audio channel offsets out of bounds: max offset {} with plane size {} and buffer size {}", max_offset, plane_size, buffer.get_size())); + if max_offset + plane_size > buffer.size() { + return Err(glib::bool_error!("Audio channel offsets out of bounds: max offset {} with plane size {} and buffer size {}", max_offset, plane_size, buffer.size())); } } @@ -169,15 +169,15 @@ impl AudioMeta { } } - pub fn get_info(&self) -> crate::AudioInfo { + pub fn info(&self) -> crate::AudioInfo { unsafe { from_glib_none(&self.0.info as *const _ as *mut ffi::GstAudioInfo) } } - pub fn get_samples(&self) -> usize { + pub fn samples(&self) -> usize { self.0.samples } - pub fn get_offsets(&self) -> &[usize] { + pub fn offsets(&self) -> &[usize] { if self.0.offsets.is_null() || self.0.info.channels < 1 { return &[]; } @@ -201,9 +201,9 @@ unsafe impl MetaAPI for AudioMeta { impl fmt::Debug for AudioMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("AudioMeta") - .field("info", &self.get_info()) - .field("samples", &self.get_samples()) - .field("offsets", &self.get_offsets()) + .field("info", &self.info()) + .field("samples", &self.samples()) + .field("offsets", &self.offsets()) .finish() } } @@ -226,26 +226,14 @@ mod tests { gst::format::Default(Some(1)), gst::format::Default(Some(2)), ); - assert_eq!( - cmeta.get_start().try_into(), - Ok(gst::format::Default(Some(1))) - ); - assert_eq!( - cmeta.get_end().try_into(), - Ok(gst::format::Default(Some(2))) - ); + assert_eq!(cmeta.start().try_into(), Ok(gst::format::Default(Some(1)))); + assert_eq!(cmeta.end().try_into(), Ok(gst::format::Default(Some(2)))); } { let cmeta = buffer.get_meta::().unwrap(); - assert_eq!( - cmeta.get_start().try_into(), - Ok(gst::format::Default(Some(1))) - ); - assert_eq!( - cmeta.get_end().try_into(), - Ok(gst::format::Default(Some(2))) - ); + assert_eq!(cmeta.start().try_into(), Ok(gst::format::Default(Some(1)))); + assert_eq!(cmeta.end().try_into(), Ok(gst::format::Default(Some(2)))); } } } diff --git a/gstreamer-audio/src/audio_ring_buffer_spec.rs b/gstreamer-audio/src/audio_ring_buffer_spec.rs index 66b3bf9b0..1d746f4c7 100644 --- a/gstreamer-audio/src/audio_ring_buffer_spec.rs +++ b/gstreamer-audio/src/audio_ring_buffer_spec.rs @@ -13,7 +13,7 @@ use std::fmt; pub struct AudioRingBufferSpec(pub(crate) GstAudioRingBufferSpec); impl AudioRingBufferSpec { - pub fn get_type(&self) -> AudioRingBufferFormatType { + pub fn type_(&self) -> AudioRingBufferFormatType { unsafe { AudioRingBufferFormatType::from_glib(self.0.type_) } } @@ -21,15 +21,15 @@ impl AudioRingBufferSpec { self.0.type_ = value.to_glib(); } - pub fn get_caps(&self) -> Caps { + pub fn caps(&self) -> Caps { unsafe { Caps::from_glib_none(self.0.caps) } } - pub fn get_audio_info(&self) -> AudioInfo { + pub fn audio_info(&self) -> AudioInfo { unsafe { AudioInfo::from_glib_none(mut_override(&self.0.info)) } } - pub fn get_latency_time(&self) -> u64 { + pub fn latency_time(&self) -> u64 { self.0.latency_time } @@ -37,7 +37,7 @@ impl AudioRingBufferSpec { self.0.latency_time = value; } - pub fn get_buffer_time(&self) -> u64 { + pub fn buffer_time(&self) -> u64 { self.0.buffer_time } @@ -45,7 +45,7 @@ impl AudioRingBufferSpec { self.0.buffer_time = value; } - pub fn get_segsize(&self) -> i32 { + pub fn segsize(&self) -> i32 { self.0.segsize } @@ -53,7 +53,7 @@ impl AudioRingBufferSpec { self.0.segsize = value; } - pub fn get_segtotal(&self) -> i32 { + pub fn segtotal(&self) -> i32 { self.0.segtotal } @@ -61,7 +61,7 @@ impl AudioRingBufferSpec { self.0.segtotal = value; } - pub fn get_seglatency(&self) -> i32 { + pub fn seglatency(&self) -> i32 { self.0.seglatency } @@ -95,14 +95,14 @@ unsafe impl Sync for AudioRingBufferSpec {} impl fmt::Debug for AudioRingBufferSpec { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("AudioRingBufferSpec") - .field("type", &self.get_type()) - .field("caps", &self.get_caps()) - .field("audio_info", &self.get_audio_info()) - .field("latency_time", &self.get_latency_time()) - .field("buffer_time", &self.get_buffer_time()) - .field("segsize", &self.get_segsize()) - .field("segtotal", &self.get_segtotal()) - .field("seglatency", &self.get_seglatency()) + .field("type", &self.type_()) + .field("caps", &self.caps()) + .field("audio_info", &self.audio_info()) + .field("latency_time", &self.latency_time()) + .field("buffer_time", &self.buffer_time()) + .field("segsize", &self.segsize()) + .field("segtotal", &self.segtotal()) + .field("seglatency", &self.seglatency()) .finish() } } diff --git a/gstreamer-audio/src/subclass/audio_decoder.rs b/gstreamer-audio/src/subclass/audio_decoder.rs index 3e0ec0d92..e12f0b4ab 100644 --- a/gstreamer-audio/src/subclass/audio_decoder.rs +++ b/gstreamer-audio/src/subclass/audio_decoder.rs @@ -166,7 +166,7 @@ impl AudioDecoderImplExt for T { fn parent_open(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; (*parent_class) .open .map(|f| { @@ -190,7 +190,7 @@ impl AudioDecoderImplExt for T { fn parent_close(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; (*parent_class) .close .map(|f| { @@ -214,7 +214,7 @@ impl AudioDecoderImplExt for T { fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; (*parent_class) .start .map(|f| { @@ -238,7 +238,7 @@ impl AudioDecoderImplExt for T { fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; (*parent_class) .stop .map(|f| { @@ -266,7 +266,7 @@ impl AudioDecoderImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; (*parent_class) .set_format .map(|f| { @@ -290,7 +290,7 @@ impl AudioDecoderImplExt for T { ) -> Result<(u32, u32), gst::FlowError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; (*parent_class) .parse .map(|f| { @@ -325,7 +325,7 @@ impl AudioDecoderImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; (*parent_class) .handle_frame .map(|f| { @@ -348,7 +348,7 @@ impl AudioDecoderImplExt for T { ) -> Result, gst::FlowError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; if let Some(f) = (*parent_class).pre_push { let mut buffer = buffer.into_ptr(); match gst::FlowReturn::from_glib(f( @@ -369,7 +369,7 @@ impl AudioDecoderImplExt for T { fn parent_flush(&self, element: &Self::Type, hard: bool) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; (*parent_class) .flush .map(|f| { @@ -385,7 +385,7 @@ impl AudioDecoderImplExt for T { fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; (*parent_class) .negotiate .map(|f| { @@ -402,7 +402,7 @@ impl AudioDecoderImplExt for T { fn parent_get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; (*parent_class) .getcaps .map(|f| { @@ -422,7 +422,7 @@ impl AudioDecoderImplExt for T { fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; let f = (*parent_class) .sink_event .expect("Missing parent function `sink_event`"); @@ -436,7 +436,7 @@ impl AudioDecoderImplExt for T { fn parent_sink_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; let f = (*parent_class) .sink_query .expect("Missing parent function `sink_query`"); @@ -450,7 +450,7 @@ impl AudioDecoderImplExt for T { fn parent_src_event(&self, element: &Self::Type, event: gst::Event) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; let f = (*parent_class) .src_event .expect("Missing parent function `src_event`"); @@ -464,7 +464,7 @@ impl AudioDecoderImplExt for T { fn parent_src_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; let f = (*parent_class) .src_query .expect("Missing parent function `src_query`"); @@ -482,7 +482,7 @@ impl AudioDecoderImplExt for T { ) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; (*parent_class) .propose_allocation .map(|f| { @@ -509,7 +509,7 @@ impl AudioDecoderImplExt for T { ) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioDecoderClass; (*parent_class) .decide_allocation .map(|f| { @@ -562,7 +562,7 @@ unsafe extern "C" fn audio_decoder_open( ptr: *mut ffi::GstAudioDecoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -581,7 +581,7 @@ unsafe extern "C" fn audio_decoder_close( ptr: *mut ffi::GstAudioDecoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -600,7 +600,7 @@ unsafe extern "C" fn audio_decoder_start( ptr: *mut ffi::GstAudioDecoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -619,7 +619,7 @@ unsafe extern "C" fn audio_decoder_stop( ptr: *mut ffi::GstAudioDecoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -639,7 +639,7 @@ unsafe extern "C" fn audio_decoder_set_format( caps: *mut gst::ffi::GstCaps, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -661,7 +661,7 @@ unsafe extern "C" fn audio_decoder_parse( len: *mut i32, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { @@ -687,7 +687,7 @@ unsafe extern "C" fn audio_decoder_handle_frame( // FIXME: Misgenerated in gstreamer-audio-sys let buffer = buffer as *mut gst::ffi::GstBuffer; let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { @@ -705,7 +705,7 @@ unsafe extern "C" fn audio_decoder_pre_push( buffer: *mut *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { @@ -730,7 +730,7 @@ unsafe extern "C" fn audio_decoder_flush( hard: glib::ffi::gboolean, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), (), { @@ -742,7 +742,7 @@ unsafe extern "C" fn audio_decoder_negotiate( ptr: *mut ffi::GstAudioDecoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -762,7 +762,7 @@ unsafe extern "C" fn audio_decoder_getcaps( filter: *mut gst::ffi::GstCaps, ) -> *mut gst::ffi::GstCaps { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { @@ -782,7 +782,7 @@ unsafe extern "C" fn audio_decoder_sink_event( event: *mut gst::ffi::GstEvent, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -796,7 +796,7 @@ unsafe extern "C" fn audio_decoder_sink_query( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -810,7 +810,7 @@ unsafe extern "C" fn audio_decoder_src_event( event: *mut gst::ffi::GstEvent, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -824,7 +824,7 @@ unsafe extern "C" fn audio_decoder_src_query( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -838,7 +838,7 @@ unsafe extern "C" fn audio_decoder_propose_allocation( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); @@ -859,7 +859,7 @@ unsafe extern "C" fn audio_decoder_decide_allocation( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); diff --git a/gstreamer-audio/src/subclass/audio_encoder.rs b/gstreamer-audio/src/subclass/audio_encoder.rs index b82053793..87c9bafa9 100644 --- a/gstreamer-audio/src/subclass/audio_encoder.rs +++ b/gstreamer-audio/src/subclass/audio_encoder.rs @@ -152,7 +152,7 @@ impl AudioEncoderImplExt for T { fn parent_open(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; (*parent_class) .open .map(|f| { @@ -176,7 +176,7 @@ impl AudioEncoderImplExt for T { fn parent_close(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; (*parent_class) .close .map(|f| { @@ -200,7 +200,7 @@ impl AudioEncoderImplExt for T { fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; (*parent_class) .start .map(|f| { @@ -224,7 +224,7 @@ impl AudioEncoderImplExt for T { fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; (*parent_class) .stop .map(|f| { @@ -252,7 +252,7 @@ impl AudioEncoderImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; (*parent_class) .set_format .map(|f| { @@ -276,7 +276,7 @@ impl AudioEncoderImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; (*parent_class) .handle_frame .map(|f| { @@ -299,7 +299,7 @@ impl AudioEncoderImplExt for T { ) -> Result, gst::FlowError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; if let Some(f) = (*parent_class).pre_push { let mut buffer = buffer.into_ptr(); match gst::FlowReturn::from_glib(f( @@ -320,7 +320,7 @@ impl AudioEncoderImplExt for T { fn parent_flush(&self, element: &Self::Type) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; (*parent_class) .flush .map(|f| f(element.unsafe_cast_ref::().to_glib_none().0)) @@ -331,7 +331,7 @@ impl AudioEncoderImplExt for T { fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; (*parent_class) .negotiate .map(|f| { @@ -348,7 +348,7 @@ impl AudioEncoderImplExt for T { fn parent_get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; (*parent_class) .getcaps .map(|f| { @@ -368,7 +368,7 @@ impl AudioEncoderImplExt for T { fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; let f = (*parent_class) .sink_event .expect("Missing parent function `sink_event`"); @@ -382,7 +382,7 @@ impl AudioEncoderImplExt for T { fn parent_sink_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; let f = (*parent_class) .sink_query .expect("Missing parent function `sink_query`"); @@ -396,7 +396,7 @@ impl AudioEncoderImplExt for T { fn parent_src_event(&self, element: &Self::Type, event: gst::Event) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; let f = (*parent_class) .src_event .expect("Missing parent function `src_event`"); @@ -410,7 +410,7 @@ impl AudioEncoderImplExt for T { fn parent_src_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; let f = (*parent_class) .src_query .expect("Missing parent function `src_query`"); @@ -428,7 +428,7 @@ impl AudioEncoderImplExt for T { ) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; (*parent_class) .propose_allocation .map(|f| { @@ -455,7 +455,7 @@ impl AudioEncoderImplExt for T { ) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioEncoderClass; (*parent_class) .decide_allocation .map(|f| { @@ -507,7 +507,7 @@ unsafe extern "C" fn audio_encoder_open( ptr: *mut ffi::GstAudioEncoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -526,7 +526,7 @@ unsafe extern "C" fn audio_encoder_close( ptr: *mut ffi::GstAudioEncoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -545,7 +545,7 @@ unsafe extern "C" fn audio_encoder_start( ptr: *mut ffi::GstAudioEncoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -564,7 +564,7 @@ unsafe extern "C" fn audio_encoder_stop( ptr: *mut ffi::GstAudioEncoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -584,7 +584,7 @@ unsafe extern "C" fn audio_encoder_set_format( info: *mut ffi::GstAudioInfo, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -606,7 +606,7 @@ unsafe extern "C" fn audio_encoder_handle_frame( // FIXME: Misgenerated in gstreamer-audio-sys let buffer = buffer as *mut gst::ffi::GstBuffer; let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { @@ -624,7 +624,7 @@ unsafe extern "C" fn audio_encoder_pre_push( buffer: *mut *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { @@ -646,7 +646,7 @@ unsafe extern "C" fn audio_encoder_pre_push( unsafe extern "C" fn audio_encoder_flush(ptr: *mut ffi::GstAudioEncoder) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), (), { @@ -658,7 +658,7 @@ unsafe extern "C" fn audio_encoder_negotiate( ptr: *mut ffi::GstAudioEncoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -678,7 +678,7 @@ unsafe extern "C" fn audio_encoder_getcaps( filter: *mut gst::ffi::GstCaps, ) -> *mut gst::ffi::GstCaps { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { @@ -698,7 +698,7 @@ unsafe extern "C" fn audio_encoder_sink_event( event: *mut gst::ffi::GstEvent, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -712,7 +712,7 @@ unsafe extern "C" fn audio_encoder_sink_query( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -726,7 +726,7 @@ unsafe extern "C" fn audio_encoder_src_event( event: *mut gst::ffi::GstEvent, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -740,7 +740,7 @@ unsafe extern "C" fn audio_encoder_src_query( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -754,7 +754,7 @@ unsafe extern "C" fn audio_encoder_propose_allocation( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); @@ -775,7 +775,7 @@ unsafe extern "C" fn audio_encoder_decide_allocation( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); diff --git a/gstreamer-audio/src/subclass/audio_sink.rs b/gstreamer-audio/src/subclass/audio_sink.rs index ad7a7d9ac..f4c564b53 100644 --- a/gstreamer-audio/src/subclass/audio_sink.rs +++ b/gstreamer-audio/src/subclass/audio_sink.rs @@ -62,7 +62,7 @@ impl AudioSinkImplExt for T { fn parent_close(&self, sink: &Self::Type) -> Result<(), LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSinkClass; let f = match (*parent_class).close { None => return Ok(()), Some(f) => f, @@ -78,7 +78,7 @@ impl AudioSinkImplExt for T { fn parent_delay(&self, sink: &Self::Type) -> u32 { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSinkClass; let f = match (*parent_class).delay { Some(f) => f, None => return 0, @@ -90,7 +90,7 @@ impl AudioSinkImplExt for T { fn parent_open(&self, sink: &Self::Type) -> Result<(), LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSinkClass; let f = match (*parent_class).open { Some(f) => f, None => return Ok(()), @@ -110,7 +110,7 @@ impl AudioSinkImplExt for T { ) -> Result<(), LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSinkClass; let f = match (*parent_class).prepare { Some(f) => f, None => return Ok(()), @@ -129,7 +129,7 @@ impl AudioSinkImplExt for T { fn parent_unprepare(&self, sink: &Self::Type) -> Result<(), LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSinkClass; let f = match (*parent_class).unprepare { Some(f) => f, None => { @@ -150,7 +150,7 @@ impl AudioSinkImplExt for T { fn parent_write(&self, sink: &Self::Type, buffer: &[u8]) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSinkClass; let f = match (*parent_class).write { Some(f) => f, None => return Ok(-1), @@ -175,7 +175,7 @@ impl AudioSinkImplExt for T { fn parent_reset(&self, sink: &Self::Type) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSinkClass; if let Some(f) = (*parent_class).reset { f(sink.unsafe_cast_ref::().to_glib_none().0) } @@ -205,7 +205,7 @@ unsafe extern "C" fn audiosink_close( ptr: *mut ffi::GstAudioSink, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -222,7 +222,7 @@ unsafe extern "C" fn audiosink_close( unsafe extern "C" fn audiosink_delay(ptr: *mut ffi::GstAudioSink) -> u32 { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), 0, { @@ -234,7 +234,7 @@ unsafe extern "C" fn audiosink_open( ptr: *mut ffi::GstAudioSink, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -254,7 +254,7 @@ unsafe extern "C" fn audiosink_prepare( spec: *mut ffi::GstAudioRingBufferSpec, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let spec = &mut *(spec as *mut AudioRingBufferSpec); @@ -275,7 +275,7 @@ unsafe extern "C" fn audiosink_unprepare( ptr: *mut ffi::GstAudioSink, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -296,7 +296,7 @@ unsafe extern "C" fn audiosink_write( length: u32, ) -> i32 { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let data_slice = std::slice::from_raw_parts(data as *const u8, length as usize); @@ -307,7 +307,7 @@ unsafe extern "C" fn audiosink_write( unsafe extern "C" fn audiosink_reset(ptr: *mut ffi::GstAudioSink) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), (), { diff --git a/gstreamer-audio/src/subclass/audio_src.rs b/gstreamer-audio/src/subclass/audio_src.rs index 89c02a60f..4b5fc9a08 100644 --- a/gstreamer-audio/src/subclass/audio_src.rs +++ b/gstreamer-audio/src/subclass/audio_src.rs @@ -72,7 +72,7 @@ impl AudioSrcImplExt for T { fn parent_close(&self, src: &Self::Type) -> Result<(), LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSrcClass; let f = match (*parent_class).close { None => return Ok(()), Some(f) => f, @@ -88,7 +88,7 @@ impl AudioSrcImplExt for T { fn parent_delay(&self, src: &Self::Type) -> u32 { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSrcClass; let f = match (*parent_class).delay { Some(f) => f, None => return 0, @@ -100,7 +100,7 @@ impl AudioSrcImplExt for T { fn parent_open(&self, src: &Self::Type) -> Result<(), LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSrcClass; let f = match (*parent_class).open { Some(f) => f, None => return Ok(()), @@ -120,7 +120,7 @@ impl AudioSrcImplExt for T { ) -> Result<(), LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSrcClass; let f = match (*parent_class).prepare { Some(f) => f, None => return Ok(()), @@ -139,7 +139,7 @@ impl AudioSrcImplExt for T { fn parent_unprepare(&self, src: &Self::Type) -> Result<(), LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSrcClass; let f = match (*parent_class).unprepare { Some(f) => f, None => { @@ -164,7 +164,7 @@ impl AudioSrcImplExt for T { ) -> Result<(u32, gst::ClockTime), LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSrcClass; let f = match (*parent_class).read { Some(f) => f, None => return Ok((0, gst::CLOCK_TIME_NONE)), @@ -191,7 +191,7 @@ impl AudioSrcImplExt for T { fn parent_reset(&self, src: &Self::Type) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAudioSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSrcClass; if let Some(f) = (*parent_class).reset { f(src.unsafe_cast_ref::().to_glib_none().0) } @@ -221,7 +221,7 @@ unsafe extern "C" fn audiosrc_close( ptr: *mut ffi::GstAudioSrc, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -238,7 +238,7 @@ unsafe extern "C" fn audiosrc_close( unsafe extern "C" fn audiosrc_delay(ptr: *mut ffi::GstAudioSrc) -> u32 { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), 0, { @@ -250,7 +250,7 @@ unsafe extern "C" fn audiosrc_open( ptr: *mut ffi::GstAudioSrc, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -270,7 +270,7 @@ unsafe extern "C" fn audiosrc_prepare( spec: *mut ffi::GstAudioRingBufferSpec, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let spec = &mut *(spec as *mut AudioRingBufferSpec); @@ -291,7 +291,7 @@ unsafe extern "C" fn audiosrc_unprepare( ptr: *mut ffi::GstAudioSrc, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -313,7 +313,7 @@ unsafe extern "C" fn audiosrc_read( timestamp: *mut gst::ffi::GstClockTime, ) -> u32 { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let data_slice = std::slice::from_raw_parts_mut(data as *mut u8, length as usize); @@ -329,7 +329,7 @@ unsafe extern "C" fn audiosrc_read( unsafe extern "C" fn audiosrc_reset(ptr: *mut ffi::GstAudioSrc) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), (), { diff --git a/gstreamer-base/src/aggregator.rs b/gstreamer-base/src/aggregator.rs index 01af1466b..d1d5424fc 100644 --- a/gstreamer-base/src/aggregator.rs +++ b/gstreamer-base/src/aggregator.rs @@ -22,7 +22,7 @@ use std::mem::transmute; use std::ptr; pub trait AggregatorExtManual: 'static { - fn get_allocator(&self) -> (Option, gst::AllocationParams); + fn allocator(&self) -> (Option, gst::AllocationParams); fn finish_buffer(&self, buffer: gst::Buffer) -> Result; @@ -35,7 +35,7 @@ pub trait AggregatorExtManual: 'static { #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] - fn get_property_min_upstream_latency(&self) -> gst::ClockTime; + fn property_min_upstream_latency(&self) -> gst::ClockTime; #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] @@ -84,7 +84,7 @@ pub trait AggregatorExtManual: 'static { } impl> AggregatorExtManual for O { - fn get_allocator(&self) -> (Option, gst::AllocationParams) { + fn allocator(&self) -> (Option, gst::AllocationParams) { unsafe { let mut allocator = ptr::null_mut(); let mut params = mem::zeroed(); @@ -124,7 +124,7 @@ impl> AggregatorExtManual for O { #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] - fn get_property_min_upstream_latency(&self) -> gst::ClockTime { + fn property_min_upstream_latency(&self) -> gst::ClockTime { unsafe { let mut value = Value::from_type(::static_type()); glib::gobject_ffi::g_object_get_property( diff --git a/gstreamer-base/src/aggregator_pad.rs b/gstreamer-base/src/aggregator_pad.rs index 0a2f4e461..54a56785e 100644 --- a/gstreamer-base/src/aggregator_pad.rs +++ b/gstreamer-base/src/aggregator_pad.rs @@ -5,11 +5,11 @@ use glib::object::IsA; use glib::translate::*; pub trait AggregatorPadExtManual: 'static { - fn get_segment(&self) -> gst::Segment; + fn segment(&self) -> gst::Segment; } impl> AggregatorPadExtManual for O { - fn get_segment(&self) -> gst::Segment { + fn segment(&self) -> gst::Segment { unsafe { let ptr: &ffi::GstAggregatorPad = &*(self.as_ptr() as *const _); let _guard = crate::utils::MutexGuard::lock(&ptr.parent.object.lock); diff --git a/gstreamer-base/src/base_parse.rs b/gstreamer-base/src/base_parse.rs index 98c9db2eb..54ea91666 100644 --- a/gstreamer-base/src/base_parse.rs +++ b/gstreamer-base/src/base_parse.rs @@ -9,8 +9,8 @@ use std::convert::TryFrom; use std::mem; pub trait BaseParseExtManual: 'static { - fn get_sink_pad(&self) -> gst::Pad; - fn get_src_pad(&self) -> gst::Pad; + fn sink_pad(&self) -> gst::Pad; + fn src_pad(&self) -> gst::Pad; fn set_duration>(&self, duration: V, interval: u32); fn set_frame_rate(&self, fps: gst::Fraction, lead_in: u32, lead_out: u32); @@ -33,14 +33,14 @@ pub trait BaseParseExtManual: 'static { } impl> BaseParseExtManual for O { - fn get_sink_pad(&self) -> gst::Pad { + fn sink_pad(&self) -> gst::Pad { unsafe { let elt: &ffi::GstBaseParse = &*(self.as_ptr() as *const _); from_glib_none(elt.sinkpad) } } - fn get_src_pad(&self) -> gst::Pad { + fn src_pad(&self) -> gst::Pad { unsafe { let elt: &ffi::GstBaseParse = &*(self.as_ptr() as *const _); from_glib_none(elt.srcpad) @@ -52,8 +52,8 @@ impl> BaseParseExtManual for O { unsafe { ffi::gst_base_parse_set_duration( self.as_ref().to_glib_none().0, - duration.get_format().to_glib(), - duration.get_value(), + duration.format().to_glib(), + duration.value(), interval as i32, ); } @@ -81,7 +81,7 @@ impl> BaseParseExtManual for O { let mut dest_val = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_base_parse_convert_default( self.as_ref().to_glib_none().0, - src_val.get_format().to_glib(), + src_val.format().to_glib(), src_val.to_raw_value(), U::get_default_format().to_glib(), dest_val.as_mut_ptr(), @@ -104,7 +104,7 @@ impl> BaseParseExtManual for O { let mut dest_val = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_base_parse_convert_default( self.as_ref().to_glib_none().0, - src_val.get_format().to_glib(), + src_val.format().to_glib(), src_val.to_raw_value(), dest_format.to_glib(), dest_val.as_mut_ptr(), diff --git a/gstreamer-base/src/base_parse_frame.rs b/gstreamer-base/src/base_parse_frame.rs index a5e13b36f..ff05c2eba 100644 --- a/gstreamer-base/src/base_parse_frame.rs +++ b/gstreamer-base/src/base_parse_frame.rs @@ -67,11 +67,11 @@ impl<'a> fmt::Debug for BaseParseFrame<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut b = f.debug_struct("BaseParseFrame"); - b.field("buffer", &self.get_buffer()) - .field("output_buffer", &self.get_output_buffer()) - .field("flags", &self.get_flags()) - .field("offset", &self.get_offset()) - .field("overhead", &self.get_overhead()); + b.field("buffer", &self.buffer()) + .field("output_buffer", &self.output_buffer()) + .field("flags", &self.flags()) + .field("offset", &self.offset()) + .field("overhead", &self.overhead()); b.finish() } @@ -87,7 +87,7 @@ impl<'a> BaseParseFrame<'a> { BaseParseFrame(ptr::NonNull::new_unchecked(frame), PhantomData) } - pub fn get_buffer(&self) -> Option<&gst::BufferRef> { + pub fn buffer(&self) -> Option<&gst::BufferRef> { unsafe { let ptr = (*self.to_glib_none().0).buffer; if ptr.is_null() { @@ -98,7 +98,7 @@ impl<'a> BaseParseFrame<'a> { } } - pub fn get_buffer_mut(&mut self) -> Option<&mut gst::BufferRef> { + pub fn buffer_mut(&mut self) -> Option<&mut gst::BufferRef> { unsafe { let ptr = (*self.to_glib_none().0).buffer; if ptr.is_null() { @@ -114,7 +114,7 @@ impl<'a> BaseParseFrame<'a> { } } - pub fn get_output_buffer(&self) -> Option<&gst::BufferRef> { + pub fn output_buffer(&self) -> Option<&gst::BufferRef> { unsafe { let ptr = (*self.to_glib_none().0).out_buffer; if ptr.is_null() { @@ -125,7 +125,7 @@ impl<'a> BaseParseFrame<'a> { } } - pub fn get_output_buffer_mut(&mut self) -> Option<&mut gst::BufferRef> { + pub fn output_buffer_mut(&mut self) -> Option<&mut gst::BufferRef> { unsafe { let ptr = (*self.to_glib_none().0).out_buffer; if ptr.is_null() { @@ -159,7 +159,7 @@ impl<'a> BaseParseFrame<'a> { } } - pub fn get_flags(&self) -> BaseParseFrameFlags { + pub fn flags(&self) -> BaseParseFrameFlags { let flags = unsafe { (*self.to_glib_none().0).flags }; BaseParseFrameFlags::from_bits_truncate(flags) } @@ -172,11 +172,11 @@ impl<'a> BaseParseFrame<'a> { unsafe { (*self.to_glib_none().0).flags &= !flags.bits() } } - pub fn get_offset(&self) -> u64 { + pub fn offset(&self) -> u64 { unsafe { (*self.to_glib_none().0).offset } } - pub fn get_overhead(&self) -> Overhead { + pub fn overhead(&self) -> Overhead { unsafe { from_glib((*self.to_glib_none().0).overhead) } } diff --git a/gstreamer-base/src/base_sink.rs b/gstreamer-base/src/base_sink.rs index 9edbe2968..5a404b872 100644 --- a/gstreamer-base/src/base_sink.rs +++ b/gstreamer-base/src/base_sink.rs @@ -6,7 +6,7 @@ use glib::translate::*; use std::mem; pub trait BaseSinkExtManual: 'static { - fn get_segment(&self) -> gst::Segment; + fn segment(&self) -> gst::Segment; fn wait( &self, @@ -28,7 +28,7 @@ pub trait BaseSinkExtManual: 'static { } impl> BaseSinkExtManual for O { - fn get_segment(&self) -> gst::Segment { + fn segment(&self) -> gst::Segment { unsafe { let sink: &ffi::GstBaseSink = &*(self.as_ptr() as *const _); let _guard = crate::utils::MutexGuard::lock(&sink.element.object.lock); diff --git a/gstreamer-base/src/base_src.rs b/gstreamer-base/src/base_src.rs index 1a29d7bbd..15266ef34 100644 --- a/gstreamer-base/src/base_src.rs +++ b/gstreamer-base/src/base_src.rs @@ -8,9 +8,9 @@ use std::ptr; use crate::BaseSrc; pub trait BaseSrcExtManual: 'static { - fn get_allocator(&self) -> (Option, gst::AllocationParams); + fn allocator(&self) -> (Option, gst::AllocationParams); - fn get_segment(&self) -> gst::Segment; + fn segment(&self) -> gst::Segment; fn start_complete(&self, ret: Result); @@ -26,7 +26,7 @@ pub trait BaseSrcExtManual: 'static { } impl> BaseSrcExtManual for O { - fn get_allocator(&self) -> (Option, gst::AllocationParams) { + fn allocator(&self) -> (Option, gst::AllocationParams) { unsafe { let mut allocator = ptr::null_mut(); let mut params = mem::zeroed(); @@ -39,7 +39,7 @@ impl> BaseSrcExtManual for O { } } - fn get_segment(&self) -> gst::Segment { + fn segment(&self) -> gst::Segment { unsafe { let src: &ffi::GstBaseSrc = &*(self.as_ptr() as *const _); let _guard = crate::utils::MutexGuard::lock(&src.element.object.lock); diff --git a/gstreamer-base/src/base_transform.rs b/gstreamer-base/src/base_transform.rs index 7c7a8ada9..f82d27939 100644 --- a/gstreamer-base/src/base_transform.rs +++ b/gstreamer-base/src/base_transform.rs @@ -7,13 +7,13 @@ use std::mem; use std::ptr; pub trait BaseTransformExtManual: 'static { - fn get_allocator(&self) -> (Option, gst::AllocationParams); + fn allocator(&self) -> (Option, gst::AllocationParams); - fn get_segment(&self) -> gst::Segment; + fn segment(&self) -> gst::Segment; } impl> BaseTransformExtManual for O { - fn get_allocator(&self) -> (Option, gst::AllocationParams) { + fn allocator(&self) -> (Option, gst::AllocationParams) { unsafe { let mut allocator = ptr::null_mut(); let mut params = mem::zeroed(); @@ -26,7 +26,7 @@ impl> BaseTransformExtManual for O { } } - fn get_segment(&self) -> gst::Segment { + fn segment(&self) -> gst::Segment { unsafe { let trans: &ffi::GstBaseTransform = &*(self.as_ptr() as *const _); let _guard = crate::utils::MutexGuard::lock(&trans.element.object.lock); diff --git a/gstreamer-base/src/subclass/aggregator.rs b/gstreamer-base/src/subclass/aggregator.rs index 0733b128d..043fcc80a 100644 --- a/gstreamer-base/src/subclass/aggregator.rs +++ b/gstreamer-base/src/subclass/aggregator.rs @@ -285,7 +285,7 @@ impl AggregatorImplExt for T { fn parent_flush(&self, aggregator: &Self::Type) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; (*parent_class) .flush .map(|f| { @@ -307,7 +307,7 @@ impl AggregatorImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; match (*parent_class).clip { None => Some(buffer), Some(ref func) => from_glib_full(func( @@ -326,7 +326,7 @@ impl AggregatorImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; let f = (*parent_class) .finish_buffer .expect("Missing parent function `finish_buffer`"); @@ -347,7 +347,7 @@ impl AggregatorImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; let f = (*parent_class) .finish_buffer_list .expect("Missing parent function `finish_buffer_list`"); @@ -367,7 +367,7 @@ impl AggregatorImplExt for T { ) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; let f = (*parent_class) .sink_event .expect("Missing parent function `sink_event`"); @@ -389,7 +389,7 @@ impl AggregatorImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; let f = (*parent_class) .sink_event_pre_queue .expect("Missing parent function `sink_event_pre_queue`"); @@ -410,7 +410,7 @@ impl AggregatorImplExt for T { ) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; let f = (*parent_class) .sink_query .expect("Missing parent function `sink_query`"); @@ -432,7 +432,7 @@ impl AggregatorImplExt for T { ) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; let f = (*parent_class) .sink_query_pre_queue .expect("Missing parent function `sink_query`"); @@ -447,7 +447,7 @@ impl AggregatorImplExt for T { fn parent_src_event(&self, aggregator: &Self::Type, event: gst::Event) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; let f = (*parent_class) .src_event .expect("Missing parent function `src_event`"); @@ -461,7 +461,7 @@ impl AggregatorImplExt for T { fn parent_src_query(&self, aggregator: &Self::Type, query: &mut gst::QueryRef) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; let f = (*parent_class) .src_query .expect("Missing parent function `src_query`"); @@ -480,7 +480,7 @@ impl AggregatorImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; match (*parent_class).src_activate { None => Ok(()), Some(f) => gst::result_from_gboolean!( @@ -503,7 +503,7 @@ impl AggregatorImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; let f = (*parent_class) .aggregate .expect("Missing parent function `aggregate`"); @@ -518,7 +518,7 @@ impl AggregatorImplExt for T { fn parent_start(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; (*parent_class) .start .map(|f| { @@ -542,7 +542,7 @@ impl AggregatorImplExt for T { fn parent_stop(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; (*parent_class) .stop .map(|f| { @@ -566,7 +566,7 @@ impl AggregatorImplExt for T { fn parent_get_next_time(&self, aggregator: &Self::Type) -> gst::ClockTime { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; (*parent_class) .get_next_time .map(|f| { @@ -588,7 +588,7 @@ impl AggregatorImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; let f = (*parent_class) .create_new_pad .expect("Missing parent function `create_new_pad`"); @@ -608,7 +608,7 @@ impl AggregatorImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; let f = (*parent_class) .update_src_caps .expect("Missing parent function `update_src_caps`"); @@ -626,7 +626,7 @@ impl AggregatorImplExt for T { fn parent_fixate_src_caps(&self, aggregator: &Self::Type, caps: gst::Caps) -> gst::Caps { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; let f = (*parent_class) .fixate_src_caps @@ -645,7 +645,7 @@ impl AggregatorImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; (*parent_class) .negotiated_src_caps .map(|f| { @@ -667,7 +667,7 @@ impl AggregatorImplExt for T { fn parent_negotiate(&self, aggregator: &Self::Type) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; (*parent_class) .negotiate .map(|f| { @@ -689,7 +689,7 @@ impl AggregatorImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorClass; (*parent_class) .peek_next_sample .map(|f| { @@ -742,7 +742,7 @@ unsafe extern "C" fn aggregator_flush( ptr: *mut ffi::GstAggregator, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { @@ -757,7 +757,7 @@ unsafe extern "C" fn aggregator_clip( buffer: *mut gst::ffi::GstBuffer, ) -> *mut gst::ffi::GstBuffer { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let ret = gst::panic_to_error!(&wrap, &imp.panicked(), None, { @@ -776,7 +776,7 @@ unsafe extern "C" fn aggregator_finish_buffer( buffer: *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { @@ -793,7 +793,7 @@ unsafe extern "C" fn aggregator_finish_buffer_list( buffer_list: *mut gst::ffi::GstBufferList, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { @@ -809,7 +809,7 @@ unsafe extern "C" fn aggregator_sink_event( event: *mut gst::ffi::GstEvent, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(wrap, &imp.panicked(), false, { @@ -830,7 +830,7 @@ unsafe extern "C" fn aggregator_sink_event_pre_queue( event: *mut gst::ffi::GstEvent, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { @@ -850,7 +850,7 @@ unsafe extern "C" fn aggregator_sink_query( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -871,7 +871,7 @@ unsafe extern "C" fn aggregator_sink_query_pre_queue( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -889,7 +889,7 @@ unsafe extern "C" fn aggregator_src_event( event: *mut gst::ffi::GstEvent, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -903,7 +903,7 @@ unsafe extern "C" fn aggregator_src_query( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -918,7 +918,7 @@ unsafe extern "C" fn aggregator_src_activate( active: glib::ffi::gboolean, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -938,7 +938,7 @@ unsafe extern "C" fn aggregator_aggregate( timeout: glib::ffi::gboolean, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { @@ -952,7 +952,7 @@ unsafe extern "C" fn aggregator_start( ptr: *mut ffi::GstAggregator, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -971,7 +971,7 @@ unsafe extern "C" fn aggregator_stop( ptr: *mut ffi::GstAggregator, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -990,7 +990,7 @@ unsafe extern "C" fn aggregator_get_next_time( ptr: *mut ffi::GstAggregator, ) -> gst::ffi::GstClockTime { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::CLOCK_TIME_NONE, { @@ -1006,7 +1006,7 @@ unsafe extern "C" fn aggregator_create_new_pad( caps: *const gst::ffi::GstCaps, ) -> *mut ffi::GstAggregatorPad { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), None, { @@ -1030,7 +1030,7 @@ unsafe extern "C" fn aggregator_update_src_caps( res: *mut *mut gst::ffi::GstCaps, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); *res = ptr::null_mut(); @@ -1052,7 +1052,7 @@ unsafe extern "C" fn aggregator_fixate_src_caps( caps: *mut gst::ffi::GstCaps, ) -> *mut gst::ffi::GstCaps { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { @@ -1066,7 +1066,7 @@ unsafe extern "C" fn aggregator_negotiated_src_caps( caps: *mut gst::ffi::GstCaps, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -1087,7 +1087,7 @@ unsafe extern "C" fn aggregator_negotiate( ptr: *mut ffi::GstAggregator, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -1103,7 +1103,7 @@ unsafe extern "C" fn aggregator_peek_next_sample( pad: *mut ffi::GstAggregatorPad, ) -> *mut gst::ffi::GstSample { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), None, { diff --git a/gstreamer-base/src/subclass/aggregator_pad.rs b/gstreamer-base/src/subclass/aggregator_pad.rs index a0769517c..8aff9ef9a 100644 --- a/gstreamer-base/src/subclass/aggregator_pad.rs +++ b/gstreamer-base/src/subclass/aggregator_pad.rs @@ -51,7 +51,7 @@ impl AggregatorPadImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorPadClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorPadClass; (*parent_class) .flush .map(|f| { @@ -76,7 +76,7 @@ impl AggregatorPadImplExt for T { ) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorPadClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstAggregatorPadClass; (*parent_class) .skip_buffer .map(|f| { @@ -111,7 +111,7 @@ unsafe extern "C" fn aggregator_pad_flush( aggregator: *mut ffi::GstAggregator, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let res: gst::FlowReturn = imp @@ -126,7 +126,7 @@ unsafe extern "C" fn aggregator_pad_skip_buffer( buffer: *mut gst::ffi::GstBuffer, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.skip_buffer( diff --git a/gstreamer-base/src/subclass/base_parse.rs b/gstreamer-base/src/subclass/base_parse.rs index 535fd643a..b55dba082 100644 --- a/gstreamer-base/src/subclass/base_parse.rs +++ b/gstreamer-base/src/subclass/base_parse.rs @@ -77,7 +77,7 @@ impl BaseParseImplExt for T { fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseParseClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseParseClass; (*parent_class) .start .map(|f| { @@ -97,7 +97,7 @@ impl BaseParseImplExt for T { fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseParseClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseParseClass; (*parent_class) .stop .map(|f| { @@ -121,7 +121,7 @@ impl BaseParseImplExt for T { ) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseParseClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseParseClass; (*parent_class) .set_sink_caps .map(|f| { @@ -148,7 +148,7 @@ impl BaseParseImplExt for T { ) -> Result<(gst::FlowSuccess, u32), gst::FlowError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseParseClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseParseClass; let mut skipsize = 0; let res = (*parent_class).handle_frame.map(|f| { let res = gst::FlowReturn::from_glib(f( @@ -177,14 +177,14 @@ impl BaseParseImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseParseClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseParseClass; let src_val = src_val.into(); let res = (*parent_class).convert.map(|f| { let mut dest_val = mem::MaybeUninit::uninit(); let res = from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, - src_val.get_format().to_glib(), + src_val.format().to_glib(), src_val.to_raw_value(), dest_format.to_glib(), dest_val.as_mut_ptr(), @@ -223,7 +223,7 @@ unsafe extern "C" fn base_parse_start( ptr: *mut ffi::GstBaseParse, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -242,7 +242,7 @@ unsafe extern "C" fn base_parse_stop( ptr: *mut ffi::GstBaseParse, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -262,7 +262,7 @@ unsafe extern "C" fn base_parse_set_sink_caps( caps: *mut gst::ffi::GstCaps, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let caps: Borrowed = from_glib_borrow(caps); @@ -284,7 +284,7 @@ unsafe extern "C" fn base_parse_handle_frame( skipsize: *mut i32, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let wrap_frame = BaseParseFrame::new(frame, &wrap); @@ -310,7 +310,7 @@ unsafe extern "C" fn base_parse_convert( dest_value: *mut i64, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let source = gst::GenericFormattedValue::new(from_glib(source_format), source_value); diff --git a/gstreamer-base/src/subclass/base_sink.rs b/gstreamer-base/src/subclass/base_sink.rs index 8f62da818..d389411ad 100644 --- a/gstreamer-base/src/subclass/base_sink.rs +++ b/gstreamer-base/src/subclass/base_sink.rs @@ -136,7 +136,7 @@ impl BaseSinkImplExt for T { fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass; (*parent_class) .start .map(|f| { @@ -156,7 +156,7 @@ impl BaseSinkImplExt for T { fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass; (*parent_class) .stop .map(|f| { @@ -180,7 +180,7 @@ impl BaseSinkImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass; (*parent_class) .render .map(|f| { @@ -201,7 +201,7 @@ impl BaseSinkImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass; (*parent_class) .prepare .map(|f| { @@ -222,7 +222,7 @@ impl BaseSinkImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass; (*parent_class) .render_list .map(|f| { @@ -248,7 +248,7 @@ impl BaseSinkImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass; (*parent_class) .prepare_list .map(|f| { @@ -270,7 +270,7 @@ impl BaseSinkImplExt for T { fn parent_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass; (*parent_class) .query .map(|f| { @@ -286,7 +286,7 @@ impl BaseSinkImplExt for T { fn parent_event(&self, element: &Self::Type, event: gst::Event) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass; (*parent_class) .event .map(|f| { @@ -306,7 +306,7 @@ impl BaseSinkImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass; (*parent_class) .get_caps @@ -327,7 +327,7 @@ impl BaseSinkImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass; (*parent_class) .set_caps .map(|f| { @@ -347,7 +347,7 @@ impl BaseSinkImplExt for T { fn parent_fixate(&self, element: &Self::Type, caps: gst::Caps) -> gst::Caps { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass; match (*parent_class).fixate { Some(fixate) => from_glib_full(fixate( @@ -362,7 +362,7 @@ impl BaseSinkImplExt for T { fn parent_unlock(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass; (*parent_class) .unlock .map(|f| { @@ -382,7 +382,7 @@ impl BaseSinkImplExt for T { fn parent_unlock_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass; (*parent_class) .unlock_stop .map(|f| { @@ -428,7 +428,7 @@ unsafe extern "C" fn base_sink_start( ptr: *mut ffi::GstBaseSink, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -447,7 +447,7 @@ unsafe extern "C" fn base_sink_stop( ptr: *mut ffi::GstBaseSink, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -467,7 +467,7 @@ unsafe extern "C" fn base_sink_render( buffer: *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let buffer = from_glib_borrow(buffer); @@ -482,7 +482,7 @@ unsafe extern "C" fn base_sink_prepare( buffer: *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let buffer = from_glib_borrow(buffer); @@ -497,7 +497,7 @@ unsafe extern "C" fn base_sink_render_list( list: *mut gst::ffi::GstBufferList, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let list = from_glib_borrow(list); @@ -512,7 +512,7 @@ unsafe extern "C" fn base_sink_prepare_list( list: *mut gst::ffi::GstBufferList, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let list = from_glib_borrow(list); @@ -527,7 +527,7 @@ unsafe extern "C" fn base_sink_query( query_ptr: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query_ptr); @@ -542,7 +542,7 @@ unsafe extern "C" fn base_sink_event( event_ptr: *mut gst::ffi::GstEvent, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -556,7 +556,7 @@ unsafe extern "C" fn base_sink_get_caps( filter: *mut gst::ffi::GstCaps, ) -> *mut gst::ffi::GstCaps { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let filter = Option::::from_glib_borrow(filter); @@ -572,7 +572,7 @@ unsafe extern "C" fn base_sink_set_caps( caps: *mut gst::ffi::GstCaps, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let caps = from_glib_borrow(caps); @@ -593,7 +593,7 @@ unsafe extern "C" fn base_sink_fixate( caps: *mut gst::ffi::GstCaps, ) -> *mut gst::ffi::GstCaps { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let caps = from_glib_full(caps); @@ -607,7 +607,7 @@ unsafe extern "C" fn base_sink_unlock( ptr: *mut ffi::GstBaseSink, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -626,7 +626,7 @@ unsafe extern "C" fn base_sink_unlock_stop( ptr: *mut ffi::GstBaseSink, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { diff --git a/gstreamer-base/src/subclass/base_src.rs b/gstreamer-base/src/subclass/base_src.rs index 1da831bbd..4def87e5b 100644 --- a/gstreamer-base/src/subclass/base_src.rs +++ b/gstreamer-base/src/subclass/base_src.rs @@ -178,7 +178,7 @@ impl BaseSrcImplExt for T { fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .start .map(|f| { @@ -198,7 +198,7 @@ impl BaseSrcImplExt for T { fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .stop .map(|f| { @@ -218,7 +218,7 @@ impl BaseSrcImplExt for T { fn parent_is_seekable(&self, element: &Self::Type) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .is_seekable .map(|f| from_glib(f(element.unsafe_cast_ref::().to_glib_none().0))) @@ -229,7 +229,7 @@ impl BaseSrcImplExt for T { fn parent_get_size(&self, element: &Self::Type) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .get_size .map(|f| { @@ -254,7 +254,7 @@ impl BaseSrcImplExt for T { ) -> (gst::ClockTime, gst::ClockTime) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .get_times .map(|f| { @@ -284,7 +284,7 @@ impl BaseSrcImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .fill .map(|f| { @@ -308,7 +308,7 @@ impl BaseSrcImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .alloc .map(|f| { @@ -339,7 +339,7 @@ impl BaseSrcImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .create .map(|f| { @@ -417,7 +417,7 @@ impl BaseSrcImplExt for T { fn parent_do_seek(&self, element: &Self::Type, segment: &mut gst::Segment) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .do_seek .map(|f| { @@ -433,7 +433,7 @@ impl BaseSrcImplExt for T { fn parent_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .query .map(|f| { @@ -449,7 +449,7 @@ impl BaseSrcImplExt for T { fn parent_event(&self, element: &Self::Type, event: &gst::Event) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .event .map(|f| { @@ -469,7 +469,7 @@ impl BaseSrcImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .get_caps @@ -486,7 +486,7 @@ impl BaseSrcImplExt for T { fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .negotiate .map(|f| { @@ -507,7 +507,7 @@ impl BaseSrcImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .set_caps .map(|f| { @@ -527,7 +527,7 @@ impl BaseSrcImplExt for T { fn parent_fixate(&self, element: &Self::Type, caps: gst::Caps) -> gst::Caps { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; match (*parent_class).fixate { Some(fixate) => from_glib_full(fixate( @@ -542,7 +542,7 @@ impl BaseSrcImplExt for T { fn parent_unlock(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .unlock .map(|f| { @@ -562,7 +562,7 @@ impl BaseSrcImplExt for T { fn parent_unlock_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .unlock_stop .map(|f| { @@ -612,7 +612,7 @@ unsafe extern "C" fn base_src_start( ptr: *mut ffi::GstBaseSrc, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -631,7 +631,7 @@ unsafe extern "C" fn base_src_stop( ptr: *mut ffi::GstBaseSrc, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -650,7 +650,7 @@ unsafe extern "C" fn base_src_is_seekable( ptr: *mut ffi::GstBaseSrc, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -664,7 +664,7 @@ unsafe extern "C" fn base_src_get_size( size: *mut u64, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -686,7 +686,7 @@ unsafe extern "C" fn base_src_get_times( stop: *mut gst::ffi::GstClockTime, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let buffer = gst::BufferRef::from_ptr(buffer); @@ -707,7 +707,7 @@ unsafe extern "C" fn base_src_fill( buffer: *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let buffer = gst::BufferRef::from_mut_ptr(buffer); @@ -725,7 +725,7 @@ unsafe extern "C" fn base_src_alloc( buffer_ptr: *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); // FIXME: Wrong signature in -sys bindings // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 @@ -750,7 +750,7 @@ unsafe extern "C" fn base_src_create( buffer_ptr: *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); // FIXME: Wrong signature in -sys bindings // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 @@ -834,7 +834,7 @@ unsafe extern "C" fn base_src_do_seek( segment: *mut gst::ffi::GstSegment, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -852,7 +852,7 @@ unsafe extern "C" fn base_src_query( query_ptr: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query_ptr); @@ -867,7 +867,7 @@ unsafe extern "C" fn base_src_event( event_ptr: *mut gst::ffi::GstEvent, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -881,7 +881,7 @@ unsafe extern "C" fn base_src_get_caps( filter: *mut gst::ffi::GstCaps, ) -> *mut gst::ffi::GstCaps { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let filter = Option::::from_glib_borrow(filter); @@ -896,7 +896,7 @@ unsafe extern "C" fn base_src_negotiate( ptr: *mut ffi::GstBaseSrc, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -916,7 +916,7 @@ unsafe extern "C" fn base_src_set_caps( caps: *mut gst::ffi::GstCaps, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let caps = from_glib_borrow(caps); @@ -937,7 +937,7 @@ unsafe extern "C" fn base_src_fixate( caps: *mut gst::ffi::GstCaps, ) -> *mut gst::ffi::GstCaps { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let caps = from_glib_full(caps); @@ -951,7 +951,7 @@ unsafe extern "C" fn base_src_unlock( ptr: *mut ffi::GstBaseSrc, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -970,7 +970,7 @@ unsafe extern "C" fn base_src_unlock_stop( ptr: *mut ffi::GstBaseSrc, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { diff --git a/gstreamer-base/src/subclass/base_transform.rs b/gstreamer-base/src/subclass/base_transform.rs index f60a3c712..30306f12a 100644 --- a/gstreamer-base/src/subclass/base_transform.rs +++ b/gstreamer-base/src/subclass/base_transform.rs @@ -292,7 +292,7 @@ pub trait BaseTransformImplExt: ObjectSubclass { Self: ObjectSubclass, ::ParentType: IsA; - fn get_queued_buffer(&self) -> Option + fn queued_buffer(&self) -> Option where Self: ObjectSubclass, ::ParentType: IsA; @@ -302,7 +302,7 @@ impl BaseTransformImplExt for T { fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; (*parent_class) .start .map(|f| { @@ -326,7 +326,7 @@ impl BaseTransformImplExt for T { fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; (*parent_class) .stop .map(|f| { @@ -356,7 +356,7 @@ impl BaseTransformImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; (*parent_class) .transform_caps .map(|f| { @@ -380,7 +380,7 @@ impl BaseTransformImplExt for T { ) -> gst::Caps { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; match (*parent_class).fixate_caps { Some(f) => from_glib_full(f( element.unsafe_cast_ref::().to_glib_none().0, @@ -401,7 +401,7 @@ impl BaseTransformImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; (*parent_class) .set_caps .map(|f| { @@ -427,7 +427,7 @@ impl BaseTransformImplExt for T { ) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; (*parent_class) .accept_caps .map(|f| { @@ -449,7 +449,7 @@ impl BaseTransformImplExt for T { ) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; (*parent_class) .query .map(|f| { @@ -473,7 +473,7 @@ impl BaseTransformImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; (*parent_class) .transform_size .map(|f| { @@ -499,7 +499,7 @@ impl BaseTransformImplExt for T { fn parent_get_unit_size(&self, element: &Self::Type, caps: &gst::Caps) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; let f = (*parent_class).get_unit_size.unwrap_or_else(|| { if !element.unsafe_cast_ref::().is_in_place() { unimplemented!(concat!( @@ -530,7 +530,7 @@ impl BaseTransformImplExt for T { fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; (*parent_class) .sink_event .map(|f| { @@ -546,7 +546,7 @@ impl BaseTransformImplExt for T { fn parent_src_event(&self, element: &Self::Type, event: gst::Event) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; (*parent_class) .src_event .map(|f| { @@ -566,7 +566,7 @@ impl BaseTransformImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; (*parent_class) .prepare_output_buffer .map(|f| { @@ -601,7 +601,7 @@ impl BaseTransformImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; (*parent_class) .transform .map(|f| { @@ -632,7 +632,7 @@ impl BaseTransformImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; let f = (*parent_class).transform_ip.unwrap_or_else(|| { if element.unsafe_cast_ref::().is_in_place() { panic!(concat!( @@ -662,7 +662,7 @@ impl BaseTransformImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; let f = (*parent_class).transform_ip.unwrap_or_else(|| { if element.unsafe_cast_ref::().is_in_place() { panic!(concat!( @@ -695,7 +695,7 @@ impl BaseTransformImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; if let Some(ref f) = (*parent_class).copy_metadata { gst::result_from_gboolean!( f( @@ -721,7 +721,7 @@ impl BaseTransformImplExt for T { ) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; (*parent_class) .transform_meta .map(|f| { @@ -739,7 +739,7 @@ impl BaseTransformImplExt for T { fn parent_before_transform(&self, element: &Self::Type, inbuf: &gst::BufferRef) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; if let Some(ref f) = (*parent_class).before_transform { f( element.unsafe_cast_ref::().to_glib_none().0, @@ -757,7 +757,7 @@ impl BaseTransformImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; let f = (*parent_class) .submit_input_buffer .expect("Missing parent function `submit_input_buffer`"); @@ -777,7 +777,7 @@ impl BaseTransformImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; let f = (*parent_class) .generate_output .expect("Missing parent function `generate_output`"); @@ -806,7 +806,7 @@ impl BaseTransformImplExt for T { ::ParentType: IsA, { unsafe { - let element = self.get_instance(); + let element = self.instance(); let ptr: *mut ffi::GstBaseTransform = element.unsafe_cast_ref::().to_glib_none().0; let sinkpad: Borrowed = from_glib_borrow((*ptr).sinkpad); @@ -817,13 +817,13 @@ impl BaseTransformImplExt for T { } } - fn get_queued_buffer(&self) -> Option + fn queued_buffer(&self) -> Option where Self: ObjectSubclass, ::ParentType: IsA, { unsafe { - let element = self.get_instance(); + let element = self.instance(); let ptr: *mut ffi::GstBaseTransform = element.unsafe_cast_ref::().to_glib_none().0; let sinkpad: Borrowed = from_glib_borrow((*ptr).sinkpad); @@ -897,7 +897,7 @@ unsafe extern "C" fn base_transform_start( ptr: *mut ffi::GstBaseTransform, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -916,7 +916,7 @@ unsafe extern "C" fn base_transform_stop( ptr: *mut ffi::GstBaseTransform, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -938,7 +938,7 @@ unsafe extern "C" fn base_transform_transform_caps( filter: *mut gst::ffi::GstCaps, ) -> *mut gst::ffi::GstCaps { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), None, { @@ -962,7 +962,7 @@ unsafe extern "C" fn base_transform_fixate_caps( othercaps: *mut gst::ffi::GstCaps, ) -> *mut gst::ffi::GstCaps { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { @@ -982,7 +982,7 @@ unsafe extern "C" fn base_transform_set_caps( outcaps: *mut gst::ffi::GstCaps, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -1007,7 +1007,7 @@ unsafe extern "C" fn base_transform_accept_caps( caps: *mut gst::ffi::GstCaps, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -1026,7 +1026,7 @@ unsafe extern "C" fn base_transform_query( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -1049,7 +1049,7 @@ unsafe extern "C" fn base_transform_transform_size( othersize: *mut usize, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -1076,7 +1076,7 @@ unsafe extern "C" fn base_transform_get_unit_size( size: *mut usize, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -1097,7 +1097,7 @@ unsafe extern "C" fn base_transform_prepare_output_buffer( outbuf: *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); // FIXME: Wrong signature in FFI @@ -1124,7 +1124,7 @@ unsafe extern "C" fn base_transform_sink_event( event: *mut gst::ffi::GstEvent, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -1138,7 +1138,7 @@ unsafe extern "C" fn base_transform_src_event( event: *mut gst::ffi::GstEvent, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -1153,7 +1153,7 @@ unsafe extern "C" fn base_transform_transform( outbuf: *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { @@ -1172,7 +1172,7 @@ unsafe extern "C" fn base_transform_transform_ip( buf: *mut *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); // FIXME: Wrong signature in FFI @@ -1197,7 +1197,7 @@ unsafe extern "C" fn base_transform_transform_meta( inbuf: *mut gst::ffi::GstBuffer, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let inbuf = gst::BufferRef::from_ptr(inbuf); @@ -1219,7 +1219,7 @@ unsafe extern "C" fn base_transform_copy_metadata( outbuf: *mut gst::ffi::GstBuffer, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); if gst::ffi::gst_mini_object_is_writable(outbuf as *mut _) == glib::ffi::GFALSE { @@ -1253,7 +1253,7 @@ unsafe extern "C" fn base_transform_before_transform( inbuf: *mut gst::ffi::GstBuffer, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), (), { @@ -1267,7 +1267,7 @@ unsafe extern "C" fn base_transform_submit_input_buffer( buf: *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { @@ -1286,7 +1286,7 @@ unsafe extern "C" fn base_transform_generate_output( buf: *mut *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); *buf = ptr::null_mut(); diff --git a/gstreamer-base/src/subclass/push_src.rs b/gstreamer-base/src/subclass/push_src.rs index a5ed5fb7c..54570753a 100644 --- a/gstreamer-base/src/subclass/push_src.rs +++ b/gstreamer-base/src/subclass/push_src.rs @@ -47,7 +47,7 @@ impl PushSrcImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstPushSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstPushSrcClass; (*parent_class) .fill .map(|f| { @@ -64,7 +64,7 @@ impl PushSrcImplExt for T { fn parent_alloc(&self, element: &Self::Type) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstPushSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstPushSrcClass; (*parent_class) .alloc .map(|f| { @@ -87,7 +87,7 @@ impl PushSrcImplExt for T { fn parent_create(&self, element: &Self::Type) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstPushSrcClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstPushSrcClass; (*parent_class) .create .map(|f| { @@ -127,7 +127,7 @@ unsafe extern "C" fn push_src_fill( buffer: *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let buffer = gst::BufferRef::from_mut_ptr(buffer); @@ -142,7 +142,7 @@ unsafe extern "C" fn push_src_alloc( buffer_ptr: *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); // FIXME: Wrong signature in -sys bindings // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 @@ -165,7 +165,7 @@ unsafe extern "C" fn push_src_create( buffer_ptr: *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); // FIXME: Wrong signature in -sys bindings // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 diff --git a/gstreamer-check/src/harness.rs b/gstreamer-check/src/harness.rs index e7d36d1e3..7bbaa1b2d 100644 --- a/gstreamer-check/src/harness.rs +++ b/gstreamer-check/src/harness.rs @@ -221,11 +221,11 @@ impl Harness { // unsafe { TODO: call ffi::gst_harness_get_allocator() } //} - pub fn get_last_pushed_timestamp(&self) -> gst::ClockTime { + pub fn last_pushed_timestamp(&self) -> gst::ClockTime { unsafe { from_glib(ffi::gst_harness_get_last_pushed_timestamp(self.0.as_ptr())) } } - pub fn get_testclock(&self) -> Option { + pub fn testclock(&self) -> Option { unsafe { from_glib_full(ffi::gst_harness_get_testclock(self.0.as_ptr())) } } @@ -628,7 +628,7 @@ impl Harness { // unsafe { TODO: call ffi::gst_harness_stress_thread_stop() } //} - pub fn get_element(&self) -> Option { + pub fn element(&self) -> Option { unsafe { // Work around https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/31 let ptr = (*self.0.as_ptr()).element; @@ -646,7 +646,7 @@ impl Harness { } } - pub fn get_sinkpad(&self) -> Option { + pub fn sinkpad(&self) -> Option { unsafe { // Work around https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/31 let ptr = (*self.0.as_ptr()).sinkpad; @@ -664,7 +664,7 @@ impl Harness { } } - pub fn get_srcpad(&self) -> Option { + pub fn srcpad(&self) -> Option { unsafe { // Work around https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/31 let ptr = (*self.0.as_ptr()).srcpad; @@ -682,7 +682,7 @@ impl Harness { } } - pub fn get_sink_harness(&self) -> Option { + pub fn sink_harness(&self) -> Option { unsafe { let sink_harness = (*self.0.as_ptr()).sink_harness; if sink_harness.is_null() { @@ -696,7 +696,7 @@ impl Harness { } } - pub fn get_src_harness(&self) -> Option { + pub fn src_harness(&self) -> Option { unsafe { let src_harness = (*self.0.as_ptr()).src_harness; if src_harness.is_null() { @@ -710,7 +710,7 @@ impl Harness { } } - pub fn get_mut_sink_harness(&mut self) -> Option { + pub fn sink_harness_mut(&mut self) -> Option { unsafe { let sink_harness = (*self.0.as_ptr()).sink_harness; if sink_harness.is_null() { @@ -724,7 +724,7 @@ impl Harness { } } - pub fn get_mut_src_harness(&mut self) -> Option { + pub fn src_harness_mut(&mut self) -> Option { unsafe { let src_harness = (*self.0.as_ptr()).src_harness; if src_harness.is_null() { diff --git a/gstreamer-gl/src/context.rs b/gstreamer-gl/src/context.rs index 9c1450172..2278a8e8e 100644 --- a/gstreamer-gl/src/context.rs +++ b/gstreamer-gl/src/context.rs @@ -7,12 +7,12 @@ use gst::ContextRef; use std::ptr; pub trait ContextGLExt { - fn get_gl_display(&self) -> Option; + fn gl_display(&self) -> Option; fn set_gl_display>(&self, display: &T); } impl ContextGLExt for ContextRef { - fn get_gl_display(&self) -> Option { + fn gl_display(&self) -> Option { unsafe { let mut display = ptr::null_mut(); if from_glib(ffi::gst_context_get_gl_display( diff --git a/gstreamer-gl/src/gl_context.rs b/gstreamer-gl/src/gl_context.rs index 5d26a38d5..952820d95 100644 --- a/gstreamer-gl/src/gl_context.rs +++ b/gstreamer-gl/src/gl_context.rs @@ -45,13 +45,13 @@ impl GLContext { } pub trait GLContextExtManual: 'static { - fn get_gl_context(&self) -> uintptr_t; + fn gl_context(&self) -> uintptr_t; fn get_proc_address(&self, name: &str) -> uintptr_t; } impl> GLContextExtManual for O { - fn get_gl_context(&self) -> uintptr_t { + fn gl_context(&self) -> uintptr_t { unsafe { ffi::gst_gl_context_get_gl_context(self.as_ref().to_glib_none().0) as uintptr_t } } diff --git a/gstreamer-gl/src/gl_sync_meta.rs b/gstreamer-gl/src/gl_sync_meta.rs index a6298aabb..17ffbc498 100644 --- a/gstreamer-gl/src/gl_sync_meta.rs +++ b/gstreamer-gl/src/gl_sync_meta.rs @@ -28,7 +28,7 @@ impl GLSyncMeta { } } - pub fn get_context(&self) -> GLContext { + pub fn context(&self) -> GLContext { unsafe { from_glib_none(self.0.context) } } @@ -71,7 +71,7 @@ unsafe impl MetaAPI for GLSyncMeta { impl fmt::Debug for GLSyncMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("GLSyncMeta") - .field("context", &self.get_context()) + .field("context", &self.context()) .finish() } } diff --git a/gstreamer-net/src/net_address_meta.rs b/gstreamer-net/src/net_address_meta.rs index d2cad6030..5a54e4880 100644 --- a/gstreamer-net/src/net_address_meta.rs +++ b/gstreamer-net/src/net_address_meta.rs @@ -26,7 +26,7 @@ impl NetAddressMeta { } } - pub fn get_addr(&self) -> gio::SocketAddress { + pub fn addr(&self) -> gio::SocketAddress { unsafe { from_glib_none(self.0.addr) } } @@ -50,7 +50,7 @@ unsafe impl MetaAPI for NetAddressMeta { impl fmt::Debug for NetAddressMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("NetAddressMeta") - .field("addr", &self.get_addr()) + .field("addr", &self.addr()) .finish() } } @@ -71,7 +71,7 @@ mod tests { let expected_addr = &gio::InetSocketAddress::new(&inet_addr, port); - let expected_inet_addr = expected_addr.get_address(); + let expected_inet_addr = expected_addr.address(); { let meta = NetAddressMeta::add( @@ -79,28 +79,22 @@ mod tests { &gio::InetSocketAddress::new(&inet_addr, port), ); - let actual_addr = meta - .get_addr() - .downcast::() - .unwrap(); + let actual_addr = meta.addr().downcast::().unwrap(); - assert_eq!(actual_addr.get_port(), expected_addr.get_port()); + assert_eq!(actual_addr.port(), expected_addr.port()); - let actual_inet_addr = actual_addr.get_address(); + let actual_inet_addr = actual_addr.address(); assert!(actual_inet_addr.equal(&expected_inet_addr)); } { let meta = buffer.get_meta::().unwrap(); - let actual_addr = meta - .get_addr() - .downcast::() - .unwrap(); + let actual_addr = meta.addr().downcast::().unwrap(); - assert_eq!(actual_addr.get_port(), expected_addr.get_port()); + assert_eq!(actual_addr.port(), expected_addr.port()); - let actual_inet_addr = actual_addr.get_address(); + let actual_inet_addr = actual_addr.address(); assert!(actual_inet_addr.equal(&expected_inet_addr)); } diff --git a/gstreamer-pbutils/src/discoverer.rs b/gstreamer-pbutils/src/discoverer.rs index 5a6f92f78..494361bab 100644 --- a/gstreamer-pbutils/src/discoverer.rs +++ b/gstreamer-pbutils/src/discoverer.rs @@ -23,7 +23,7 @@ impl Discoverer { } } - pub fn get_property_timeout(&self) -> gst::ClockTime { + pub fn property_timeout(&self) -> gst::ClockTime { let mut value = Value::from(&0u64); unsafe { glib::gobject_ffi::g_object_get_property( diff --git a/gstreamer-pbutils/src/discoverer_stream_info.rs b/gstreamer-pbutils/src/discoverer_stream_info.rs index 282a4ba63..88eafe1b4 100644 --- a/gstreamer-pbutils/src/discoverer_stream_info.rs +++ b/gstreamer-pbutils/src/discoverer_stream_info.rs @@ -18,9 +18,9 @@ impl Iterator for Iter { Some(ref c) => { // Decide on the direction if self.direction_forward { - c.get_next() + c.next() } else { - c.get_previous() + c.previous() } } None => None, @@ -32,14 +32,14 @@ impl Iterator for Iter { impl DiscovererStreamInfo { pub fn next_iter(&self) -> Iter { Iter { - stream_info: self.get_next(), + stream_info: self.next(), direction_forward: true, } } pub fn previous_iter(&self) -> Iter { Iter { - stream_info: self.get_previous(), + stream_info: self.previous(), direction_forward: false, } } diff --git a/gstreamer-pbutils/src/discoverer_video_info.rs b/gstreamer-pbutils/src/discoverer_video_info.rs index 540589a15..a9d2ad096 100644 --- a/gstreamer-pbutils/src/discoverer_video_info.rs +++ b/gstreamer-pbutils/src/discoverer_video_info.rs @@ -5,7 +5,7 @@ use crate::DiscovererVideoInfo; use glib::translate::*; impl DiscovererVideoInfo { - pub fn get_framerate(&self) -> gst::Fraction { + pub fn framerate(&self) -> gst::Fraction { unsafe { gst::Fraction::new( ffi::gst_discoverer_video_info_get_framerate_num(self.to_glib_none().0) as i32, @@ -14,7 +14,7 @@ impl DiscovererVideoInfo { } } - pub fn get_par(&self) -> gst::Fraction { + pub fn par(&self) -> gst::Fraction { unsafe { gst::Fraction::new( ffi::gst_discoverer_video_info_get_par_num(self.to_glib_none().0) as i32, diff --git a/gstreamer-pbutils/src/encoding_profile.rs b/gstreamer-pbutils/src/encoding_profile.rs index 2acd4c281..05c47fb13 100644 --- a/gstreamer-pbutils/src/encoding_profile.rs +++ b/gstreamer-pbutils/src/encoding_profile.rs @@ -103,7 +103,7 @@ trait EncodingProfileHasRestrictionSetter { } pub trait EncodingProfileHasRestrictionGetter { - fn get_restriction(&self) -> Option; + fn restriction(&self) -> Option; } macro_rules! declare_encoding_profile_has_restriction( @@ -127,7 +127,7 @@ macro_rules! declare_encoding_profile_has_restriction( } impl EncodingProfileHasRestrictionGetter for $name { - fn get_restriction(&self) -> Option { + fn restriction(&self) -> Option { let profile: &EncodingProfile = glib::object::Cast::upcast_ref(self); unsafe { @@ -529,25 +529,22 @@ mod tests { .build() .unwrap(); - assert_eq!(audio_profile.get_name().unwrap(), AUDIO_PROFILE_NAME); + assert_eq!(audio_profile.name().unwrap(), AUDIO_PROFILE_NAME); assert_eq!( - audio_profile.get_description().unwrap(), + audio_profile.description().unwrap(), AUDIO_PROFILE_DESCRIPTION ); - assert_eq!(audio_profile.get_format(), caps); - assert_eq!(audio_profile.get_preset().unwrap(), PRESET); - assert_eq!(audio_profile.get_preset_name().unwrap(), PRESET_NAME); - assert_eq!(audio_profile.get_restriction().unwrap(), restriction); - assert_eq!(audio_profile.get_presence(), PRESENCE); - assert_eq!( - audio_profile.get_allow_dynamic_output(), - ALLOW_DYNAMIC_OUTPUT - ); + assert_eq!(audio_profile.format(), caps); + assert_eq!(audio_profile.preset().unwrap(), PRESET); + assert_eq!(audio_profile.preset_name().unwrap(), PRESET_NAME); + assert_eq!(audio_profile.restriction().unwrap(), restriction); + assert_eq!(audio_profile.presence(), PRESENCE); + assert_eq!(audio_profile.allows_dynamic_output(), ALLOW_DYNAMIC_OUTPUT); assert_eq!(audio_profile.is_enabled(), ENABLED); let restriction = gst::Caps::new_simple("audio/x-raw", &[("format", &"S32BE")]); audio_profile.set_restriction(Some(&restriction)); - assert_eq!(audio_profile.get_restriction().unwrap(), restriction); + assert_eq!(audio_profile.restriction().unwrap(), restriction); } #[test] @@ -573,30 +570,27 @@ mod tests { .build() .unwrap(); - assert_eq!(video_profile.get_name().unwrap(), VIDEO_PROFILE_NAME); + assert_eq!(video_profile.name().unwrap(), VIDEO_PROFILE_NAME); assert_eq!( - video_profile.get_description().unwrap(), + video_profile.description().unwrap(), VIDEO_PROFILE_DESCRIPTION ); - assert_eq!(video_profile.get_format(), caps); - assert_eq!(video_profile.get_preset().unwrap(), PRESET); - assert_eq!(video_profile.get_preset_name().unwrap(), PRESET_NAME); - assert_eq!(video_profile.get_restriction().unwrap(), restriction); - assert_eq!(video_profile.get_presence(), PRESENCE); - assert_eq!( - video_profile.get_allow_dynamic_output(), - ALLOW_DYNAMIC_OUTPUT - ); + assert_eq!(video_profile.format(), caps); + assert_eq!(video_profile.preset().unwrap(), PRESET); + assert_eq!(video_profile.preset_name().unwrap(), PRESET_NAME); + assert_eq!(video_profile.restriction().unwrap(), restriction); + assert_eq!(video_profile.presence(), PRESENCE); + assert_eq!(video_profile.allows_dynamic_output(), ALLOW_DYNAMIC_OUTPUT); assert_eq!(video_profile.is_enabled(), ENABLED); let video_profile: EncodingVideoProfile = glib::object::Cast::downcast(video_profile).ok().unwrap(); - assert_eq!(video_profile.get_variableframerate(), VARIABLE_FRAMERATE); - assert_eq!(video_profile.get_pass(), PASS); + assert_eq!(video_profile.variableframerate(), VARIABLE_FRAMERATE); + assert_eq!(video_profile.pass(), PASS); let restriction = gst::Caps::new_simple("video/x-raw", &[("format", &"NV12")]); video_profile.set_restriction(Some(&restriction)); - assert_eq!(video_profile.get_restriction().unwrap(), restriction); + assert_eq!(video_profile.restriction().unwrap(), restriction); } #[test] @@ -634,16 +628,16 @@ mod tests { .build() .unwrap(); - assert_eq!(profile.get_name().unwrap(), CONTAINER_PROFILE_NAME); + assert_eq!(profile.name().unwrap(), CONTAINER_PROFILE_NAME); assert_eq!( - profile.get_description().unwrap(), + profile.description().unwrap(), CONTAINER_PROFILE_DESCRIPTION ); - assert_eq!(profile.get_format(), container_caps); - assert_eq!(profile.get_preset().unwrap(), PRESET); - assert_eq!(profile.get_preset_name().unwrap(), PRESET_NAME); - assert_eq!(profile.get_presence(), PRESENCE); - assert_eq!(profile.get_allow_dynamic_output(), ALLOW_DYNAMIC_OUTPUT); + assert_eq!(profile.format(), container_caps); + assert_eq!(profile.preset().unwrap(), PRESET); + assert_eq!(profile.preset_name().unwrap(), PRESET_NAME); + assert_eq!(profile.presence(), PRESENCE); + assert_eq!(profile.allows_dynamic_output(), ALLOW_DYNAMIC_OUTPUT); assert_eq!(profile.is_enabled(), ENABLED); let container_profile: EncodingContainerProfile = diff --git a/gstreamer-player/src/config.rs b/gstreamer-player/src/config.rs index 0dba4081f..cd16f622f 100644 --- a/gstreamer-player/src/config.rs +++ b/gstreamer-player/src/config.rs @@ -35,12 +35,12 @@ impl AsMut for PlayerConfig { } impl PlayerConfig { - pub fn get_position_update_interval(&self) -> u32 { + pub fn position_update_interval(&self) -> u32 { assert_initialized_main_thread!(); unsafe { ffi::gst_player_config_get_position_update_interval(self.0.to_glib_none().0) } } - pub fn get_seek_accurate(&self) -> bool { + pub fn is_seek_accurate(&self) -> bool { assert_initialized_main_thread!(); unsafe { from_glib(ffi::gst_player_config_get_seek_accurate( @@ -49,7 +49,7 @@ impl PlayerConfig { } } - pub fn get_user_agent(&self) -> Option { + pub fn user_agent(&self) -> Option { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gst_player_config_get_user_agent( diff --git a/gstreamer-player/src/player.rs b/gstreamer-player/src/player.rs index 891e6337d..d25101dab 100644 --- a/gstreamer-player/src/player.rs +++ b/gstreamer-player/src/player.rs @@ -29,7 +29,7 @@ impl Player { } } - pub fn get_config(&self) -> crate::PlayerConfig { + pub fn config(&self) -> crate::PlayerConfig { unsafe { from_glib_full(ffi::gst_player_get_config(self.to_glib_none().0)) } } diff --git a/gstreamer-player/src/player_video_info.rs b/gstreamer-player/src/player_video_info.rs index d3634900d..693580b27 100644 --- a/gstreamer-player/src/player_video_info.rs +++ b/gstreamer-player/src/player_video_info.rs @@ -5,7 +5,7 @@ use glib::translate::*; use std::mem; impl PlayerVideoInfo { - pub fn get_framerate(&self) -> gst::Fraction { + pub fn framerate(&self) -> gst::Fraction { unsafe { let mut fps_n = mem::MaybeUninit::uninit(); let mut fps_d = mem::MaybeUninit::uninit(); @@ -18,7 +18,7 @@ impl PlayerVideoInfo { } } - pub fn get_pixel_aspect_ratio(&self) -> gst::Fraction { + pub fn pixel_aspect_ratio(&self) -> gst::Fraction { unsafe { let mut par_n = mem::MaybeUninit::uninit(); let mut par_d = mem::MaybeUninit::uninit(); diff --git a/gstreamer-player/src/player_video_overlay_video_renderer.rs b/gstreamer-player/src/player_video_overlay_video_renderer.rs index 41b09920b..7e0a845de 100644 --- a/gstreamer-player/src/player_video_overlay_video_renderer.rs +++ b/gstreamer-player/src/player_video_overlay_video_renderer.rs @@ -40,7 +40,7 @@ impl PlayerVideoOverlayVideoRenderer { } } - pub unsafe fn get_window_handle(&self) -> uintptr_t { + pub unsafe fn window_handle(&self) -> uintptr_t { ffi::gst_player_video_overlay_video_renderer_get_window_handle(self.to_glib_none().0) as uintptr_t } diff --git a/gstreamer-player/src/subclass/player_video_renderer.rs b/gstreamer-player/src/subclass/player_video_renderer.rs index 0249f72de..6add17fbd 100644 --- a/gstreamer-player/src/subclass/player_video_renderer.rs +++ b/gstreamer-player/src/subclass/player_video_renderer.rs @@ -65,7 +65,7 @@ unsafe extern "C" fn video_renderer_create_video_sink(video_renderer).unsafe_cast_ref(), diff --git a/gstreamer-rtp/src/rtp_buffer.rs b/gstreamer-rtp/src/rtp_buffer.rs index f04891b4e..eccd43e5b 100644 --- a/gstreamer-rtp/src/rtp_buffer.rs +++ b/gstreamer-rtp/src/rtp_buffer.rs @@ -174,28 +174,28 @@ impl<'a> RTPBuffer<'a, Writable> { } impl<'a, T> RTPBuffer<'a, T> { - pub fn get_seq(&self) -> u16 { + pub fn seq(&self) -> u16 { unsafe { ffi::gst_rtp_buffer_get_seq(glib::translate::mut_override(&self.rtp_buffer)) } } - pub fn get_payload_type(&self) -> u8 { + pub fn payload_type(&self) -> u8 { unsafe { ffi::gst_rtp_buffer_get_payload_type(glib::translate::mut_override(&self.rtp_buffer)) } } - pub fn get_ssrc(&self) -> u32 { + pub fn ssrc(&self) -> u32 { unsafe { ffi::gst_rtp_buffer_get_ssrc(glib::translate::mut_override(&self.rtp_buffer)) } } - pub fn get_timestamp(&self) -> u32 { + pub fn timestamp(&self) -> u32 { unsafe { ffi::gst_rtp_buffer_get_timestamp(glib::translate::mut_override(&self.rtp_buffer)) } } pub fn get_csrc(&self, idx: u8) -> Option { - if idx < self.get_csrc_count() { + if idx < self.csrc_count() { unsafe { Some(ffi::gst_rtp_buffer_get_csrc( glib::translate::mut_override(&self.rtp_buffer), @@ -207,13 +207,13 @@ impl<'a, T> RTPBuffer<'a, T> { } } - pub fn get_csrc_count(&self) -> u8 { + pub fn csrc_count(&self) -> u8 { unsafe { ffi::gst_rtp_buffer_get_csrc_count(glib::translate::mut_override(&self.rtp_buffer)) } } - pub fn get_marker(&self) -> bool { + pub fn is_marker(&self) -> bool { unsafe { from_glib(ffi::gst_rtp_buffer_get_marker( glib::translate::mut_override(&self.rtp_buffer), @@ -221,15 +221,15 @@ impl<'a, T> RTPBuffer<'a, T> { } } - pub fn get_payload_size(&self) -> u32 { + pub fn payload_size(&self) -> u32 { unsafe { ffi::gst_rtp_buffer_get_payload_len(glib::translate::mut_override(&self.rtp_buffer)) as u32 } } - pub fn get_payload(&self) -> Result<&[u8], glib::error::BoolError> { - let size = self.get_payload_size(); + pub fn payload(&self) -> Result<&[u8], glib::error::BoolError> { + let size = self.payload_size(); if size == 0 { return Ok(&[]); } @@ -244,7 +244,7 @@ impl<'a, T> RTPBuffer<'a, T> { } } - pub fn get_extension(&self) -> bool { + pub fn is_extension(&self) -> bool { unsafe { from_glib(ffi::gst_rtp_buffer_get_extension( glib::translate::mut_override(&self.rtp_buffer), @@ -252,7 +252,7 @@ impl<'a, T> RTPBuffer<'a, T> { } } - pub fn get_extension_bytes(&self) -> Option<(u16, glib::Bytes)> { + pub fn extension_bytes(&self) -> Option<(u16, glib::Bytes)> { unsafe { let mut bits: u16 = 0; match from_glib_full(ffi::gst_rtp_buffer_get_extension_bytes( @@ -366,27 +366,27 @@ mod tests { let mut rtp_buffer = RTPBuffer::from_buffer_writable(&mut buffer).unwrap(); rtp_buffer.set_seq(42); - assert_eq!(rtp_buffer.get_seq(), 42); + assert_eq!(rtp_buffer.seq(), 42); rtp_buffer.set_marker(true); - assert!(rtp_buffer.get_marker()); + assert!(rtp_buffer.marker()); rtp_buffer.set_payload_type(43); - assert_eq!(rtp_buffer.get_payload_type(), 43); + assert_eq!(rtp_buffer.payload_type(), 43); rtp_buffer.set_timestamp(44); - assert_eq!(rtp_buffer.get_timestamp(), 44); + assert_eq!(rtp_buffer.timestamp(), 44); rtp_buffer.set_ssrc(45); - assert_eq!(rtp_buffer.get_ssrc(), 45); + assert_eq!(rtp_buffer.ssrc(), 45); - assert_eq!(rtp_buffer.get_payload_size(), payload_size); - let payload = rtp_buffer.get_payload(); + assert_eq!(rtp_buffer.payload_size(), payload_size); + let payload = rtp_buffer.payload(); assert!(payload.is_ok()); let payload = payload.unwrap(); assert_eq!(payload.len(), payload_size as usize); - assert_eq!(rtp_buffer.get_csrc_count(), csrc_count); + assert_eq!(rtp_buffer.csrc_count(), csrc_count); rtp_buffer.set_csrc(0, 12); rtp_buffer.set_csrc(1, 15); assert_eq!(rtp_buffer.get_csrc(0).unwrap(), 12); @@ -394,9 +394,9 @@ mod tests { assert!(rtp_buffer.get_csrc(2).is_none()); rtp_buffer.set_extension(true); - assert_eq!(rtp_buffer.get_extension(), true); + assert_eq!(rtp_buffer.extension(), true); - assert_eq!(rtp_buffer.get_extension_bytes(), None); + assert_eq!(rtp_buffer.extension_bytes(), None); } #[test] @@ -408,8 +408,8 @@ mod tests { let buffer = gst::Buffer::new_rtp_with_sizes(payload_size, 4, csrc_count).unwrap(); let rtp_buffer = RTPBuffer::from_buffer_readable(&buffer).unwrap(); - assert_eq!(rtp_buffer.get_payload_size(), payload_size); - let payload = rtp_buffer.get_payload(); + assert_eq!(rtp_buffer.payload_size(), payload_size); + let payload = rtp_buffer.payload(); assert!(payload.is_ok()); assert_eq!(payload.unwrap().len(), payload_size as usize); } @@ -421,13 +421,13 @@ mod tests { let mut buffer = gst::Buffer::new_rtp_with_sizes(16, 4, 0).unwrap(); let mut rtp_buffer = RTPBuffer::from_buffer_writable(&mut buffer).unwrap(); - assert_eq!(rtp_buffer.get_extension_bytes(), None); + assert_eq!(rtp_buffer.extension_bytes(), None); let extension_data: [u8; 4] = [100, 101, 102, 103]; let result = rtp_buffer.add_extension_onebyte_header(1, &extension_data); assert!(result.is_ok()); - let bytes_option = rtp_buffer.get_extension_bytes(); + let bytes_option = rtp_buffer.extension_bytes(); assert!(bytes_option.is_some()); let (bits, bytes) = bytes_option.unwrap(); // 0xBEDE is the onebyte extension header marker: https://tools.ietf.org/html/rfc5285 (4.2) @@ -459,7 +459,7 @@ mod tests { let mut buffer = gst::Buffer::new_rtp_with_sizes(16, 4, 0).unwrap(); let mut rtp_buffer = RTPBuffer::from_buffer_writable(&mut buffer).unwrap(); - assert_eq!(rtp_buffer.get_extension_bytes(), None); + assert_eq!(rtp_buffer.extension_bytes(), None); let extension_data: [u8; 4] = [100, 101, 102, 103]; let appbits = 5; @@ -467,7 +467,7 @@ mod tests { let result = rtp_buffer.add_extension_twobytes_header(appbits, id, &extension_data); assert!(result.is_ok()); - let bytes_option = rtp_buffer.get_extension_bytes(); + let bytes_option = rtp_buffer.extension_bytes(); assert!(bytes_option.is_some()); let (bits, bytes) = bytes_option.unwrap(); // 0x100 + appbits is the twobyte extension header marker: diff --git a/gstreamer-rtsp-server/src/rtsp_token.rs b/gstreamer-rtsp-server/src/rtsp_token.rs index efa761b8c..789c84196 100644 --- a/gstreamer-rtsp-server/src/rtsp_token.rs +++ b/gstreamer-rtsp-server/src/rtsp_token.rs @@ -21,7 +21,7 @@ impl RTSPToken { { let token = token.get_mut().unwrap(); - let structure = token.get_mut_structure().unwrap(); + let structure = token.structure_mut().unwrap(); for &(f, v) in values { structure.set_value(f, v.to_send_value()); @@ -42,7 +42,7 @@ impl RTSPTokenRef { } } - pub fn get_structure(&self) -> Option { + pub fn structure(&self) -> Option { unsafe { from_glib_none(ffi::gst_rtsp_token_get_structure(self.as_mut_ptr())) } } @@ -55,7 +55,7 @@ impl RTSPTokenRef { } } - pub fn get_mut_structure(&mut self) -> Option<&mut gst::StructureRef> { + pub fn structure_mut(&mut self) -> Option<&mut gst::StructureRef> { unsafe { let structure = ffi::gst_rtsp_token_writable_structure(self.as_mut_ptr()); if structure.is_null() { @@ -76,7 +76,7 @@ impl fmt::Debug for RTSPToken { impl fmt::Debug for RTSPTokenRef { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("RTSPToken") - .field("structure", &self.get_structure()) + .field("structure", &self.structure()) .finish() } } diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_client.rs b/gstreamer-rtsp-server/src/subclass/rtsp_client.rs index 6131b9b22..500ab2cae 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_client.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_client.rs @@ -348,7 +348,7 @@ impl RTSPClientImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; let f = (*parent_class) .create_sdp .expect("No `create_rtpbin` virtual method implementation in parent class"); @@ -369,7 +369,7 @@ impl RTSPClientImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; let f = (*parent_class).configure_client_media.expect( "No `configure_client_media` virtual method implementation in parent class", ); @@ -396,7 +396,7 @@ impl RTSPClientImplExt for T { ) -> gst_rtsp::RTSPResult { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; let f = (*parent_class) .params_set .expect("No `params_set` virtual method implementation in parent class"); @@ -415,7 +415,7 @@ impl RTSPClientImplExt for T { ) -> gst_rtsp::RTSPResult { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; let f = (*parent_class) .params_get .expect("No `params_get` virtual method implementation in parent class"); @@ -434,7 +434,7 @@ impl RTSPClientImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; let f = (*parent_class) .make_path_from_uri .expect("No `make_path_from_uri` virtual method implementation in parent class"); @@ -449,7 +449,7 @@ impl RTSPClientImplExt for T { fn parent_closed(&self, client: &Self::Type) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).closed { f(client.unsafe_cast_ref::().to_glib_none().0); } @@ -459,7 +459,7 @@ impl RTSPClientImplExt for T { fn parent_new_session(&self, client: &Self::Type, session: &crate::RTSPSession) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).new_session { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -472,7 +472,7 @@ impl RTSPClientImplExt for T { fn parent_options_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).options_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -485,7 +485,7 @@ impl RTSPClientImplExt for T { fn parent_describe_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).describe_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -498,7 +498,7 @@ impl RTSPClientImplExt for T { fn parent_setup_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).setup_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -511,7 +511,7 @@ impl RTSPClientImplExt for T { fn parent_play_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).play_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -524,7 +524,7 @@ impl RTSPClientImplExt for T { fn parent_pause_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pause_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -537,7 +537,7 @@ impl RTSPClientImplExt for T { fn parent_teardown_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).teardown_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -550,7 +550,7 @@ impl RTSPClientImplExt for T { fn parent_set_parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).set_parameter_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -563,7 +563,7 @@ impl RTSPClientImplExt for T { fn parent_get_parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).get_parameter_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -576,7 +576,7 @@ impl RTSPClientImplExt for T { fn parent_announce_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).announce_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -589,7 +589,7 @@ impl RTSPClientImplExt for T { fn parent_record_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).record_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -602,7 +602,7 @@ impl RTSPClientImplExt for T { fn parent_handle_response(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).handle_response { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -624,7 +624,7 @@ impl RTSPClientImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; let f = (*parent_class) .handle_sdp .expect("No `handle_sdp` virtual method implementation in parent class"); @@ -650,7 +650,7 @@ impl RTSPClientImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).check_requirements { from_glib_full(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -670,7 +670,7 @@ impl RTSPClientImplExt for T { ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_options_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -689,7 +689,7 @@ impl RTSPClientImplExt for T { ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_describe_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -708,7 +708,7 @@ impl RTSPClientImplExt for T { ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_setup_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -727,7 +727,7 @@ impl RTSPClientImplExt for T { ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_play_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -746,7 +746,7 @@ impl RTSPClientImplExt for T { ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_pause_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -765,7 +765,7 @@ impl RTSPClientImplExt for T { ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_teardown_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -784,7 +784,7 @@ impl RTSPClientImplExt for T { ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_set_parameter_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -803,7 +803,7 @@ impl RTSPClientImplExt for T { ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_get_parameter_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -822,7 +822,7 @@ impl RTSPClientImplExt for T { ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_announce_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -841,7 +841,7 @@ impl RTSPClientImplExt for T { ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_record_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -899,7 +899,7 @@ unsafe extern "C" fn client_create_sdp( media: *mut ffi::GstRTSPMedia, ) -> *mut gst_sdp::ffi::GstSDPMessage { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let sdp = @@ -916,7 +916,7 @@ unsafe extern "C" fn client_configure_client_media( ctx: *mut ffi::GstRTSPContext, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); match imp.configure_client_media( @@ -938,7 +938,7 @@ unsafe extern "C" fn client_params_set( ctx: *mut ffi::GstRTSPContext, ) -> gst_rtsp::ffi::GstRTSPResult { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.params_set(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) @@ -950,7 +950,7 @@ unsafe extern "C" fn client_params_get( ctx: *mut ffi::GstRTSPContext, ) -> gst_rtsp::ffi::GstRTSPResult { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.params_get(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) @@ -962,7 +962,7 @@ unsafe extern "C" fn client_make_path_from_uri( url: *const gst_rtsp::ffi::GstRTSPUrl, ) -> *mut std::os::raw::c_char { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.make_path_from_uri(wrap.unsafe_cast_ref(), &from_glib_borrow(url)) @@ -971,7 +971,7 @@ unsafe extern "C" fn client_make_path_from_uri( unsafe extern "C" fn client_closed(ptr: *mut ffi::GstRTSPClient) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.closed(wrap.unsafe_cast_ref()); @@ -982,7 +982,7 @@ unsafe extern "C" fn client_new_session( session: *mut ffi::GstRTSPSession, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.new_session(wrap.unsafe_cast_ref(), &from_glib_borrow(session)); @@ -993,7 +993,7 @@ unsafe extern "C" fn client_options_request( ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.options_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)); @@ -1004,7 +1004,7 @@ unsafe extern "C" fn client_describe_request( ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.describe_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)); @@ -1015,7 +1015,7 @@ unsafe extern "C" fn client_setup_request( ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.setup_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)); @@ -1026,7 +1026,7 @@ unsafe extern "C" fn client_play_request( ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.play_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)); @@ -1037,7 +1037,7 @@ unsafe extern "C" fn client_pause_request( ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.pause_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)); @@ -1048,7 +1048,7 @@ unsafe extern "C" fn client_teardown_request( ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.teardown_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)); @@ -1059,7 +1059,7 @@ unsafe extern "C" fn client_set_parameter_request( ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.set_parameter_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)); @@ -1070,7 +1070,7 @@ unsafe extern "C" fn client_get_parameter_request( ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.get_parameter_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)); @@ -1081,7 +1081,7 @@ unsafe extern "C" fn client_announce_request( ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.announce_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)); @@ -1092,7 +1092,7 @@ unsafe extern "C" fn client_record_request( ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.record_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)); @@ -1103,7 +1103,7 @@ unsafe extern "C" fn client_handle_response( ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.handle_response(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)); @@ -1116,7 +1116,7 @@ unsafe extern "C" fn client_handle_sdp( sdp: *mut gst_sdp::ffi::GstSDPMessage, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); match imp.handle_sdp( @@ -1139,7 +1139,7 @@ unsafe extern "C" fn client_check_requirements( arr: *mut *mut std::os::raw::c_char, ) -> *mut std::os::raw::c_char { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.check_requirements( @@ -1155,7 +1155,7 @@ unsafe extern "C" fn client_pre_options_request( ctx: *mut ffi::GstRTSPContext, ) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_options_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) @@ -1167,7 +1167,7 @@ unsafe extern "C" fn client_pre_describe_request( ctx: *mut ffi::GstRTSPContext, ) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_describe_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) @@ -1179,7 +1179,7 @@ unsafe extern "C" fn client_pre_setup_request( ctx: *mut ffi::GstRTSPContext, ) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_setup_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) @@ -1191,7 +1191,7 @@ unsafe extern "C" fn client_pre_play_request( ctx: *mut ffi::GstRTSPContext, ) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_play_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) @@ -1203,7 +1203,7 @@ unsafe extern "C" fn client_pre_pause_request( ctx: *mut ffi::GstRTSPContext, ) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_pause_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) @@ -1215,7 +1215,7 @@ unsafe extern "C" fn client_pre_teardown_request( ctx: *mut ffi::GstRTSPContext, ) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_teardown_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) @@ -1227,7 +1227,7 @@ unsafe extern "C" fn client_pre_set_parameter_request( ctx: *mut ffi::GstRTSPContext, ) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_set_parameter_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) @@ -1239,7 +1239,7 @@ unsafe extern "C" fn client_pre_get_parameter_request( ctx: *mut ffi::GstRTSPContext, ) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_get_parameter_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) @@ -1251,7 +1251,7 @@ unsafe extern "C" fn client_pre_announce_request( ctx: *mut ffi::GstRTSPContext, ) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_announce_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) @@ -1263,7 +1263,7 @@ unsafe extern "C" fn client_pre_record_request( ctx: *mut ffi::GstRTSPContext, ) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_record_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_media.rs b/gstreamer-rtsp-server/src/subclass/rtsp_media.rs index 5f853b4a5..17589ba88 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_media.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_media.rs @@ -153,7 +153,7 @@ impl RTSPMediaImplExt for T { fn parent_handle_message(&self, media: &Self::Type, message: &gst::MessageRef) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).handle_message { from_glib(f( media.unsafe_cast_ref::().to_glib_none().0, @@ -172,7 +172,7 @@ impl RTSPMediaImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).prepare { gst::result_from_gboolean!( f( @@ -191,7 +191,7 @@ impl RTSPMediaImplExt for T { fn parent_unprepare(&self, media: &Self::Type) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).unprepare { gst::result_from_gboolean!( f(media.unsafe_cast_ref::().to_glib_none().0), @@ -207,7 +207,7 @@ impl RTSPMediaImplExt for T { fn parent_suspend(&self, media: &Self::Type) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).suspend { gst::result_from_gboolean!( f(media.unsafe_cast_ref::().to_glib_none().0), @@ -223,7 +223,7 @@ impl RTSPMediaImplExt for T { fn parent_unsuspend(&self, media: &Self::Type) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).unsuspend { gst::result_from_gboolean!( f(media.unsafe_cast_ref::().to_glib_none().0), @@ -243,7 +243,7 @@ impl RTSPMediaImplExt for T { use std::mem; let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).query_position { let mut position = mem::MaybeUninit::uninit(); if f( @@ -266,7 +266,7 @@ impl RTSPMediaImplExt for T { use std::mem; let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).query_stop { let mut stop = mem::MaybeUninit::uninit(); if f( @@ -287,7 +287,7 @@ impl RTSPMediaImplExt for T { fn parent_create_rtpbin(&self, media: &Self::Type) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; let f = (*parent_class) .create_rtpbin .expect("No `create_rtpbin` virtual method implementation in parent class"); @@ -303,7 +303,7 @@ impl RTSPMediaImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).setup_rtpbin { let ptr = rtpbin.to_glib_none().0; @@ -338,7 +338,7 @@ impl RTSPMediaImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; let f = (*parent_class) .setup_sdp .expect("No `setup_sdp` virtual method implementation in parent class"); @@ -358,7 +358,7 @@ impl RTSPMediaImplExt for T { fn parent_new_stream(&self, media: &Self::Type, stream: &crate::RTSPStream) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).new_stream { f( media.unsafe_cast_ref::().to_glib_none().0, @@ -371,7 +371,7 @@ impl RTSPMediaImplExt for T { fn parent_removed_stream(&self, media: &Self::Type, stream: &crate::RTSPStream) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).removed_stream { f( media.unsafe_cast_ref::().to_glib_none().0, @@ -384,7 +384,7 @@ impl RTSPMediaImplExt for T { fn parent_prepared(&self, media: &Self::Type) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).prepared { f(media.unsafe_cast_ref::().to_glib_none().0); } @@ -394,7 +394,7 @@ impl RTSPMediaImplExt for T { fn parent_unprepared(&self, media: &Self::Type) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).unprepared { f(media.unsafe_cast_ref::().to_glib_none().0); } @@ -404,7 +404,7 @@ impl RTSPMediaImplExt for T { fn parent_target_state(&self, media: &Self::Type, state: gst::State) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).target_state { f( media.unsafe_cast_ref::().to_glib_none().0, @@ -417,7 +417,7 @@ impl RTSPMediaImplExt for T { fn parent_new_state(&self, media: &Self::Type, state: gst::State) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).new_state { f( media.unsafe_cast_ref::().to_glib_none().0, @@ -434,7 +434,7 @@ impl RTSPMediaImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; let f = (*parent_class) .handle_sdp .expect("No `handle_sdp` virtual method implementation in parent class"); @@ -483,7 +483,7 @@ unsafe extern "C" fn media_handle_message( message: *mut gst::ffi::GstMessage, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.handle_message(wrap.unsafe_cast_ref(), gst::MessageRef::from_ptr(message)) @@ -495,7 +495,7 @@ unsafe extern "C" fn media_prepare( thread: *mut ffi::GstRTSPThread, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); match imp.prepare(wrap.unsafe_cast_ref(), &from_glib_borrow(thread)) { @@ -511,7 +511,7 @@ unsafe extern "C" fn media_unprepare( ptr: *mut ffi::GstRTSPMedia, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); match imp.unprepare(wrap.unsafe_cast_ref()) { @@ -527,7 +527,7 @@ unsafe extern "C" fn media_suspend( ptr: *mut ffi::GstRTSPMedia, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); match imp.suspend(wrap.unsafe_cast_ref()) { @@ -543,7 +543,7 @@ unsafe extern "C" fn media_unsuspend( ptr: *mut ffi::GstRTSPMedia, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); match imp.unsuspend(wrap.unsafe_cast_ref()) { @@ -560,7 +560,7 @@ unsafe extern "C" fn media_query_position( position: *mut i64, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); match imp.query_position(wrap.unsafe_cast_ref()) { @@ -577,7 +577,7 @@ unsafe extern "C" fn media_query_stop( stop: *mut i64, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); match imp.query_stop(wrap.unsafe_cast_ref()) { @@ -593,7 +593,7 @@ unsafe extern "C" fn media_create_rtpbin( ptr: *mut ffi::GstRTSPMedia, ) -> *mut gst::ffi::GstElement { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let res: *mut gst::ffi::GstElement = imp.create_rtpbin(wrap.unsafe_cast_ref()).to_glib_full(); @@ -610,7 +610,7 @@ unsafe extern "C" fn media_setup_rtpbin( rtpbin: *mut gst::ffi::GstElement, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); // If the rtpbin was floating before make sure it is not anymore for now so @@ -639,7 +639,7 @@ unsafe extern "C" fn media_setup_sdp( info: *mut ffi::GstSDPInfo, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); match imp.setup_sdp( @@ -660,7 +660,7 @@ unsafe extern "C" fn media_new_stream( stream: *mut ffi::GstRTSPStream, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.new_stream(wrap.unsafe_cast_ref(), &from_glib_borrow(stream)); @@ -671,7 +671,7 @@ unsafe extern "C" fn media_removed_stream( stream: *mut ffi::GstRTSPStream, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.removed_stream(wrap.unsafe_cast_ref(), &from_glib_borrow(stream)); @@ -679,7 +679,7 @@ unsafe extern "C" fn media_removed_stream( unsafe extern "C" fn media_prepared(ptr: *mut ffi::GstRTSPMedia) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.prepared(wrap.unsafe_cast_ref()); @@ -687,7 +687,7 @@ unsafe extern "C" fn media_prepared(ptr: *mut ffi::GstRTSPMedi unsafe extern "C" fn media_unprepared(ptr: *mut ffi::GstRTSPMedia) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.unprepared(wrap.unsafe_cast_ref()); @@ -698,7 +698,7 @@ unsafe extern "C" fn media_target_state( state: gst::ffi::GstState, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.target_state(wrap.unsafe_cast_ref(), from_glib(state)); @@ -709,7 +709,7 @@ unsafe extern "C" fn media_new_state( state: gst::ffi::GstState, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.new_state(wrap.unsafe_cast_ref(), from_glib(state)); @@ -720,7 +720,7 @@ unsafe extern "C" fn media_handle_sdp( sdp: *mut gst_sdp::ffi::GstSDPMessage, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); match imp.handle_sdp( diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs index 7c027aa21..ef64d06c2 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs @@ -85,8 +85,7 @@ impl RTSPMediaFactoryImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaFactoryClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaFactoryClass; (*parent_class) .gen_key .map(|f| { @@ -109,8 +108,7 @@ impl RTSPMediaFactoryImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaFactoryClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaFactoryClass; (*parent_class) .create_element .map(|f| { @@ -133,8 +131,7 @@ impl RTSPMediaFactoryImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaFactoryClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaFactoryClass; (*parent_class) .construct .map(|f| { @@ -157,8 +154,7 @@ impl RTSPMediaFactoryImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaFactoryClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaFactoryClass; (*parent_class) .create_pipeline .map(|f| { @@ -183,8 +179,7 @@ impl RTSPMediaFactoryImplExt for T { fn parent_configure(&self, factory: &Self::Type, media: &crate::RTSPMedia) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaFactoryClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaFactoryClass; if let Some(f) = (*parent_class).configure { f( factory @@ -200,8 +195,7 @@ impl RTSPMediaFactoryImplExt for T { fn parent_media_constructed(&self, factory: &Self::Type, media: &crate::RTSPMedia) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaFactoryClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaFactoryClass; if let Some(f) = (*parent_class).media_constructed { f( factory @@ -217,8 +211,7 @@ impl RTSPMediaFactoryImplExt for T { fn parent_media_configure(&self, factory: &Self::Type, media: &crate::RTSPMedia) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaFactoryClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaFactoryClass; if let Some(f) = (*parent_class).media_configure { f( factory @@ -254,7 +247,7 @@ unsafe extern "C" fn factory_gen_key( url: *const gst_rtsp::ffi::GstRTSPUrl, ) -> *mut std::os::raw::c_char { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.gen_key(wrap.unsafe_cast_ref(), &from_glib_borrow(url)) @@ -266,7 +259,7 @@ unsafe extern "C" fn factory_create_element( url: *const gst_rtsp::ffi::GstRTSPUrl, ) -> *mut gst::ffi::GstElement { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let element = imp @@ -281,7 +274,7 @@ unsafe extern "C" fn factory_construct( url: *const gst_rtsp::ffi::GstRTSPUrl, ) -> *mut ffi::GstRTSPMedia { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.construct(wrap.unsafe_cast_ref(), &from_glib_borrow(url)) @@ -298,7 +291,7 @@ unsafe extern "C" fn factory_create_pipeline( Lazy::new(|| glib::Quark::from_string("gstreamer-rs-rtsp-media-pipeline")); let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let pipeline: *mut gst::ffi::GstPipeline = imp @@ -323,7 +316,7 @@ unsafe extern "C" fn factory_configure( media: *mut ffi::GstRTSPMedia, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.configure(wrap.unsafe_cast_ref(), &from_glib_borrow(media)); @@ -334,7 +327,7 @@ unsafe extern "C" fn factory_media_constructed( media: *mut ffi::GstRTSPMedia, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.media_constructed(wrap.unsafe_cast_ref(), &from_glib_borrow(media)); @@ -345,7 +338,7 @@ unsafe extern "C" fn factory_media_configure( media: *mut ffi::GstRTSPMedia, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.media_configure(wrap.unsafe_cast_ref(), &from_glib_borrow(media)); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_server.rs b/gstreamer-rtsp-server/src/subclass/rtsp_server.rs index 6a77b9558..82b1b3c14 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_server.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_server.rs @@ -26,7 +26,7 @@ impl RTSPServerImplExt for T { fn parent_create_client(&self, server: &Self::Type) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPServerClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPServerClass; let f = (*parent_class) .create_client .expect("No `create_client` virtual method implementation in parent class"); @@ -37,7 +37,7 @@ impl RTSPServerImplExt for T { fn parent_client_connected(&self, server: &Self::Type, client: &crate::RTSPClient) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPServerClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPServerClass; if let Some(f) = (*parent_class).client_connected { f( server.unsafe_cast_ref::().to_glib_none().0, @@ -64,7 +64,7 @@ unsafe extern "C" fn server_create_client( ptr: *mut ffi::GstRTSPServer, ) -> *mut ffi::GstRTSPClient { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.create_client(wrap.unsafe_cast_ref()).to_glib_full() @@ -75,7 +75,7 @@ unsafe extern "C" fn server_client_connected( client: *mut ffi::GstRTSPClient, ) { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); imp.client_connected(wrap.unsafe_cast_ref(), &from_glib_borrow(client)); diff --git a/gstreamer-sdp/src/sdp_media.rs b/gstreamer-sdp/src/sdp_media.rs index fd8f8bd08..a01bd18ec 100644 --- a/gstreamer-sdp/src/sdp_media.rs +++ b/gstreamer-sdp/src/sdp_media.rs @@ -98,12 +98,12 @@ impl fmt::Debug for SDPMediaRef { .field("connections", &DebugIter(RefCell::new(self.connections()))) .field("bandwidths", &DebugIter(RefCell::new(self.bandwidths()))) .field("attributes", &DebugIter(RefCell::new(self.attributes()))) - .field("information", &self.get_information()) - .field("key", &self.get_key()) - .field("media", &self.get_media()) - .field("port", &self.get_port()) - .field("num-ports", &self.get_num_ports()) - .field("proto", &self.get_proto()) + .field("information", &self.information()) + .field("key", &self.key()) + .field("media", &self.media()) + .field("port", &self.port()) + .field("num-ports", &self.num_ports()) + .field("proto", &self.proto()) .finish() } } @@ -293,7 +293,7 @@ impl SDPMediaRef { } } - pub fn get_information(&self) -> Option<&str> { + pub fn information(&self) -> Option<&str> { unsafe { let ptr = ffi::gst_sdp_media_get_information(&self.0); if ptr.is_null() { @@ -304,7 +304,7 @@ impl SDPMediaRef { } } - pub fn get_key(&self) -> Option<&SDPKey> { + pub fn key(&self) -> Option<&SDPKey> { unsafe { let ptr = ffi::gst_sdp_media_get_key(&self.0); if ptr.is_null() { @@ -315,7 +315,7 @@ impl SDPMediaRef { } } - pub fn get_media(&self) -> Option<&str> { + pub fn media(&self) -> Option<&str> { unsafe { let ptr = ffi::gst_sdp_media_get_media(&self.0); if ptr.is_null() { @@ -326,15 +326,15 @@ impl SDPMediaRef { } } - pub fn get_num_ports(&self) -> u32 { + pub fn num_ports(&self) -> u32 { unsafe { ffi::gst_sdp_media_get_num_ports(&self.0) } } - pub fn get_port(&self) -> u32 { + pub fn port(&self) -> u32 { unsafe { ffi::gst_sdp_media_get_port(&self.0) } } - pub fn get_proto(&self) -> Option<&str> { + pub fn proto(&self) -> Option<&str> { unsafe { let ptr = ffi::gst_sdp_media_get_proto(&self.0); if ptr.is_null() { diff --git a/gstreamer-sdp/src/sdp_message.rs b/gstreamer-sdp/src/sdp_message.rs index df00a30cc..99ed878b5 100644 --- a/gstreamer-sdp/src/sdp_message.rs +++ b/gstreamer-sdp/src/sdp_message.rs @@ -131,13 +131,13 @@ impl fmt::Debug for SDPMessageRef { } f.debug_struct("SDPMessage") - .field("connection", &self.get_connection()) - .field("information", &self.get_information()) - .field("key", &self.get_key()) - .field("origin", &self.get_origin()) - .field("session-name", &self.get_session_name()) - .field("uri", &self.get_uri()) - .field("version", &self.get_version()) + .field("connection", &self.connection()) + .field("information", &self.information()) + .field("key", &self.key()) + .field("origin", &self.origin()) + .field("session-name", &self.session_name()) + .field("uri", &self.uri()) + .field("version", &self.version()) .field("attributes", &DebugIter(RefCell::new(self.attributes()))) .field("bandwidths", &DebugIter(RefCell::new(self.bandwidths()))) .field("emails", &DebugIter(RefCell::new(self.emails()))) @@ -297,7 +297,7 @@ impl SDPMessageRef { } } - pub fn get_connection(&self) -> Option<&SDPConnection> { + pub fn connection(&self) -> Option<&SDPConnection> { unsafe { let ptr = ffi::gst_sdp_message_get_connection(&self.0); if ptr.is_null() { @@ -323,7 +323,7 @@ impl SDPMessageRef { } } - pub fn get_information(&self) -> Option<&str> { + pub fn information(&self) -> Option<&str> { unsafe { let ptr = ffi::gst_sdp_message_get_information(&self.0); if ptr.is_null() { @@ -334,7 +334,7 @@ impl SDPMessageRef { } } - pub fn get_key(&self) -> Option<&SDPKey> { + pub fn key(&self) -> Option<&SDPKey> { unsafe { let ptr = ffi::gst_sdp_message_get_key(&self.0); if ptr.is_null() { @@ -375,7 +375,7 @@ impl SDPMessageRef { } } - pub fn get_origin(&self) -> Option<&SDPOrigin> { + pub fn origin(&self) -> Option<&SDPOrigin> { unsafe { let ptr = ffi::gst_sdp_message_get_origin(&self.0); if ptr.is_null() { @@ -401,7 +401,7 @@ impl SDPMessageRef { } } - pub fn get_session_name(&self) -> Option<&str> { + pub fn session_name(&self) -> Option<&str> { unsafe { let ptr = ffi::gst_sdp_message_get_session_name(&self.0); if ptr.is_null() { @@ -427,7 +427,7 @@ impl SDPMessageRef { } } - pub fn get_uri(&self) -> Option<&str> { + pub fn uri(&self) -> Option<&str> { unsafe { let ptr = ffi::gst_sdp_message_get_uri(&self.0); if ptr.is_null() { @@ -438,7 +438,7 @@ impl SDPMessageRef { } } - pub fn get_version(&self) -> Option<&str> { + pub fn version(&self) -> Option<&str> { unsafe { let ptr = ffi::gst_sdp_message_get_version(&self.0); if ptr.is_null() { diff --git a/gstreamer-video/src/functions.rs b/gstreamer-video/src/functions.rs index a2d1e8820..44b9e5694 100644 --- a/gstreamer-video/src/functions.rs +++ b/gstreamer-video/src/functions.rs @@ -263,9 +263,9 @@ mod tests { let res = res_store.lock().unwrap().take().unwrap(); let res = res.unwrap(); - let converted_out_caps = res.get_caps().unwrap(); + let converted_out_caps = res.caps().unwrap(); assert_eq!(out_caps.as_ref(), converted_out_caps); - let out_buffer = res.get_buffer().unwrap(); + let out_buffer = res.buffer().unwrap(); { let data = out_buffer.map_readable().unwrap(); diff --git a/gstreamer-video/src/subclass/video_decoder.rs b/gstreamer-video/src/subclass/video_decoder.rs index c037ee089..734715040 100644 --- a/gstreamer-video/src/subclass/video_decoder.rs +++ b/gstreamer-video/src/subclass/video_decoder.rs @@ -171,7 +171,7 @@ impl VideoDecoderImplExt for T { fn parent_open(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; (*parent_class) .open .map(|f| { @@ -195,7 +195,7 @@ impl VideoDecoderImplExt for T { fn parent_close(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; (*parent_class) .close .map(|f| { @@ -219,7 +219,7 @@ impl VideoDecoderImplExt for T { fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; (*parent_class) .start .map(|f| { @@ -243,7 +243,7 @@ impl VideoDecoderImplExt for T { fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; (*parent_class) .stop .map(|f| { @@ -267,7 +267,7 @@ impl VideoDecoderImplExt for T { fn parent_finish(&self, element: &Self::Type) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; (*parent_class) .finish .map(|f| { @@ -284,7 +284,7 @@ impl VideoDecoderImplExt for T { fn parent_drain(&self, element: &Self::Type) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; (*parent_class) .drain .map(|f| { @@ -305,7 +305,7 @@ impl VideoDecoderImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; (*parent_class) .set_format .map(|f| { @@ -331,7 +331,7 @@ impl VideoDecoderImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; (*parent_class) .parse .map(|f| { @@ -354,7 +354,7 @@ impl VideoDecoderImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; (*parent_class) .handle_frame .map(|f| { @@ -371,7 +371,7 @@ impl VideoDecoderImplExt for T { fn parent_flush(&self, element: &Self::Type) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; (*parent_class) .flush .map(|f| { @@ -387,7 +387,7 @@ impl VideoDecoderImplExt for T { fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; (*parent_class) .negotiate .map(|f| { @@ -404,7 +404,7 @@ impl VideoDecoderImplExt for T { fn parent_get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; (*parent_class) .getcaps .map(|f| { @@ -424,7 +424,7 @@ impl VideoDecoderImplExt for T { fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; let f = (*parent_class) .sink_event .expect("Missing parent function `sink_event`"); @@ -438,7 +438,7 @@ impl VideoDecoderImplExt for T { fn parent_sink_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; let f = (*parent_class) .sink_query .expect("Missing parent function `sink_query`"); @@ -452,7 +452,7 @@ impl VideoDecoderImplExt for T { fn parent_src_event(&self, element: &Self::Type, event: gst::Event) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; let f = (*parent_class) .src_event .expect("Missing parent function `src_event`"); @@ -466,7 +466,7 @@ impl VideoDecoderImplExt for T { fn parent_src_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; let f = (*parent_class) .src_query .expect("Missing parent function `src_query`"); @@ -484,7 +484,7 @@ impl VideoDecoderImplExt for T { ) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; (*parent_class) .propose_allocation .map(|f| { @@ -511,7 +511,7 @@ impl VideoDecoderImplExt for T { ) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoDecoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoDecoderClass; (*parent_class) .decide_allocation .map(|f| { @@ -565,7 +565,7 @@ unsafe extern "C" fn video_decoder_open( ptr: *mut ffi::GstVideoDecoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -584,7 +584,7 @@ unsafe extern "C" fn video_decoder_close( ptr: *mut ffi::GstVideoDecoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -603,7 +603,7 @@ unsafe extern "C" fn video_decoder_start( ptr: *mut ffi::GstVideoDecoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -622,7 +622,7 @@ unsafe extern "C" fn video_decoder_stop( ptr: *mut ffi::GstVideoDecoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -641,7 +641,7 @@ unsafe extern "C" fn video_decoder_finish( ptr: *mut ffi::GstVideoDecoder, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { @@ -654,7 +654,7 @@ unsafe extern "C" fn video_decoder_drain( ptr: *mut ffi::GstVideoDecoder, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { @@ -668,7 +668,7 @@ unsafe extern "C" fn video_decoder_set_format( state: *mut ffi::GstVideoCodecState, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); ffi::gst_video_codec_state_ref(state); let wrap_state = VideoCodecState::::new(state); @@ -692,7 +692,7 @@ unsafe extern "C" fn video_decoder_parse( at_eos: glib::ffi::gboolean, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); ffi::gst_video_codec_frame_ref(frame); let wrap_frame = VideoCodecFrame::new(frame, &*wrap); @@ -711,7 +711,7 @@ unsafe extern "C" fn video_decoder_handle_frame( frame: *mut ffi::GstVideoCodecFrame, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let wrap_frame = VideoCodecFrame::new(frame, &*wrap); @@ -725,7 +725,7 @@ unsafe extern "C" fn video_decoder_flush( ptr: *mut ffi::GstVideoDecoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -738,7 +738,7 @@ unsafe extern "C" fn video_decoder_negotiate( ptr: *mut ffi::GstVideoDecoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -758,7 +758,7 @@ unsafe extern "C" fn video_decoder_getcaps( filter: *mut gst::ffi::GstCaps, ) -> *mut gst::ffi::GstCaps { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { @@ -778,7 +778,7 @@ unsafe extern "C" fn video_decoder_sink_event( event: *mut gst::ffi::GstEvent, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -792,7 +792,7 @@ unsafe extern "C" fn video_decoder_sink_query( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -806,7 +806,7 @@ unsafe extern "C" fn video_decoder_src_event( event: *mut gst::ffi::GstEvent, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -820,7 +820,7 @@ unsafe extern "C" fn video_decoder_src_query( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -834,7 +834,7 @@ unsafe extern "C" fn video_decoder_propose_allocation( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); @@ -855,7 +855,7 @@ unsafe extern "C" fn video_decoder_decide_allocation( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); diff --git a/gstreamer-video/src/subclass/video_encoder.rs b/gstreamer-video/src/subclass/video_encoder.rs index 5284b4f3d..67e4bc54a 100644 --- a/gstreamer-video/src/subclass/video_encoder.rs +++ b/gstreamer-video/src/subclass/video_encoder.rs @@ -147,7 +147,7 @@ impl VideoEncoderImplExt for T { fn parent_open(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; (*parent_class) .open .map(|f| { @@ -171,7 +171,7 @@ impl VideoEncoderImplExt for T { fn parent_close(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; (*parent_class) .close .map(|f| { @@ -195,7 +195,7 @@ impl VideoEncoderImplExt for T { fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; (*parent_class) .start .map(|f| { @@ -219,7 +219,7 @@ impl VideoEncoderImplExt for T { fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; (*parent_class) .stop .map(|f| { @@ -243,7 +243,7 @@ impl VideoEncoderImplExt for T { fn parent_finish(&self, element: &Self::Type) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; (*parent_class) .finish .map(|f| { @@ -264,7 +264,7 @@ impl VideoEncoderImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; (*parent_class) .set_format .map(|f| { @@ -288,7 +288,7 @@ impl VideoEncoderImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; (*parent_class) .handle_frame .map(|f| { @@ -305,7 +305,7 @@ impl VideoEncoderImplExt for T { fn parent_flush(&self, element: &Self::Type) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; (*parent_class) .flush .map(|f| { @@ -321,7 +321,7 @@ impl VideoEncoderImplExt for T { fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; (*parent_class) .negotiate .map(|f| { @@ -338,7 +338,7 @@ impl VideoEncoderImplExt for T { fn parent_get_caps(&self, element: &Self::Type, filter: Option<&gst::Caps>) -> gst::Caps { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; (*parent_class) .getcaps .map(|f| { @@ -358,7 +358,7 @@ impl VideoEncoderImplExt for T { fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; let f = (*parent_class) .sink_event .expect("Missing parent function `sink_event`"); @@ -372,7 +372,7 @@ impl VideoEncoderImplExt for T { fn parent_sink_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; let f = (*parent_class) .sink_query .expect("Missing parent function `sink_query`"); @@ -386,7 +386,7 @@ impl VideoEncoderImplExt for T { fn parent_src_event(&self, element: &Self::Type, event: gst::Event) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; let f = (*parent_class) .src_event .expect("Missing parent function `src_event`"); @@ -400,7 +400,7 @@ impl VideoEncoderImplExt for T { fn parent_src_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; let f = (*parent_class) .src_query .expect("Missing parent function `src_query`"); @@ -418,7 +418,7 @@ impl VideoEncoderImplExt for T { ) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; (*parent_class) .propose_allocation .map(|f| { @@ -445,7 +445,7 @@ impl VideoEncoderImplExt for T { ) -> Result<(), gst::ErrorMessage> { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoEncoderClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoEncoderClass; (*parent_class) .decide_allocation .map(|f| { @@ -497,7 +497,7 @@ unsafe extern "C" fn video_encoder_open( ptr: *mut ffi::GstVideoEncoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -516,7 +516,7 @@ unsafe extern "C" fn video_encoder_close( ptr: *mut ffi::GstVideoEncoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -535,7 +535,7 @@ unsafe extern "C" fn video_encoder_start( ptr: *mut ffi::GstVideoEncoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -554,7 +554,7 @@ unsafe extern "C" fn video_encoder_stop( ptr: *mut ffi::GstVideoEncoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -573,7 +573,7 @@ unsafe extern "C" fn video_encoder_finish( ptr: *mut ffi::GstVideoEncoder, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { @@ -587,7 +587,7 @@ unsafe extern "C" fn video_encoder_set_format( state: *mut ffi::GstVideoCodecState, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); ffi::gst_video_codec_state_ref(state); let wrap_state = VideoCodecState::::new(state); @@ -609,7 +609,7 @@ unsafe extern "C" fn video_encoder_handle_frame( frame: *mut ffi::GstVideoCodecFrame, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let wrap_frame = VideoCodecFrame::new(frame, &*wrap); @@ -623,7 +623,7 @@ unsafe extern "C" fn video_encoder_flush( ptr: *mut ffi::GstVideoEncoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -636,7 +636,7 @@ unsafe extern "C" fn video_encoder_negotiate( ptr: *mut ffi::GstVideoEncoder, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -656,7 +656,7 @@ unsafe extern "C" fn video_encoder_getcaps( filter: *mut gst::ffi::GstCaps, ) -> *mut gst::ffi::GstCaps { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { @@ -676,7 +676,7 @@ unsafe extern "C" fn video_encoder_sink_event( event: *mut gst::ffi::GstEvent, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -690,7 +690,7 @@ unsafe extern "C" fn video_encoder_sink_query( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -704,7 +704,7 @@ unsafe extern "C" fn video_encoder_src_event( event: *mut gst::ffi::GstEvent, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -718,7 +718,7 @@ unsafe extern "C" fn video_encoder_src_query( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); gst::panic_to_error!(&wrap, &imp.panicked(), false, { @@ -732,7 +732,7 @@ unsafe extern "C" fn video_encoder_propose_allocation( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); @@ -753,7 +753,7 @@ unsafe extern "C" fn video_encoder_decide_allocation( query: *mut gst::ffi::GstQuery, ) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let query = gst::QueryRef::from_mut_ptr(query); diff --git a/gstreamer-video/src/subclass/video_sink.rs b/gstreamer-video/src/subclass/video_sink.rs index 6ea1136b4..90a9d503f 100644 --- a/gstreamer-video/src/subclass/video_sink.rs +++ b/gstreamer-video/src/subclass/video_sink.rs @@ -35,7 +35,7 @@ impl VideoSinkImplExt for T { ) -> Result { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstVideoSinkClass; + let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoSinkClass; (*parent_class) .show_frame .map(|f| { @@ -67,7 +67,7 @@ unsafe extern "C" fn video_sink_show_frame( buffer: *mut gst::ffi::GstBuffer, ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); - let imp = instance.get_impl(); + let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); let buffer = from_glib_borrow(buffer); diff --git a/gstreamer-video/src/utils.rs b/gstreamer-video/src/utils.rs index 91fdeff60..ffc783efe 100644 --- a/gstreamer-video/src/utils.rs +++ b/gstreamer-video/src/utils.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. pub trait HasStreamLock { - fn get_stream_lock(&self) -> *mut glib::ffi::GRecMutex; - fn get_element_as_ptr(&self) -> *const gst::ffi::GstElement; + fn stream_lock(&self) -> *mut glib::ffi::GRecMutex; + fn element_as_ptr(&self) -> *const gst::ffi::GstElement; } diff --git a/gstreamer-video/src/video_buffer_pool.rs b/gstreamer-video/src/video_buffer_pool.rs index cc057b64a..b1ff3c8fe 100644 --- a/gstreamer-video/src/video_buffer_pool.rs +++ b/gstreamer-video/src/video_buffer_pool.rs @@ -34,19 +34,19 @@ pub static BUFFER_POOL_OPTION_VIDEO_META: Lazy<&'static str> = Lazy::new(|| unsa pub struct VideoAlignment(pub(crate) ffi::GstVideoAlignment); impl VideoAlignment { - pub fn get_padding_top(&self) -> u32 { + pub fn padding_top(&self) -> u32 { self.0.padding_top } - pub fn get_padding_bottom(&self) -> u32 { + pub fn padding_bottom(&self) -> u32 { self.0.padding_bottom } - pub fn get_padding_left(&self) -> u32 { + pub fn padding_left(&self) -> u32 { self.0.padding_left } - pub fn get_padding_right(&self) -> u32 { + pub fn padding_right(&self) -> u32 { self.0.padding_right } - pub fn get_stride_align(&self) -> &[u32; ffi::GST_VIDEO_MAX_PLANES as usize] { + pub fn stride_align(&self) -> &[u32; ffi::GST_VIDEO_MAX_PLANES as usize] { &self.0.stride_align } @@ -73,24 +73,24 @@ impl VideoAlignment { impl PartialEq for VideoAlignment { fn eq(&self, other: &VideoAlignment) -> bool { - self.get_padding_top() == other.get_padding_top() - && self.get_padding_bottom() == other.get_padding_bottom() - && self.get_padding_left() == other.get_padding_left() - && self.get_padding_right() == other.get_padding_right() - && self.get_stride_align() == other.get_stride_align() + self.padding_top() == other.padding_top() + && self.padding_bottom() == other.padding_bottom() + && self.padding_left() == other.padding_left() + && self.padding_right() == other.padding_right() + && self.stride_align() == other.stride_align() } } impl Eq for VideoAlignment {} pub trait VideoBufferPoolConfig { - fn get_video_alignment(&self) -> Option; + fn video_alignment(&self) -> Option; fn set_video_alignment(&mut self, align: &VideoAlignment); } impl VideoBufferPoolConfig for gst::BufferPoolConfig { - fn get_video_alignment(&self) -> Option { + fn video_alignment(&self) -> Option { unsafe { let mut alignment = mem::MaybeUninit::zeroed(); let ret = from_glib(ffi::gst_buffer_pool_config_get_video_alignment( diff --git a/gstreamer-video/src/video_codec_frame.rs b/gstreamer-video/src/video_codec_frame.rs index 7e700bdfd..ddd2474d3 100644 --- a/gstreamer-video/src/video_codec_frame.rs +++ b/gstreamer-video/src/video_codec_frame.rs @@ -30,20 +30,20 @@ impl<'a> fmt::Debug for VideoCodecFrame<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut b = f.debug_struct("VideoCodecFrame"); - b.field("flags", &self.get_flags()) - .field("system_frame_number", &self.get_system_frame_number()) - .field("decode_frame_number", &self.get_decode_frame_number()) + b.field("flags", &self.flags()) + .field("system_frame_number", &self.system_frame_number()) + .field("decode_frame_number", &self.decode_frame_number()) .field( "presentation_frame_number", - &self.get_presentation_frame_number(), + &self.presentation_frame_number(), ) - .field("dts", &self.get_dts()) - .field("pts", &self.get_pts()) - .field("duration", &self.get_duration()) - .field("distance_from_sync", &self.get_distance_from_sync()) - .field("input_buffer", &self.get_input_buffer()) - .field("output_buffer", &self.get_output_buffer()) - .field("deadline", &self.get_deadline()); + .field("dts", &self.dts()) + .field("pts", &self.pts()) + .field("duration", &self.duration()) + .field("distance_from_sync", &self.distance_from_sync()) + .field("input_buffer", &self.input_buffer()) + .field("output_buffer", &self.output_buffer()) + .field("deadline", &self.deadline()); b.finish() } @@ -56,12 +56,12 @@ impl<'a> VideoCodecFrame<'a> { element: &'a T, ) -> Self { skip_assert_initialized!(); - let stream_lock = element.get_stream_lock(); + let stream_lock = element.stream_lock(); glib::ffi::g_rec_mutex_lock(stream_lock); Self { frame, element } } - pub fn get_flags(&self) -> VideoCodecFrameFlags { + pub fn flags(&self) -> VideoCodecFrameFlags { let flags = unsafe { (*self.to_glib_none().0).flags }; VideoCodecFrameFlags::from_bits_truncate(flags) } @@ -74,19 +74,19 @@ impl<'a> VideoCodecFrame<'a> { unsafe { (*self.to_glib_none().0).flags &= !flags.bits() } } - pub fn get_system_frame_number(&self) -> u32 { + pub fn system_frame_number(&self) -> u32 { unsafe { (*self.to_glib_none().0).system_frame_number } } - pub fn get_decode_frame_number(&self) -> u32 { + pub fn decode_frame_number(&self) -> u32 { unsafe { (*self.to_glib_none().0).decode_frame_number } } - pub fn get_presentation_frame_number(&self) -> u32 { + pub fn presentation_frame_number(&self) -> u32 { unsafe { (*self.to_glib_none().0).presentation_frame_number } } - pub fn get_dts(&self) -> gst::ClockTime { + pub fn dts(&self) -> gst::ClockTime { unsafe { from_glib((*self.to_glib_none().0).dts) } } @@ -96,7 +96,7 @@ impl<'a> VideoCodecFrame<'a> { } } - pub fn get_pts(&self) -> gst::ClockTime { + pub fn pts(&self) -> gst::ClockTime { unsafe { from_glib((*self.to_glib_none().0).pts) } } @@ -106,7 +106,7 @@ impl<'a> VideoCodecFrame<'a> { } } - pub fn get_duration(&self) -> gst::ClockTime { + pub fn duration(&self) -> gst::ClockTime { unsafe { from_glib((*self.to_glib_none().0).duration) } } @@ -116,11 +116,11 @@ impl<'a> VideoCodecFrame<'a> { } } - pub fn get_distance_from_sync(&self) -> i32 { + pub fn distance_from_sync(&self) -> i32 { unsafe { (*self.to_glib_none().0).distance_from_sync } } - pub fn get_input_buffer(&self) -> Option<&gst::BufferRef> { + pub fn input_buffer(&self) -> Option<&gst::BufferRef> { unsafe { let ptr = (*self.to_glib_none().0).input_buffer; if ptr.is_null() { @@ -131,7 +131,7 @@ impl<'a> VideoCodecFrame<'a> { } } - pub fn get_output_buffer(&self) -> Option<&gst::BufferRef> { + pub fn output_buffer(&self) -> Option<&gst::BufferRef> { unsafe { let ptr = (*self.to_glib_none().0).output_buffer; if ptr.is_null() { @@ -142,7 +142,7 @@ impl<'a> VideoCodecFrame<'a> { } } - pub fn get_output_buffer_mut(&mut self) -> Option<&mut gst::BufferRef> { + pub fn output_buffer_mut(&mut self) -> Option<&mut gst::BufferRef> { unsafe { let ptr = (*self.to_glib_none().0).output_buffer; if ptr.is_null() { @@ -176,13 +176,13 @@ impl<'a> VideoCodecFrame<'a> { } } - pub fn get_deadline(&self) -> gst::ClockTime { + pub fn deadline(&self) -> gst::ClockTime { unsafe { from_glib((*self.to_glib_none().0).deadline) } } #[doc(hidden)] pub unsafe fn into_ptr(self) -> *mut ffi::GstVideoCodecFrame { - let stream_lock = self.element.get_stream_lock(); + let stream_lock = self.element.stream_lock(); glib::ffi::g_rec_mutex_unlock(stream_lock); let s = mem::ManuallyDrop::new(self); @@ -193,7 +193,7 @@ impl<'a> VideoCodecFrame<'a> { impl<'a> Drop for VideoCodecFrame<'a> { fn drop(&mut self) { unsafe { - let stream_lock = self.element.get_stream_lock(); + let stream_lock = self.element.stream_lock(); glib::ffi::g_rec_mutex_unlock(stream_lock); ffi::gst_video_codec_frame_unref(self.frame); diff --git a/gstreamer-video/src/video_codec_state.rs b/gstreamer-video/src/video_codec_state.rs index 95f721793..65e9027ab 100644 --- a/gstreamer-video/src/video_codec_state.rs +++ b/gstreamer-video/src/video_codec_state.rs @@ -9,8 +9,8 @@ use std::ptr; use crate::video_info::VideoInfo; pub trait VideoCodecStateContext<'a> { - fn get_element(&self) -> Option<&'a dyn HasStreamLock>; - fn get_element_as_ptr(&self) -> *const gst::ffi::GstElement; + fn element(&self) -> Option<&'a dyn HasStreamLock>; + fn element_as_ptr(&self) -> *const gst::ffi::GstElement; } pub struct InNegotiation<'a> { @@ -21,21 +21,21 @@ pub struct InNegotiation<'a> { pub struct Readable {} impl<'a> VideoCodecStateContext<'a> for InNegotiation<'a> { - fn get_element(&self) -> Option<&'a dyn HasStreamLock> { + fn element(&self) -> Option<&'a dyn HasStreamLock> { Some(self.element) } - fn get_element_as_ptr(&self) -> *const gst::ffi::GstElement { - self.element.get_element_as_ptr() + fn element_as_ptr(&self) -> *const gst::ffi::GstElement { + self.element.element_as_ptr() } } impl<'a> VideoCodecStateContext<'a> for Readable { - fn get_element(&self) -> Option<&'a dyn HasStreamLock> { + fn element(&self) -> Option<&'a dyn HasStreamLock> { None } - fn get_element_as_ptr(&self) -> *const gst::ffi::GstElement { + fn element_as_ptr(&self) -> *const gst::ffi::GstElement { ptr::null() } } @@ -49,10 +49,10 @@ pub struct VideoCodecState<'a, T: VideoCodecStateContext<'a>> { impl<'a, T: VideoCodecStateContext<'a>> fmt::Debug for VideoCodecState<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("VideoCodecState") - .field("info", &self.get_info()) - .field("caps", &self.get_caps()) - .field("codec_data", &self.get_codec_data()) - .field("allocation_caps", &self.get_allocation_caps()) + .field("info", &self.info()) + .field("caps", &self.caps()) + .field("codec_data", &self.codec_data()) + .field("allocation_caps", &self.allocation_caps()) .finish() } } @@ -76,7 +76,7 @@ impl<'a> VideoCodecState<'a, InNegotiation<'a>> { element: &'a T, ) -> Self { skip_assert_initialized!(); - let stream_lock = element.get_stream_lock(); + let stream_lock = element.stream_lock(); glib::ffi::g_rec_mutex_lock(stream_lock); Self { state, @@ -87,14 +87,14 @@ impl<'a> VideoCodecState<'a, InNegotiation<'a>> { } impl<'a, T: VideoCodecStateContext<'a>> VideoCodecState<'a, T> { - pub fn get_info(&self) -> VideoInfo { + pub fn info(&self) -> VideoInfo { unsafe { let ptr = &((*self.as_mut_ptr()).info) as *const _ as usize as *mut _; VideoInfo::from_glib_none(ptr) } } - pub fn get_caps(&self) -> Option<&gst::CapsRef> { + pub fn caps(&self) -> Option<&gst::CapsRef> { unsafe { let ptr = (*self.as_mut_ptr()).caps; @@ -106,7 +106,7 @@ impl<'a, T: VideoCodecStateContext<'a>> VideoCodecState<'a, T> { } } - pub fn get_codec_data(&self) -> Option<&gst::BufferRef> { + pub fn codec_data(&self) -> Option<&gst::BufferRef> { unsafe { let ptr = (*self.as_mut_ptr()).codec_data; @@ -118,7 +118,7 @@ impl<'a, T: VideoCodecStateContext<'a>> VideoCodecState<'a, T> { } } - pub fn get_allocation_caps(&self) -> Option<&gst::CapsRef> { + pub fn allocation_caps(&self) -> Option<&gst::CapsRef> { unsafe { let ptr = (*self.as_mut_ptr()).allocation_caps; @@ -138,8 +138,8 @@ impl<'a, T: VideoCodecStateContext<'a>> VideoCodecState<'a, T> { impl<'a, T: VideoCodecStateContext<'a>> Drop for VideoCodecState<'a, T> { fn drop(&mut self) { unsafe { - if let Some(element) = self.context.get_element() { - let stream_lock = element.get_stream_lock(); + if let Some(element) = self.context.element() { + let stream_lock = element.stream_lock(); glib::ffi::g_rec_mutex_unlock(stream_lock); } ffi::gst_video_codec_state_unref(self.state); diff --git a/gstreamer-video/src/video_color_matrix.rs b/gstreamer-video/src/video_color_matrix.rs index cb5718020..ae5e03eb9 100644 --- a/gstreamer-video/src/video_color_matrix.rs +++ b/gstreamer-video/src/video_color_matrix.rs @@ -5,7 +5,7 @@ use std::mem; use glib::translate::ToGlib; impl crate::VideoColorMatrix { - pub fn get_kr_kb(&self) -> Result<(f64, f64), glib::BoolError> { + pub fn kr_kb(&self) -> Result<(f64, f64), glib::BoolError> { assert_initialized_main_thread!(); unsafe { let mut kr = mem::MaybeUninit::uninit(); diff --git a/gstreamer-video/src/video_converter.rs b/gstreamer-video/src/video_converter.rs index a621999f3..ca27eb249 100644 --- a/gstreamer-video/src/video_converter.rs +++ b/gstreamer-video/src/video_converter.rs @@ -49,7 +49,7 @@ impl VideoConverter { } } - pub fn get_config(&self) -> VideoConverterConfig { + pub fn config(&self) -> VideoConverterConfig { unsafe { VideoConverterConfig( gst::StructureRef::from_glib_borrow(ffi::gst_video_converter_get_config( @@ -127,7 +127,7 @@ impl convert::TryFrom for VideoConverterConfig { fn try_from(v: gst::Structure) -> Result { skip_assert_initialized!(); - if v.get_name() == "GstVideoConverter" { + if v.name() == "GstVideoConverter" { Ok(VideoConverterConfig(v)) } else { Err(glib::bool_error!("Structure is no VideoConverterConfig")) @@ -160,7 +160,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.resampler-method", &v); } - pub fn get_resampler_method(&self) -> crate::VideoResamplerMethod { + pub fn resampler_method(&self) -> crate::VideoResamplerMethod { self.0 .get_optional("GstVideoConverter.resampler-method") .expect("Wrong type") @@ -171,7 +171,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.chroma-resampler-method", &v); } - pub fn get_chroma_resampler_method(&self) -> crate::VideoResamplerMethod { + pub fn chroma_resampler_method(&self) -> crate::VideoResamplerMethod { self.0 .get_optional("GstVideoConverter.chroma-resampler-method") .expect("Wrong type") @@ -182,7 +182,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.resampler-taps", &v); } - pub fn get_resampler_taps(&self) -> u32 { + pub fn resampler_taps(&self) -> u32 { self.0 .get_optional("GstVideoConverter.resampler-taps") .expect("Wrong type") @@ -193,7 +193,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.dither-method", &v); } - pub fn get_dither_method(&self) -> crate::VideoDitherMethod { + pub fn dither_method(&self) -> crate::VideoDitherMethod { self.0 .get_optional("GstVideoConverter.dither-method") .expect("Wrong type") @@ -204,7 +204,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.dither-quantization", &v); } - pub fn get_dither_quantization(&self) -> u32 { + pub fn dither_quantization(&self) -> u32 { self.0 .get_optional("GstVideoConverter.dither-quantization") .expect("Wrong type") @@ -215,7 +215,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.src-x", &v); } - pub fn get_src_x(&self) -> i32 { + pub fn src_x(&self) -> i32 { self.0 .get_optional("GstVideoConverter.src-x") .expect("Wrong type") @@ -226,7 +226,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.src-y", &v); } - pub fn get_src_y(&self) -> i32 { + pub fn src_y(&self) -> i32 { self.0 .get_optional("GstVideoConverter.src-y") .expect("Wrong type") @@ -241,7 +241,7 @@ impl VideoConverterConfig { } } - pub fn get_src_width(&self) -> Option { + pub fn src_width(&self) -> Option { self.0 .get_optional("GstVideoConverter.src-width") .expect("Wrong type") @@ -255,7 +255,7 @@ impl VideoConverterConfig { } } - pub fn get_src_height(&self) -> Option { + pub fn src_height(&self) -> Option { self.0 .get_optional("GstVideoConverter.src-height") .expect("Wrong type") @@ -265,7 +265,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.dest-x", &v); } - pub fn get_dest_x(&self) -> i32 { + pub fn dest_x(&self) -> i32 { self.0 .get_optional("GstVideoConverter.dest-x") .expect("Wrong type") @@ -276,7 +276,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.dest-y", &v); } - pub fn get_dest_y(&self) -> i32 { + pub fn dest_y(&self) -> i32 { self.0 .get_optional("GstVideoConverter.dest-y") .expect("Wrong type") @@ -291,7 +291,7 @@ impl VideoConverterConfig { } } - pub fn get_dest_width(&self) -> Option { + pub fn dest_width(&self) -> Option { self.0 .get_optional("GstVideoConverter.dest-width") .expect("Wrong type") @@ -305,7 +305,7 @@ impl VideoConverterConfig { } } - pub fn get_dest_height(&self) -> Option { + pub fn dest_height(&self) -> Option { self.0 .get_optional("GstVideoConverter.dest-height") .expect("Wrong type") @@ -315,7 +315,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.fill-border", &v); } - pub fn get_fill_border(&self) -> bool { + pub fn fills_border(&self) -> bool { self.0 .get_optional("GstVideoConverter.fill-border") .expect("Wrong type") @@ -326,7 +326,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.alpha-value", &v); } - pub fn get_alpha_value(&self) -> f64 { + pub fn alpha_value(&self) -> f64 { self.0 .get_optional("GstVideoConverter.alpha-value") .expect("Wrong type") @@ -337,7 +337,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.alpha-mode", &v); } - pub fn get_alpha_mode(&self) -> crate::VideoAlphaMode { + pub fn alpha_mode(&self) -> crate::VideoAlphaMode { self.0 .get_optional("GstVideoConverter.alpha-mode") .expect("Wrong type") @@ -348,7 +348,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.border-argb", &v); } - pub fn get_border_argb(&self) -> u32 { + pub fn border_argb(&self) -> u32 { self.0 .get_optional("GstVideoConverter.border-argb") .expect("Wrong type") @@ -359,7 +359,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.chroma-mode", &v); } - pub fn get_chroma_mode(&self) -> crate::VideoChromaMode { + pub fn chroma_mode(&self) -> crate::VideoChromaMode { self.0 .get_optional("GstVideoConverter.chroma-mode") .expect("Wrong type") @@ -370,7 +370,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.matrix-mode", &v); } - pub fn get_matrix_mode(&self) -> crate::VideoMatrixMode { + pub fn matrix_mode(&self) -> crate::VideoMatrixMode { self.0 .get_optional("GstVideoConverter.matrix-mode") .expect("Wrong type") @@ -381,7 +381,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.gamma-mode", &v); } - pub fn get_gamma_mode(&self) -> crate::VideoGammaMode { + pub fn gamma_mode(&self) -> crate::VideoGammaMode { self.0 .get_optional("GstVideoConverter.gamma-mode") .expect("Wrong type") @@ -392,7 +392,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.primaries-mode", &v); } - pub fn get_primaries_mode(&self) -> crate::VideoPrimariesMode { + pub fn primaries_mode(&self) -> crate::VideoPrimariesMode { self.0 .get_optional("GstVideoConverter.primaries-mode") .expect("Wrong type") @@ -403,7 +403,7 @@ impl VideoConverterConfig { self.0.set("GstVideoConverter.threads", &v); } - pub fn get_threads(&self) -> u32 { + pub fn threads(&self) -> u32 { self.0 .get_optional("GstVideoConverter.threads") .expect("Wrong type") diff --git a/gstreamer-video/src/video_decoder.rs b/gstreamer-video/src/video_decoder.rs index 7d6badd57..ce7fd2e5c 100644 --- a/gstreamer-video/src/video_decoder.rs +++ b/gstreamer-video/src/video_decoder.rs @@ -37,20 +37,20 @@ pub trait VideoDecoderExtManual: 'static { ) -> Result; fn get_frame(&self, frame_number: i32) -> Option; - fn get_frames(&self) -> Vec; - fn get_oldest_frame(&self) -> Option; + fn frames(&self) -> Vec; + fn oldest_frame(&self) -> Option; - fn get_allocator(&self) -> (Option, gst::AllocationParams); + fn allocator(&self) -> (Option, gst::AllocationParams); fn have_frame(&self) -> Result; fn finish_frame(&self, frame: VideoCodecFrame) -> Result; fn release_frame(&self, frame: VideoCodecFrame); fn drop_frame(&self, frame: VideoCodecFrame) -> Result; - fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime); + fn latency(&self) -> (gst::ClockTime, gst::ClockTime); fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime); - fn get_output_state(&self) -> Option>; + fn output_state(&self) -> Option>; fn set_output_state( &self, fmt: VideoFormat, @@ -106,7 +106,7 @@ impl> VideoDecoderExtManual for O { ret.into_result() } - fn get_allocator(&self) -> (Option, gst::AllocationParams) { + fn allocator(&self) -> (Option, gst::AllocationParams) { unsafe { let mut allocator = ptr::null_mut(); let mut params = mem::zeroed(); @@ -154,7 +154,7 @@ impl> VideoDecoderExtManual for O { ret.into_result() } - fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime) { + fn latency(&self) -> (gst::ClockTime, gst::ClockTime) { let mut min_latency = gst::ffi::GST_CLOCK_TIME_NONE; let mut max_latency = gst::ffi::GST_CLOCK_TIME_NONE; @@ -191,7 +191,7 @@ impl> VideoDecoderExtManual for O { } } - fn get_frames(&self) -> Vec { + fn frames(&self) -> Vec { unsafe { let frames = ffi::gst_video_decoder_get_frames(self.as_ref().to_glib_none().0); let mut iter: *const glib::ffi::GList = frames; @@ -210,7 +210,7 @@ impl> VideoDecoderExtManual for O { } } - fn get_oldest_frame(&self) -> Option { + fn oldest_frame(&self) -> Option { let frame = unsafe { ffi::gst_video_decoder_get_oldest_frame(self.as_ref().to_glib_none().0) }; @@ -221,7 +221,7 @@ impl> VideoDecoderExtManual for O { } } - fn get_output_state(&self) -> Option> { + fn output_state(&self) -> Option> { let state = unsafe { ffi::gst_video_decoder_get_output_state(self.as_ref().to_glib_none().0) }; @@ -298,7 +298,7 @@ impl> VideoDecoderExtManual for O { ) -> Result<(), gst::FlowError> { // Consume output_state so user won't be able to modify it anymore let self_ptr = self.to_glib_none().0 as *const gst::ffi::GstElement; - assert_eq!(output_state.context.get_element_as_ptr(), self_ptr); + assert_eq!(output_state.context.element_as_ptr(), self_ptr); let ret = unsafe { from_glib(ffi::gst_video_decoder_negotiate( @@ -339,12 +339,12 @@ impl> VideoDecoderExtManual for O { } impl HasStreamLock for VideoDecoder { - fn get_stream_lock(&self) -> *mut glib::ffi::GRecMutex { + fn stream_lock(&self) -> *mut glib::ffi::GRecMutex { let decoder_sys: *const ffi::GstVideoDecoder = self.to_glib_none().0; unsafe { &(*decoder_sys).stream_lock as *const _ as usize as *mut _ } } - fn get_element_as_ptr(&self) -> *const gst::ffi::GstElement { + fn element_as_ptr(&self) -> *const gst::ffi::GstElement { let decoder_sys: *const ffi::GstVideoDecoder = self.to_glib_none().0; decoder_sys as *const gst::ffi::GstElement } diff --git a/gstreamer-video/src/video_encoder.rs b/gstreamer-video/src/video_encoder.rs index db26ce455..37ab89a34 100644 --- a/gstreamer-video/src/video_encoder.rs +++ b/gstreamer-video/src/video_encoder.rs @@ -19,10 +19,10 @@ pub trait VideoEncoderExtManual: 'static { ) -> Result; fn get_frame(&self, frame_number: i32) -> Option; - fn get_frames(&self) -> Vec; - fn get_oldest_frame(&self) -> Option; + fn frames(&self) -> Vec; + fn oldest_frame(&self) -> Option; - fn get_allocator(&self) -> (Option, gst::AllocationParams); + fn allocator(&self) -> (Option, gst::AllocationParams); fn finish_frame( &self, @@ -33,10 +33,10 @@ pub trait VideoEncoderExtManual: 'static { #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] fn finish_subframe(&self, frame: &VideoCodecFrame) -> Result; - fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime); + fn latency(&self) -> (gst::ClockTime, gst::ClockTime); fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime); - fn get_output_state(&self) -> Option>; + fn output_state(&self) -> Option>; fn set_output_state( &self, caps: gst::Caps, @@ -67,7 +67,7 @@ impl> VideoEncoderExtManual for O { ret.into_result() } - fn get_allocator(&self) -> (Option, gst::AllocationParams) { + fn allocator(&self) -> (Option, gst::AllocationParams) { unsafe { let mut allocator = ptr::null_mut(); let mut params = mem::zeroed(); @@ -105,7 +105,7 @@ impl> VideoEncoderExtManual for O { ret.into_result() } - fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime) { + fn latency(&self) -> (gst::ClockTime, gst::ClockTime) { let mut min_latency = gst::ffi::GST_CLOCK_TIME_NONE; let mut max_latency = gst::ffi::GST_CLOCK_TIME_NONE; @@ -142,7 +142,7 @@ impl> VideoEncoderExtManual for O { } } - fn get_frames(&self) -> Vec { + fn frames(&self) -> Vec { unsafe { let frames = ffi::gst_video_encoder_get_frames(self.as_ref().to_glib_none().0); let mut iter: *const glib::ffi::GList = frames; @@ -161,7 +161,7 @@ impl> VideoEncoderExtManual for O { } } - fn get_oldest_frame(&self) -> Option { + fn oldest_frame(&self) -> Option { let frame = unsafe { ffi::gst_video_encoder_get_oldest_frame(self.as_ref().to_glib_none().0) }; @@ -172,7 +172,7 @@ impl> VideoEncoderExtManual for O { } } - fn get_output_state(&self) -> Option> { + fn output_state(&self) -> Option> { let state = unsafe { ffi::gst_video_encoder_get_output_state(self.as_ref().to_glib_none().0) }; @@ -213,7 +213,7 @@ impl> VideoEncoderExtManual for O { ) -> Result<(), gst::FlowError> { // Consume output_state so user won't be able to modify it anymore let self_ptr = self.to_glib_none().0 as *const gst::ffi::GstElement; - assert_eq!(output_state.context.get_element_as_ptr(), self_ptr); + assert_eq!(output_state.context.element_as_ptr(), self_ptr); let ret = unsafe { from_glib(ffi::gst_video_encoder_negotiate( @@ -229,12 +229,12 @@ impl> VideoEncoderExtManual for O { } impl HasStreamLock for VideoEncoder { - fn get_stream_lock(&self) -> *mut glib::ffi::GRecMutex { + fn stream_lock(&self) -> *mut glib::ffi::GRecMutex { let encoder_sys: *const ffi::GstVideoEncoder = self.to_glib_none().0; unsafe { &(*encoder_sys).stream_lock as *const _ as usize as *mut _ } } - fn get_element_as_ptr(&self) -> *const gst::ffi::GstElement { + fn element_as_ptr(&self) -> *const gst::ffi::GstElement { let encoder_sys: *const ffi::GstVideoEncoder = self.to_glib_none().0; encoder_sys as *const gst::ffi::GstElement } diff --git a/gstreamer-video/src/video_frame.rs b/gstreamer-video/src/video_frame.rs index 62ea7ea59..50f04fda6 100644 --- a/gstreamer-video/src/video_frame.rs +++ b/gstreamer-video/src/video_frame.rs @@ -804,13 +804,13 @@ impl Drop for VideoFrameRef { } pub trait VideoBufferExt { - fn get_video_flags(&self) -> crate::VideoBufferFlags; + fn video_flags(&self) -> crate::VideoBufferFlags; fn set_video_flags(&mut self, flags: crate::VideoBufferFlags); fn unset_video_flags(&mut self, flags: crate::VideoBufferFlags); } impl VideoBufferExt for gst::BufferRef { - fn get_video_flags(&self) -> crate::VideoBufferFlags { + fn video_flags(&self) -> crate::VideoBufferFlags { unsafe { let ptr = self.as_mut_ptr(); crate::VideoBufferFlags::from_bits_truncate((*ptr).mini_object.flags) diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index e0a4fc4ec..e9f8da54c 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -749,7 +749,7 @@ impl VideoInfo { let mut dest_val = mem::MaybeUninit::uninit(); if from_glib(ffi::gst_video_info_convert( &self.0 as *const _ as *mut _, - src_val.get_format().to_glib(), + src_val.format().to_glib(), src_val.to_raw_value(), U::get_default_format().to_glib(), dest_val.as_mut_ptr(), @@ -773,7 +773,7 @@ impl VideoInfo { let mut dest_val = mem::MaybeUninit::uninit(); if from_glib(ffi::gst_video_info_convert( &self.0 as *const _ as *mut _, - src_val.get_format().to_glib(), + src_val.format().to_glib(), src_val.to_raw_value(), dest_fmt.to_glib(), dest_val.as_mut_ptr(), diff --git a/gstreamer-video/src/video_meta.rs b/gstreamer-video/src/video_meta.rs index 1c99d517d..b01b2adf7 100644 --- a/gstreamer-video/src/video_meta.rs +++ b/gstreamer-video/src/video_meta.rs @@ -32,10 +32,10 @@ impl VideoMeta { return Err(glib::bool_error!("Invalid video info")); } - if buffer.get_size() < info.size() { + if buffer.size() < info.size() { return Err(glib::bool_error!( "Buffer smaller than required frame size ({} < {})", - buffer.get_size(), + buffer.size(), info.size() )); } @@ -82,10 +82,10 @@ impl VideoMeta { return Err(glib::bool_error!("Invalid video info")); } - if buffer.get_size() < info.size() { + if buffer.size() < info.size() { return Err(glib::bool_error!( "Buffer smaller than required frame size ({} < {})", - buffer.get_size(), + buffer.size(), info.size() )); } @@ -110,41 +110,41 @@ impl VideoMeta { } } - pub fn get_flags(&self) -> crate::VideoFrameFlags { + pub fn flags(&self) -> crate::VideoFrameFlags { unsafe { from_glib(self.0.flags) } } - pub fn get_format(&self) -> crate::VideoFormat { + pub fn format(&self) -> crate::VideoFormat { unsafe { from_glib(self.0.format) } } - pub fn get_id(&self) -> i32 { + pub fn id(&self) -> i32 { self.0.id } - pub fn get_width(&self) -> u32 { + pub fn width(&self) -> u32 { self.0.width } - pub fn get_height(&self) -> u32 { + pub fn height(&self) -> u32 { self.0.height } - pub fn get_n_planes(&self) -> u32 { + pub fn n_planes(&self) -> u32 { self.0.n_planes } - pub fn get_offset(&self) -> &[usize] { + pub fn offset(&self) -> &[usize] { &self.0.offset[0..(self.0.n_planes as usize)] } - pub fn get_stride(&self) -> &[i32] { + pub fn stride(&self) -> &[i32] { &self.0.stride[0..(self.0.n_planes as usize)] } #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] - pub fn get_alignment(&self) -> crate::VideoAlignment { + pub fn alignment(&self) -> crate::VideoAlignment { crate::VideoAlignment::new( self.0.alignment.padding_top, self.0.alignment.padding_bottom, @@ -156,7 +156,7 @@ impl VideoMeta { #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] - pub fn get_plane_size(&self) -> Result<[usize; crate::VIDEO_MAX_PLANES], glib::BoolError> { + pub fn plane_size(&self) -> Result<[usize; crate::VIDEO_MAX_PLANES], glib::BoolError> { let mut plane_size = [0; crate::VIDEO_MAX_PLANES]; unsafe { @@ -174,7 +174,7 @@ impl VideoMeta { #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] - pub fn get_plane_height(&self) -> Result<[u32; crate::VIDEO_MAX_PLANES], glib::BoolError> { + pub fn plane_height(&self) -> Result<[u32; crate::VIDEO_MAX_PLANES], glib::BoolError> { let mut plane_height = [0; crate::VIDEO_MAX_PLANES]; unsafe { @@ -216,14 +216,14 @@ unsafe impl MetaAPI for VideoMeta { impl fmt::Debug for VideoMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("VideoMeta") - .field("id", &self.get_id()) - .field("flags", &self.get_flags()) - .field("format", &self.get_format()) - .field("width", &self.get_width()) - .field("height", &self.get_height()) - .field("n_planes", &self.get_n_planes()) - .field("offset", &self.get_offset()) - .field("stride", &self.get_stride()) + .field("id", &self.id()) + .field("flags", &self.flags()) + .field("format", &self.format()) + .field("width", &self.width()) + .field("height", &self.height()) + .field("n_planes", &self.n_planes()) + .field("offset", &self.offset()) + .field("stride", &self.stride()) .finish() } } @@ -259,7 +259,7 @@ impl VideoCropMeta { } } - pub fn get_rect(&self) -> (u32, u32, u32, u32) { + pub fn rect(&self) -> (u32, u32, u32, u32) { (self.0.x, self.0.y, self.0.width, self.0.height) } @@ -282,7 +282,7 @@ unsafe impl MetaAPI for VideoCropMeta { impl fmt::Debug for VideoCropMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("VideoCropMeta") - .field("rect", &self.get_rect()) + .field("rect", &self.rect()) .finish() } } @@ -314,24 +314,24 @@ impl VideoRegionOfInterestMeta { } } - pub fn get_rect(&self) -> (u32, u32, u32, u32) { + pub fn rect(&self) -> (u32, u32, u32, u32) { (self.0.x, self.0.y, self.0.w, self.0.h) } - pub fn get_id(&self) -> i32 { + pub fn id(&self) -> i32 { self.0.id } - pub fn get_parent_id(&self) -> i32 { + pub fn parent_id(&self) -> i32 { self.0.parent_id } - pub fn get_roi_type<'a>(&self) -> &'a str { + pub fn roi_type<'a>(&self) -> &'a str { unsafe { glib::Quark::from_glib(self.0.roi_type).to_string() } } #[cfg(feature = "v1_14")] - pub fn get_params(&self) -> ParamsIter { + pub fn params(&self) -> ParamsIter { ParamsIter { _meta: self, list: self.0.params, @@ -340,7 +340,7 @@ impl VideoRegionOfInterestMeta { #[cfg(feature = "v1_14")] pub fn get_param<'b>(&self, name: &'b str) -> Option<&gst::StructureRef> { - self.get_params().find(|s| s.get_name() == name) + self.params().find(|s| s.name() == name) } pub fn set_rect(&mut self, rect: (u32, u32, u32, u32)) { @@ -405,14 +405,14 @@ impl fmt::Debug for VideoRegionOfInterestMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut f = f.debug_struct("VideoRegionOfInterestMeta"); - f.field("roi_type", &self.get_roi_type()) - .field("rect", &self.get_rect()) - .field("id", &self.get_id()) - .field("parent_id", &self.get_parent_id()); + f.field("roi_type", &self.roi_type()) + .field("rect", &self.rect()) + .field("id", &self.id()) + .field("parent_id", &self.parent_id()); #[cfg(feature = "v1_14")] { - f.field("params", &self.get_params().collect::>()); + f.field("params", &self.params().collect::>()); } f.finish() @@ -447,7 +447,7 @@ impl VideoAffineTransformationMeta { } } - pub fn get_matrix(&self) -> &[f32; 16] { + pub fn matrix(&self) -> &[f32; 16] { &self.0.matrix } @@ -473,7 +473,7 @@ unsafe impl MetaAPI for VideoAffineTransformationMeta { impl fmt::Debug for VideoAffineTransformationMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("VideoAffineTransformationMeta") - .field("matrix", &self.get_matrix()) + .field("matrix", &self.matrix()) .finish() } } @@ -500,12 +500,12 @@ impl VideoOverlayCompositionMeta { } } - pub fn get_overlay(&self) -> &crate::VideoOverlayCompositionRef { + pub fn overlay(&self) -> &crate::VideoOverlayCompositionRef { unsafe { crate::VideoOverlayCompositionRef::from_ptr(self.0.overlay) } } - pub fn get_overlay_owned(&self) -> crate::VideoOverlayComposition { - unsafe { from_glib_none(self.get_overlay().as_ptr()) } + pub fn overlay_owned(&self) -> crate::VideoOverlayComposition { + unsafe { from_glib_none(self.overlay().as_ptr()) } } pub fn set_overlay(&mut self, overlay: &crate::VideoOverlayComposition) { @@ -529,7 +529,7 @@ unsafe impl MetaAPI for VideoOverlayCompositionMeta { impl fmt::Debug for VideoOverlayCompositionMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("VideoOverlayCompositionMeta") - .field("overlay", &self.get_overlay()) + .field("overlay", &self.overlay()) .finish() } } @@ -568,11 +568,11 @@ impl VideoCaptionMeta { } } - pub fn get_caption_type(&self) -> crate::VideoCaptionType { + pub fn caption_type(&self) -> crate::VideoCaptionType { unsafe { from_glib(self.0.caption_type) } } - pub fn get_data(&self) -> &[u8] { + pub fn data(&self) -> &[u8] { unsafe { use std::slice; @@ -596,8 +596,8 @@ unsafe impl MetaAPI for VideoCaptionMeta { impl fmt::Debug for VideoCaptionMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("VideoCaptionMeta") - .field("caption_type", &self.get_caption_type()) - .field("data", &self.get_data()) + .field("caption_type", &self.caption_type()) + .field("data", &self.data()) .finish() } } @@ -637,15 +637,15 @@ impl VideoAFDMeta { } } - pub fn get_field(&self) -> u8 { + pub fn field(&self) -> u8 { self.0.field } - pub fn get_spec(&self) -> crate::VideoAFDSpec { + pub fn spec(&self) -> crate::VideoAFDSpec { unsafe { from_glib(self.0.spec) } } - pub fn get_afd(&self) -> crate::VideoAFDValue { + pub fn afd(&self) -> crate::VideoAFDValue { unsafe { from_glib(self.0.afd) } } } @@ -665,9 +665,9 @@ unsafe impl MetaAPI for VideoAFDMeta { impl fmt::Debug for VideoAFDMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("VideoAFDMeta") - .field("field", &self.get_field()) - .field("spec", &self.get_spec()) - .field("afd", &self.get_afd()) + .field("field", &self.field()) + .field("spec", &self.spec()) + .field("afd", &self.afd()) .finish() } } @@ -709,7 +709,7 @@ impl VideoBarMeta { } } - pub fn get_field(&self) -> u8 { + pub fn field(&self) -> u8 { self.0.field } @@ -717,11 +717,11 @@ impl VideoBarMeta { unsafe { from_glib(self.0.is_letterbox) } } - pub fn get_bar_data1(&self) -> u32 { + pub fn bar_data1(&self) -> u32 { self.0.bar_data1 } - pub fn get_bar_data2(&self) -> u32 { + pub fn bar_data2(&self) -> u32 { self.0.bar_data2 } } @@ -741,10 +741,10 @@ unsafe impl MetaAPI for VideoBarMeta { impl fmt::Debug for VideoBarMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("VideoBarMeta") - .field("field", &self.get_field()) + .field("field", &self.field()) .field("is_letterbox", &self.is_letterbox()) - .field("bar_data1", &self.get_bar_data1()) - .field("bar_data2", &self.get_bar_data2()) + .field("bar_data1", &self.bar_data1()) + .field("bar_data2", &self.bar_data2()) .finish() } } @@ -767,26 +767,26 @@ mod tests { 240, ) .unwrap(); - assert_eq!(meta.get_id(), 0); - assert_eq!(meta.get_flags(), crate::VideoFrameFlags::empty()); - assert_eq!(meta.get_format(), crate::VideoFormat::Argb); - assert_eq!(meta.get_width(), 320); - assert_eq!(meta.get_height(), 240); - assert_eq!(meta.get_n_planes(), 1); - assert_eq!(meta.get_offset(), &[0]); - assert_eq!(meta.get_stride(), &[320 * 4]); + assert_eq!(meta.id(), 0); + assert_eq!(meta.flags(), crate::VideoFrameFlags::empty()); + assert_eq!(meta.format(), crate::VideoFormat::Argb); + assert_eq!(meta.width(), 320); + assert_eq!(meta.height(), 240); + assert_eq!(meta.n_planes(), 1); + assert_eq!(meta.offset(), &[0]); + assert_eq!(meta.stride(), &[320 * 4]); } { let meta = buffer.get_meta::().unwrap(); - assert_eq!(meta.get_id(), 0); - assert_eq!(meta.get_flags(), crate::VideoFrameFlags::empty()); - assert_eq!(meta.get_format(), crate::VideoFormat::Argb); - assert_eq!(meta.get_width(), 320); - assert_eq!(meta.get_height(), 240); - assert_eq!(meta.get_n_planes(), 1); - assert_eq!(meta.get_offset(), &[0]); - assert_eq!(meta.get_stride(), &[320 * 4]); + assert_eq!(meta.id(), 0); + assert_eq!(meta.flags(), crate::VideoFrameFlags::empty()); + assert_eq!(meta.format(), crate::VideoFormat::Argb); + assert_eq!(meta.width(), 320); + assert_eq!(meta.height(), 240); + assert_eq!(meta.n_planes(), 1); + assert_eq!(meta.offset(), &[0]); + assert_eq!(meta.stride(), &[320 * 4]); } } @@ -806,26 +806,26 @@ mod tests { &[320 * 4], ) .unwrap(); - assert_eq!(meta.get_id(), 0); - assert_eq!(meta.get_flags(), crate::VideoFrameFlags::empty()); - assert_eq!(meta.get_format(), crate::VideoFormat::Argb); - assert_eq!(meta.get_width(), 320); - assert_eq!(meta.get_height(), 240); - assert_eq!(meta.get_n_planes(), 1); - assert_eq!(meta.get_offset(), &[0]); - assert_eq!(meta.get_stride(), &[320 * 4]); + assert_eq!(meta.id(), 0); + assert_eq!(meta.flags(), crate::VideoFrameFlags::empty()); + assert_eq!(meta.format(), crate::VideoFormat::Argb); + assert_eq!(meta.width(), 320); + assert_eq!(meta.height(), 240); + assert_eq!(meta.n_planes(), 1); + assert_eq!(meta.offset(), &[0]); + assert_eq!(meta.stride(), &[320 * 4]); } { let meta = buffer.get_meta::().unwrap(); - assert_eq!(meta.get_id(), 0); - assert_eq!(meta.get_flags(), crate::VideoFrameFlags::empty()); - assert_eq!(meta.get_format(), crate::VideoFormat::Argb); - assert_eq!(meta.get_width(), 320); - assert_eq!(meta.get_height(), 240); - assert_eq!(meta.get_n_planes(), 1); - assert_eq!(meta.get_offset(), &[0]); - assert_eq!(meta.get_stride(), &[320 * 4]); + assert_eq!(meta.id(), 0); + assert_eq!(meta.flags(), crate::VideoFrameFlags::empty()); + assert_eq!(meta.format(), crate::VideoFormat::Argb); + assert_eq!(meta.width(), 320); + assert_eq!(meta.height(), 240); + assert_eq!(meta.n_planes(), 1); + assert_eq!(meta.offset(), &[0]); + assert_eq!(meta.stride(), &[320 * 4]); } } @@ -844,11 +844,11 @@ mod tests { ) .unwrap(); - let alig = meta.get_alignment(); + let alig = meta.alignment(); assert_eq!(alig, crate::VideoAlignment::new(0, 0, 0, 0, &[0, 0, 0, 0])); - assert_eq!(meta.get_plane_size().unwrap(), [76800, 38400, 0, 0]); - assert_eq!(meta.get_plane_height().unwrap(), [240, 120, 0, 0]); + assert_eq!(meta.plane_size().unwrap(), [76800, 38400, 0, 0]); + assert_eq!(meta.plane_height().unwrap(), [240, 120, 0, 0]); /* horizontal padding */ let mut info = crate::VideoInfo::builder(crate::VideoFormat::Nv12, 320, 240) @@ -869,11 +869,11 @@ mod tests { .unwrap(); meta.set_alignment(&alig).unwrap(); - let alig = meta.get_alignment(); + let alig = meta.alignment(); assert_eq!(alig, crate::VideoAlignment::new(0, 0, 2, 6, &[0, 0, 0, 0])); - assert_eq!(meta.get_plane_size().unwrap(), [78720, 39360, 0, 0]); - assert_eq!(meta.get_plane_height().unwrap(), [240, 120, 0, 0]); + assert_eq!(meta.plane_size().unwrap(), [78720, 39360, 0, 0]); + assert_eq!(meta.plane_height().unwrap(), [240, 120, 0, 0]); /* vertical alignment */ let mut info = crate::VideoInfo::builder(crate::VideoFormat::Nv12, 320, 240) @@ -894,10 +894,10 @@ mod tests { .unwrap(); meta.set_alignment(&alig).unwrap(); - let alig = meta.get_alignment(); + let alig = meta.alignment(); assert_eq!(alig, crate::VideoAlignment::new(2, 6, 0, 0, &[0, 0, 0, 0])); - assert_eq!(meta.get_plane_size().unwrap(), [79360, 39680, 0, 0]); - assert_eq!(meta.get_plane_height().unwrap(), [248, 124, 0, 0]); + assert_eq!(meta.plane_size().unwrap(), [79360, 39680, 0, 0]); + assert_eq!(meta.plane_height().unwrap(), [248, 124, 0, 0]); } } diff --git a/gstreamer-video/src/video_overlay_composition.rs b/gstreamer-video/src/video_overlay_composition.rs index e659e600f..6aed1006f 100644 --- a/gstreamer-video/src/video_overlay_composition.rs +++ b/gstreamer-video/src/video_overlay_composition.rs @@ -21,9 +21,9 @@ impl fmt::Debug for VideoOverlayRectangle { impl fmt::Debug for VideoOverlayRectangleRef { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("VideoOverlayRectangle") - .field("flags", &self.get_flags()) - .field("global_alpha", &self.get_global_alpha()) - .field("render_rectangle", &self.get_render_rectangle()) + .field("flags", &self.flags()) + .field("global_alpha", &self.global_alpha()) + .field("render_rectangle", &self.render_rectangle()) .finish() } } @@ -53,7 +53,7 @@ impl VideoOverlayRectangle { } impl VideoOverlayRectangleRef { - pub fn get_flags(&self) -> crate::VideoOverlayFormatFlags { + pub fn flags(&self) -> crate::VideoOverlayFormatFlags { unsafe { from_glib(ffi::gst_video_overlay_rectangle_get_flags( self.as_mut_ptr(), @@ -61,7 +61,7 @@ impl VideoOverlayRectangleRef { } } - pub fn get_global_alpha(&self) -> f32 { + pub fn global_alpha(&self) -> f32 { unsafe { ffi::gst_video_overlay_rectangle_get_global_alpha(self.as_mut_ptr()) } } @@ -69,11 +69,11 @@ impl VideoOverlayRectangleRef { unsafe { ffi::gst_video_overlay_rectangle_set_global_alpha(self.as_mut_ptr(), alpha) } } - pub fn get_seqnum(&self) -> u32 { + pub fn seqnum(&self) -> u32 { unsafe { ffi::gst_video_overlay_rectangle_get_seqnum(self.as_mut_ptr()) } } - pub fn get_render_rectangle(&self) -> (i32, i32, u32, u32) { + pub fn render_rectangle(&self) -> (i32, i32, u32, u32) { unsafe { let mut render_x = mem::MaybeUninit::uninit(); let mut render_y = mem::MaybeUninit::uninit(); @@ -242,7 +242,7 @@ impl VideoOverlayCompositionRef { } } - pub fn get_seqnum(&self) -> u32 { + pub fn seqnum(&self) -> u32 { unsafe { ffi::gst_video_overlay_composition_get_seqnum(self.as_mut_ptr()) } } diff --git a/gstreamer-video/src/video_time_code.rs b/gstreamer-video/src/video_time_code.rs index ffe8325ac..1eab27e93 100644 --- a/gstreamer-video/src/video_time_code.rs +++ b/gstreamer-video/src/video_time_code.rs @@ -242,35 +242,35 @@ impl ValidVideoTimeCode { macro_rules! generic_impl { ($name:ident) => { impl $name { - pub fn get_hours(&self) -> u32 { + pub fn hours(&self) -> u32 { self.0.hours } - pub fn get_minutes(&self) -> u32 { + pub fn minutes(&self) -> u32 { self.0.minutes } - pub fn get_seconds(&self) -> u32 { + pub fn seconds(&self) -> u32 { self.0.seconds } - pub fn get_frames(&self) -> u32 { + pub fn frames(&self) -> u32 { self.0.frames } - pub fn get_field_count(&self) -> u32 { + pub fn field_count(&self) -> u32 { self.0.field_count } - pub fn get_fps(&self) -> gst::Fraction { + pub fn fps(&self) -> gst::Fraction { (self.0.config.fps_n as i32, self.0.config.fps_d as i32).into() } - pub fn get_flags(&self) -> VideoTimeCodeFlags { + pub fn flags(&self) -> VideoTimeCodeFlags { unsafe { from_glib(self.0.config.flags) } } - pub fn get_latest_daily_jam(&self) -> Option { + pub fn latest_daily_jam(&self) -> Option { unsafe { from_glib_none(self.0.config.latest_daily_jam) } } @@ -311,14 +311,14 @@ macro_rules! generic_impl { impl fmt::Debug for $name { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct(stringify!($name)) - .field("fps", &self.get_fps()) - .field("flags", &self.get_flags()) - .field("latest_daily_jam", &self.get_latest_daily_jam()) - .field("hours", &self.get_hours()) - .field("minutes", &self.get_minutes()) - .field("seconds", &self.get_seconds()) - .field("frames", &self.get_frames()) - .field("field_count", &self.get_field_count()) + .field("fps", &self.fps()) + .field("flags", &self.flags()) + .field("latest_daily_jam", &self.latest_daily_jam()) + .field("hours", &self.hours()) + .field("minutes", &self.minutes()) + .field("seconds", &self.seconds()) + .field("frames", &self.frames()) + .field("field_count", &self.field_count()) .finish() } } @@ -537,7 +537,7 @@ impl VideoTimeCodeMeta { } } - pub fn get_tc(&self) -> ValidVideoTimeCode { + pub fn tc(&self) -> ValidVideoTimeCode { unsafe { ValidVideoTimeCode::from_glib_none(&self.0.tc as *const _) } } @@ -565,7 +565,7 @@ unsafe impl MetaAPI for VideoTimeCodeMeta { impl fmt::Debug for VideoTimeCodeMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("VideoTimeCodeMeta") - .field("tc", &self.get_tc()) + .field("tc", &self.tc()) .finish() } } @@ -610,15 +610,15 @@ mod tests { ) .expect("invalid timecode"); - assert_eq!(meta.get_tc(), time_code_2); + assert_eq!(meta.tc(), time_code_2); time_code_2.increment_frame(); - assert_eq!(meta.get_tc().get_frames() + 1, time_code_2.get_frames()); + assert_eq!(meta.tc().frames() + 1, time_code_2.frames()); meta.set_tc(time_code_2.clone()); - assert_eq!(meta.get_tc(), time_code_2); + assert_eq!(meta.tc(), time_code_2); } } } diff --git a/gstreamer-video/src/video_time_code_interval.rs b/gstreamer-video/src/video_time_code_interval.rs index 65f601769..a1b916e4d 100644 --- a/gstreamer-video/src/video_time_code_interval.rs +++ b/gstreamer-video/src/video_time_code_interval.rs @@ -22,7 +22,7 @@ impl VideoTimeCodeInterval { } } - pub fn get_hours(&self) -> u32 { + pub fn hours(&self) -> u32 { self.0.hours } @@ -30,7 +30,7 @@ impl VideoTimeCodeInterval { self.0.hours = hours } - pub fn get_minutes(&self) -> u32 { + pub fn minutes(&self) -> u32 { self.0.minutes } @@ -39,7 +39,7 @@ impl VideoTimeCodeInterval { self.0.minutes = minutes } - pub fn get_seconds(&self) -> u32 { + pub fn seconds(&self) -> u32 { self.0.seconds } @@ -48,7 +48,7 @@ impl VideoTimeCodeInterval { self.0.seconds = seconds } - pub fn get_frames(&self) -> u32 { + pub fn frames(&self) -> u32 { self.0.frames } diff --git a/gstreamer-webrtc/src/web_rtc_session_description.rs b/gstreamer-webrtc/src/web_rtc_session_description.rs index 5482de64b..b86c02176 100644 --- a/gstreamer-webrtc/src/web_rtc_session_description.rs +++ b/gstreamer-webrtc/src/web_rtc_session_description.rs @@ -17,11 +17,11 @@ impl WebRTCSessionDescription { } } - pub fn get_type(&self) -> crate::WebRTCSDPType { + pub fn type_(&self) -> crate::WebRTCSDPType { unsafe { from_glib((*self.to_glib_none().0).type_) } } - pub fn get_sdp(&self) -> gst_sdp::SDPMessage { + pub fn sdp(&self) -> gst_sdp::SDPMessage { unsafe { from_glib_none((*self.to_glib_none().0).sdp) } } } diff --git a/gstreamer/src/allocation_params.rs b/gstreamer/src/allocation_params.rs index 484f2ae7d..6768afa91 100644 --- a/gstreamer/src/allocation_params.rs +++ b/gstreamer/src/allocation_params.rs @@ -13,19 +13,19 @@ unsafe impl Send for AllocationParams {} unsafe impl Sync for AllocationParams {} impl AllocationParams { - pub fn get_flags(&self) -> MemoryFlags { + pub fn flags(&self) -> MemoryFlags { unsafe { from_glib(self.0.flags) } } - pub fn get_align(&self) -> usize { + pub fn align(&self) -> usize { self.0.align } - pub fn get_prefix(&self) -> usize { + pub fn prefix(&self) -> usize { self.0.prefix } - pub fn get_padding(&self) -> usize { + pub fn padding(&self) -> usize { self.0.padding } diff --git a/gstreamer/src/bin.rs b/gstreamer/src/bin.rs index 6da84c972..eaa36b439 100644 --- a/gstreamer/src/bin.rs +++ b/gstreamer/src/bin.rs @@ -34,7 +34,7 @@ pub trait GstBinExtManual: 'static { fn iterate_sinks(&self) -> crate::Iterator; fn iterate_sorted(&self) -> crate::Iterator; fn iterate_sources(&self) -> crate::Iterator; - fn get_children(&self) -> Vec; + fn children(&self) -> Vec; fn debug_to_dot_data(&self, details: crate::DebugGraphDetails) -> GString; fn debug_to_dot_file>( @@ -52,7 +52,7 @@ pub trait GstBinExtManual: 'static { fn unset_bin_flags(&self, flags: BinFlags); - fn get_bin_flags(&self) -> BinFlags; + fn bin_flags(&self) -> BinFlags; } impl> GstBinExtManual for O { @@ -146,7 +146,7 @@ impl> GstBinExtManual for O { unsafe { from_glib_full(ffi::gst_bin_iterate_sources(self.as_ref().to_glib_none().0)) } } - fn get_children(&self) -> Vec { + fn children(&self) -> Vec { unsafe { let bin: &ffi::GstBin = &*(self.as_ptr() as *const _); let _guard = crate::utils::MutexGuard::lock(&bin.element.object.lock); @@ -190,7 +190,7 @@ impl> GstBinExtManual for O { } } - fn get_bin_flags(&self) -> BinFlags { + fn bin_flags(&self) -> BinFlags { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); @@ -236,9 +236,9 @@ mod tests { .unwrap(); let mut child_names = bin - .get_children() + .children() .iter() - .map(|c| c.get_name()) + .map(|c| c.name()) .collect::>(); child_names.sort(); assert_eq!( diff --git a/gstreamer/src/buffer.rs b/gstreamer/src/buffer.rs index ae5b75ba3..31220b3b1 100644 --- a/gstreamer/src/buffer.rs +++ b/gstreamer/src/buffer.rs @@ -249,7 +249,7 @@ impl BufferRef { } pub fn copy_from_slice(&mut self, offset: usize, slice: &[u8]) -> Result<(), usize> { - let maxsize = self.get_maxsize(); + let maxsize = self.maxsize(); let size = slice.len(); assert!(maxsize >= offset && maxsize - offset >= size); @@ -272,7 +272,7 @@ impl BufferRef { } pub fn copy_to_slice(&self, offset: usize, slice: &mut [u8]) -> Result<(), usize> { - let maxsize = self.get_size(); + let maxsize = self.size(); let size = slice.len(); assert!(maxsize >= offset && maxsize - offset >= size); @@ -296,11 +296,11 @@ impl BufferRef { } } - pub fn get_size(&self) -> usize { + pub fn size(&self) -> usize { unsafe { ffi::gst_buffer_get_size(self.as_mut_ptr()) } } - pub fn get_maxsize(&self) -> usize { + pub fn maxsize(&self) -> usize { unsafe { let mut maxsize = mem::MaybeUninit::uninit(); ffi::gst_buffer_get_sizes_range( @@ -316,14 +316,14 @@ impl BufferRef { } pub fn set_size(&mut self, size: usize) { - assert!(self.get_maxsize() >= size); + assert!(self.maxsize() >= size); unsafe { ffi::gst_buffer_set_size(self.as_mut_ptr(), size as isize); } } - pub fn get_offset(&self) -> u64 { + pub fn offset(&self) -> u64 { self.0.offset } @@ -331,7 +331,7 @@ impl BufferRef { self.0.offset = offset; } - pub fn get_offset_end(&self) -> u64 { + pub fn offset_end(&self) -> u64 { self.0.offset_end } @@ -339,7 +339,7 @@ impl BufferRef { self.0.offset_end = offset_end; } - pub fn get_pts(&self) -> ClockTime { + pub fn pts(&self) -> ClockTime { unsafe { from_glib(self.0.pts) } } @@ -347,7 +347,7 @@ impl BufferRef { self.0.pts = pts.to_glib(); } - pub fn get_dts(&self) -> ClockTime { + pub fn dts(&self) -> ClockTime { unsafe { from_glib(self.0.dts) } } @@ -355,16 +355,16 @@ impl BufferRef { self.0.dts = dts.to_glib(); } - pub fn get_dts_or_pts(&self) -> ClockTime { - let val = self.get_dts(); + pub fn dts_or_pts(&self) -> ClockTime { + let val = self.dts(); if val.is_none() { - self.get_pts() + self.pts() } else { val } } - pub fn get_duration(&self) -> ClockTime { + pub fn duration(&self) -> ClockTime { unsafe { from_glib(self.0.duration) } } @@ -372,7 +372,7 @@ impl BufferRef { self.0.duration = duration.to_glib(); } - pub fn get_flags(&self) -> BufferFlags { + pub fn flags(&self) -> BufferFlags { BufferFlags::from_bits_truncate(self.0.mini_object.flags) } @@ -500,7 +500,7 @@ impl BufferRef { } } - pub fn get_all_memory(&self) -> Option { + pub fn all_memory(&self) -> Option { unsafe { let res = ffi::gst_buffer_get_all_memory(self.as_mut_ptr()); if res.is_null() { @@ -898,17 +898,17 @@ impl fmt::Debug for BufferRef { f.debug_struct("Buffer") .field("ptr", unsafe { &self.as_ptr() }) - .field("pts", &self.get_pts().to_string()) - .field("dts", &self.get_dts().to_string()) - .field("duration", &self.get_duration().to_string()) - .field("size", &self.get_size()) - .field("offset", &self.get_offset()) - .field("offset_end", &self.get_offset_end()) - .field("flags", &self.get_flags()) + .field("pts", &self.pts().to_string()) + .field("dts", &self.dts().to_string()) + .field("duration", &self.duration().to_string()) + .field("size", &self.size()) + .field("offset", &self.offset()) + .field("offset_end", &self.offset_end()) + .field("flags", &self.flags()) .field( "metas", &DebugIter(RefCell::new( - self.iter_meta::().map(|m| m.get_api()), + self.iter_meta::().map(|m| m.api()), )), ) .finish() @@ -917,7 +917,7 @@ impl fmt::Debug for BufferRef { impl PartialEq for BufferRef { fn eq(&self, other: &BufferRef) -> bool { - if self.get_size() != other.get_size() { + if self.size() != other.size() { return false; } @@ -934,11 +934,11 @@ impl PartialEq for BufferRef { impl Eq for BufferRef {} impl<'a, T> BufferMap<'a, T> { - pub fn get_size(&self) -> usize { + pub fn size(&self) -> usize { self.map_info.size } - pub fn get_buffer(&self) -> &BufferRef { + pub fn buffer(&self) -> &BufferRef { self.buffer } @@ -981,9 +981,7 @@ impl<'a> ops::DerefMut for BufferMap<'a, Writable> { impl<'a, T> fmt::Debug for BufferMap<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BufferMap") - .field(&self.get_buffer()) - .finish() + f.debug_tuple("BufferMap").field(&self.buffer()).finish() } } @@ -1011,11 +1009,11 @@ impl MappedBuffer { unsafe { slice::from_raw_parts(self.map_info.data as *const u8, self.map_info.size) } } - pub fn get_size(&self) -> usize { + pub fn size(&self) -> usize { self.map_info.size } - pub fn get_buffer(&self) -> &BufferRef { + pub fn buffer(&self) -> &BufferRef { self.buffer.as_ref().unwrap().as_ref() } @@ -1073,9 +1071,7 @@ impl Drop for MappedBuffer { impl fmt::Debug for MappedBuffer { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("MappedBuffer") - .field(&self.get_buffer()) - .finish() + f.debug_tuple("MappedBuffer").field(&self.buffer()).finish() } } @@ -1113,11 +1109,11 @@ mod tests { buffer.set_offset_end(4); buffer.set_duration(5.into()); } - assert_eq!(buffer.get_pts(), 1.into()); - assert_eq!(buffer.get_dts(), 2.into()); - assert_eq!(buffer.get_offset(), 3); - assert_eq!(buffer.get_offset_end(), 4); - assert_eq!(buffer.get_duration(), 5.into()); + assert_eq!(buffer.pts(), 1.into()); + assert_eq!(buffer.dts(), 2.into()); + assert_eq!(buffer.offset(), 3); + assert_eq!(buffer.offset_end(), 4); + assert_eq!(buffer.duration(), 5.into()); } #[test] @@ -1155,8 +1151,8 @@ mod tests { data.as_mut_slice()[0] = 0; } - assert_eq!(buffer.get_pts(), 1.into()); - assert_eq!(buffer2.get_pts(), 2.into()); + assert_eq!(buffer.pts(), 1.into()); + assert_eq!(buffer2.pts(), 2.into()); { let data = buffer.map_readable().unwrap(); @@ -1184,29 +1180,29 @@ mod tests { assert!(buffer.is_all_memory_writable()); assert_eq!(buffer.n_memory(), 5); - assert_eq!(buffer.get_size(), 30); + assert_eq!(buffer.size(), 30); for i in 0..5 { { let mem = buffer.get_memory(i).unwrap(); - assert_eq!(mem.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(mem.size(), if i < 4 { 5 } else { 10 }); let map = mem.map_readable().unwrap(); - assert_eq!(map.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(map.size(), if i < 4 { 5 } else { 10 }); } { let mem = buffer.peek_memory(i); - assert_eq!(mem.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(mem.size(), if i < 4 { 5 } else { 10 }); let map = mem.map_readable().unwrap(); - assert_eq!(map.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(map.size(), if i < 4 { 5 } else { 10 }); } { let buffer = buffer.get_mut().unwrap(); let mem = buffer.peek_memory_mut(i).unwrap(); - assert_eq!(mem.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(mem.size(), if i < 4 { 5 } else { 10 }); let map = mem.map_writable().unwrap(); - assert_eq!(map.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(map.size(), if i < 4 { 5 } else { 10 }); } } @@ -1215,21 +1211,21 @@ mod tests { let mut last = 0; for (i, mem) in buffer.iter_memories_mut().unwrap().enumerate() { { - assert_eq!(mem.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(mem.size(), if i < 4 { 5 } else { 10 }); let map = mem.map_readable().unwrap(); - assert_eq!(map.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(map.size(), if i < 4 { 5 } else { 10 }); } { - assert_eq!(mem.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(mem.size(), if i < 4 { 5 } else { 10 }); let map = mem.map_readable().unwrap(); - assert_eq!(map.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(map.size(), if i < 4 { 5 } else { 10 }); } { - assert_eq!(mem.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(mem.size(), if i < 4 { 5 } else { 10 }); let map = mem.map_writable().unwrap(); - assert_eq!(map.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(map.size(), if i < 4 { 5 } else { 10 }); } last = i; @@ -1241,15 +1237,15 @@ mod tests { let mut last = 0; for (i, mem) in buffer.iter_memories().enumerate() { { - assert_eq!(mem.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(mem.size(), if i < 4 { 5 } else { 10 }); let map = mem.map_readable().unwrap(); - assert_eq!(map.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(map.size(), if i < 4 { 5 } else { 10 }); } { - assert_eq!(mem.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(mem.size(), if i < 4 { 5 } else { 10 }); let map = mem.map_readable().unwrap(); - assert_eq!(map.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(map.size(), if i < 4 { 5 } else { 10 }); } last = i; @@ -1260,15 +1256,15 @@ mod tests { let mut last = 0; for (i, mem) in buffer.iter_memories_owned().enumerate() { { - assert_eq!(mem.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(mem.size(), if i < 4 { 5 } else { 10 }); let map = mem.map_readable().unwrap(); - assert_eq!(map.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(map.size(), if i < 4 { 5 } else { 10 }); } { - assert_eq!(mem.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(mem.size(), if i < 4 { 5 } else { 10 }); let map = mem.map_readable().unwrap(); - assert_eq!(map.get_size(), if i < 4 { 5 } else { 10 }); + assert_eq!(map.size(), if i < 4 { 5 } else { 10 }); } last = i; @@ -1305,7 +1301,7 @@ mod tests { let meta = meta .downcast_ref::() .unwrap(); - res.push(meta.get_timestamp()); + res.push(meta.timestamp()); true }); @@ -1340,8 +1336,8 @@ mod tests { let meta = meta .downcast_ref::() .unwrap(); - res.push(meta.get_timestamp()); - if meta.get_timestamp() == crate::SECOND { + res.push(meta.timestamp()); + if meta.timestamp() == crate::SECOND { Ok(false) } else { Ok(true) @@ -1355,7 +1351,7 @@ mod tests { let meta = meta .downcast_ref::() .unwrap(); - res.push(meta.get_timestamp()); + res.push(meta.timestamp()); true }); diff --git a/gstreamer/src/buffer_cursor.rs b/gstreamer/src/buffer_cursor.rs index e8be64f86..be820e739 100644 --- a/gstreamer/src/buffer_cursor.rs +++ b/gstreamer/src/buffer_cursor.rs @@ -264,7 +264,7 @@ impl BufferCursor { Ok(self.cur_offset) } - pub fn get_buffer(&self) -> &BufferRef { + pub fn buffer(&self) -> &BufferRef { self.buffer.as_ref().unwrap().as_ref() } @@ -276,7 +276,7 @@ impl BufferCursor { impl BufferCursor { pub(crate) fn new_readable(buffer: Buffer) -> BufferCursor { skip_assert_initialized!(); - let size = buffer.get_size() as u64; + let size = buffer.size() as u64; let num_mem = buffer.n_memory(); BufferCursor { @@ -299,7 +299,7 @@ impl BufferCursor { return Err(glib::bool_error!("Not all memories are writable")); } - let size = buffer.get_size() as u64; + let size = buffer.size() as u64; let num_mem = buffer.n_memory(); Ok(BufferCursor { @@ -369,13 +369,13 @@ impl BufferRefCursor { } impl<'a> BufferRefCursor<&'a BufferRef> { - pub fn get_buffer(&self) -> &BufferRef { + pub fn buffer(&self) -> &BufferRef { self.buffer } pub(crate) fn new_readable(buffer: &'a BufferRef) -> BufferRefCursor<&'a BufferRef> { skip_assert_initialized!(); - let size = buffer.get_size() as u64; + let size = buffer.size() as u64; let num_mem = buffer.n_memory(); BufferRefCursor { @@ -391,7 +391,7 @@ impl<'a> BufferRefCursor<&'a BufferRef> { } impl<'a> BufferRefCursor<&'a mut BufferRef> { - pub fn get_buffer(&self) -> &BufferRef { + pub fn buffer(&self) -> &BufferRef { self.buffer } @@ -403,7 +403,7 @@ impl<'a> BufferRefCursor<&'a mut BufferRef> { return Err(glib::bool_error!("Not all memories are writable")); } - let size = buffer.get_size() as u64; + let size = buffer.size() as u64; let num_mem = buffer.n_memory(); Ok(BufferRefCursor { @@ -444,7 +444,7 @@ mod tests { assert!(buffer.is_all_memory_writable()); assert_eq!(buffer.n_memory(), 5); - assert_eq!(buffer.get_size(), 30); + assert_eq!(buffer.size(), 30); let mut cursor = buffer.into_cursor_writable().unwrap(); assert_eq!(cursor.stream_position().unwrap(), 0); @@ -536,7 +536,7 @@ mod tests { assert!(buffer.is_all_memory_writable()); assert_eq!(buffer.n_memory(), 5); - assert_eq!(buffer.get_size(), 30); + assert_eq!(buffer.size(), 30); { let buffer = buffer.get_mut().unwrap(); diff --git a/gstreamer/src/buffer_pool.rs b/gstreamer/src/buffer_pool.rs index 732411968..b760c4258 100644 --- a/gstreamer/src/buffer_pool.rs +++ b/gstreamer/src/buffer_pool.rs @@ -60,7 +60,7 @@ impl BufferPoolConfig { } } - pub fn get_options(&self) -> Vec { + pub fn options(&self) -> Vec { unsafe { let n = ffi::gst_buffer_pool_config_n_options(self.0.to_glib_none().0) as usize; let mut options = Vec::with_capacity(n); @@ -94,7 +94,7 @@ impl BufferPoolConfig { } } - pub fn get_params(&self) -> Option<(Option, u32, u32, u32)> { + pub fn params(&self) -> Option<(Option, u32, u32, u32)> { unsafe { let mut caps = ptr::null_mut(); let mut size = mem::MaybeUninit::uninit(); @@ -142,7 +142,7 @@ impl BufferPoolConfig { } } - pub fn get_allocator(&self) -> Option<(Option, AllocationParams)> { + pub fn allocator(&self) -> Option<(Option, AllocationParams)> { unsafe { let mut allocator = ptr::null_mut(); let mut params = mem::MaybeUninit::zeroed(); @@ -201,7 +201,7 @@ impl BufferPoolAcquireParams { skip_assert_initialized!(); unsafe { BufferPoolAcquireParams(ffi::GstBufferPoolAcquireParams { - format: start.get_format().to_glib(), + format: start.format().to_glib(), start: start.to_raw_value(), stop: stop.to_raw_value(), flags: flags.to_glib(), @@ -279,7 +279,7 @@ impl Default for BufferPool { } pub trait BufferPoolExtManual: 'static { - fn get_config(&self) -> BufferPoolConfig; + fn config(&self) -> BufferPoolConfig; fn set_config(&self, config: BufferPoolConfig) -> Result<(), glib::error::BoolError>; fn is_flushing(&self) -> bool; @@ -292,7 +292,7 @@ pub trait BufferPoolExtManual: 'static { } impl> BufferPoolExtManual for O { - fn get_config(&self) -> BufferPoolConfig { + fn config(&self) -> BufferPoolConfig { unsafe { let ptr = ffi::gst_buffer_pool_get_config(self.as_ref().to_glib_none().0); BufferPoolConfig(from_glib_full(ptr)) @@ -355,7 +355,7 @@ mod tests { crate::init().unwrap(); let pool = crate::BufferPool::new(); - let mut config = pool.get_config(); + let mut config = pool.config(); config.set_params(Some(&crate::Caps::new_simple("foo/bar", &[])), 1024, 0, 2); pool.set_config(config).unwrap(); diff --git a/gstreamer/src/buffer_serde.rs b/gstreamer/src/buffer_serde.rs index fe298576f..a128c2f20 100644 --- a/gstreamer/src/buffer_serde.rs +++ b/gstreamer/src/buffer_serde.rs @@ -16,12 +16,12 @@ use crate::ClockTime; impl<'a> Serialize for BufferRef { fn serialize(&self, serializer: S) -> Result { let mut buffer = serializer.serialize_struct("Buffer", 6)?; - buffer.serialize_field("pts", &self.get_pts())?; - buffer.serialize_field("dts", &self.get_dts())?; - buffer.serialize_field("duration", &self.get_duration())?; - buffer.serialize_field("offset", &self.get_offset())?; - buffer.serialize_field("offset_end", &self.get_offset_end())?; - buffer.serialize_field("flags", &self.get_flags())?; + buffer.serialize_field("pts", &self.pts())?; + buffer.serialize_field("dts", &self.dts())?; + buffer.serialize_field("duration", &self.duration())?; + buffer.serialize_field("offset", &self.offset())?; + buffer.serialize_field("offset_end", &self.offset_end())?; + buffer.serialize_field("flags", &self.flags())?; { let data = self .map_readable() @@ -149,12 +149,12 @@ mod tests { ) "#; let buffer: Buffer = ron::de::from_str(buffer_ron).unwrap(); - assert_eq!(buffer.get_pts(), 1.into()); - assert_eq!(buffer.get_dts(), None.into()); - assert_eq!(buffer.get_offset(), 3); - assert_eq!(buffer.get_offset_end(), 4); - assert_eq!(buffer.get_duration(), 5.into()); - assert_eq!(buffer.get_flags(), BufferFlags::LIVE | BufferFlags::DISCONT); + assert_eq!(buffer.pts(), 1.into()); + assert_eq!(buffer.dts(), None.into()); + assert_eq!(buffer.offset(), 3); + assert_eq!(buffer.offset_end(), 4); + assert_eq!(buffer.duration(), 5.into()); + assert_eq!(buffer.flags(), BufferFlags::LIVE | BufferFlags::DISCONT); { let data = buffer.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![1, 2, 3, 4].as_slice()); @@ -172,12 +172,12 @@ mod tests { } "#; let buffer: Buffer = serde_json::from_str(buffer_json).unwrap(); - assert_eq!(buffer.get_pts(), 1.into()); - assert_eq!(buffer.get_dts(), None.into()); - assert_eq!(buffer.get_offset(), 3); - assert_eq!(buffer.get_offset_end(), 4); - assert_eq!(buffer.get_duration(), 5.into()); - assert_eq!(buffer.get_flags(), BufferFlags::LIVE | BufferFlags::DISCONT); + assert_eq!(buffer.pts(), 1.into()); + assert_eq!(buffer.dts(), None.into()); + assert_eq!(buffer.offset(), 3); + assert_eq!(buffer.offset_end(), 4); + assert_eq!(buffer.duration(), 5.into()); + assert_eq!(buffer.flags(), BufferFlags::LIVE | BufferFlags::DISCONT); { let data = buffer.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![1, 2, 3, 4].as_slice()); @@ -201,12 +201,12 @@ mod tests { // Ron let buffer_ser = ron::ser::to_string(&buffer).unwrap(); let buffer_de: Buffer = ron::de::from_str(buffer_ser.as_str()).unwrap(); - assert_eq!(buffer_de.get_pts(), buffer.get_pts()); - assert_eq!(buffer_de.get_dts(), buffer.get_dts()); - assert_eq!(buffer_de.get_offset(), buffer.get_offset()); - assert_eq!(buffer_de.get_offset_end(), buffer.get_offset_end()); - assert_eq!(buffer_de.get_duration(), buffer.get_duration()); - assert_eq!(buffer_de.get_flags(), buffer.get_flags()); + assert_eq!(buffer_de.pts(), buffer.pts()); + assert_eq!(buffer_de.dts(), buffer.dts()); + assert_eq!(buffer_de.offset(), buffer.offset()); + assert_eq!(buffer_de.offset_end(), buffer.offset_end()); + assert_eq!(buffer_de.duration(), buffer.duration()); + assert_eq!(buffer_de.flags(), buffer.flags()); { let data = buffer_de.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![1, 2, 3, 4].as_slice()); diff --git a/gstreamer/src/bufferlist.rs b/gstreamer/src/bufferlist.rs index 68202b466..2ccf27128 100644 --- a/gstreamer/src/bufferlist.rs +++ b/gstreamer/src/bufferlist.rs @@ -174,10 +174,10 @@ impl fmt::Debug for BufferList { impl fmt::Debug for BufferListRef { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let size = self.iter().map(|b| b.get_size()).sum::(); + let size = self.iter().map(|b| b.size()).sum::(); let (pts, dts) = self .get(0) - .map(|b| (b.get_pts(), b.get_dts())) + .map(|b| (b.pts(), b.dts())) .unwrap_or((crate::ClockTime::none(), crate::ClockTime::none())); f.debug_struct("BufferList") @@ -280,7 +280,7 @@ mod tests { let mut res = vec![]; buffer_list.foreach(|buffer, idx| { - res.push((buffer.get_pts(), idx)); + res.push((buffer.pts(), idx)); true }); @@ -310,11 +310,11 @@ mod tests { let mut res = vec![]; buffer_list.get_mut().unwrap().foreach_mut(|buffer, idx| { - res.push((buffer.get_pts(), idx)); + res.push((buffer.pts(), idx)); - if buffer.get_pts() == crate::ClockTime::from(0) { + if buffer.pts() == crate::ClockTime::from(0) { Ok(Some(buffer)) - } else if buffer.get_pts() == crate::SECOND { + } else if buffer.pts() == crate::SECOND { Ok(None) } else { let mut new_buffer = Buffer::new(); @@ -334,7 +334,7 @@ mod tests { let mut res = vec![]; buffer_list.foreach(|buffer, idx| { - res.push((buffer.get_pts(), idx)); + res.push((buffer.pts(), idx)); true }); diff --git a/gstreamer/src/bufferlist_serde.rs b/gstreamer/src/bufferlist_serde.rs index 29161dea1..becdcac76 100644 --- a/gstreamer/src/bufferlist_serde.rs +++ b/gstreamer/src/bufferlist_serde.rs @@ -163,15 +163,15 @@ mod tests { let buffer_list: BufferList = ron::de::from_str(buffer_list_ron).unwrap(); let mut iter = buffer_list.iter(); let buffer = iter.next().unwrap(); - assert_eq!(buffer.get_pts(), 1.into()); - assert_eq!(buffer.get_dts(), None.into()); + assert_eq!(buffer.pts(), 1.into()); + assert_eq!(buffer.dts(), None.into()); { let data = buffer.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![1, 2, 3, 4].as_slice()); } let buffer = iter.next().unwrap(); - assert_eq!(buffer.get_pts(), 5.into()); + assert_eq!(buffer.pts(), 5.into()); { let data = buffer.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![5, 6].as_slice()); @@ -213,15 +213,15 @@ mod tests { let buffer_list: BufferList = ron::de::from_str(buffer_list_ser.as_str()).unwrap(); let mut iter = buffer_list.iter(); let buffer = iter.next().unwrap(); - assert_eq!(buffer.get_pts(), 1.into()); - assert_eq!(buffer.get_dts(), None.into()); + assert_eq!(buffer.pts(), 1.into()); + assert_eq!(buffer.dts(), None.into()); { let data = buffer.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![1, 2, 3, 4].as_slice()); } let buffer = iter.next().unwrap(); - assert_eq!(buffer.get_pts(), 5.into()); + assert_eq!(buffer.pts(), 5.into()); { let data = buffer.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![5, 6].as_slice()); diff --git a/gstreamer/src/bus.rs b/gstreamer/src/bus.rs index c24e9853f..083b09215 100644 --- a/gstreamer/src/bus.rs +++ b/gstreamer/src/bus.rs @@ -219,7 +219,7 @@ impl Bus { msg_types: &'a [MessageType], ) -> impl Iterator + 'a { self.iter_timed(timeout) - .filter(move |msg| msg_types.contains(&msg.get_type())) + .filter(move |msg| msg_types.contains(&msg.type_())) } pub fn timed_pop_filtered( @@ -229,7 +229,7 @@ impl Bus { ) -> Option { loop { let msg = self.timed_pop(timeout)?; - if msg_types.contains(&msg.get_type()) { + if msg_types.contains(&msg.type_()) { return Some(msg); } } @@ -238,7 +238,7 @@ impl Bus { pub fn pop_filtered(&self, msg_types: &[MessageType]) -> Option { loop { let msg = self.pop()?; - if msg_types.contains(&msg.get_type()) { + if msg_types.contains(&msg.type_()) { return Some(msg); } } @@ -253,7 +253,7 @@ impl Bus { message_types: &'a [MessageType], ) -> impl Stream + Unpin + Send + 'a { self.stream().filter(move |message| { - let message_type = message.get_type(); + let message_type = message.type_(); future::ready(message_types.contains(&message_type)) }) diff --git a/gstreamer/src/bus_unix.rs b/gstreamer/src/bus_unix.rs index a1c89ea79..e03e43eee 100644 --- a/gstreamer/src/bus_unix.rs +++ b/gstreamer/src/bus_unix.rs @@ -19,11 +19,11 @@ cfg_if::cfg_if! { use super::Bus; pub trait UnixBusExtManual: 'static { - fn get_pollfd(&self) -> unix::io::RawFd; + fn pollfd(&self) -> unix::io::RawFd; } impl UnixBusExtManual for Bus { - fn get_pollfd(&self) -> unix::io::RawFd { + fn pollfd(&self) -> unix::io::RawFd { #[cfg(unix)] unsafe { let mut pollfd = mem::MaybeUninit::zeroed(); diff --git a/gstreamer/src/bus_windows.rs b/gstreamer/src/bus_windows.rs index c97b0f028..f30b50fbd 100644 --- a/gstreamer/src/bus_windows.rs +++ b/gstreamer/src/bus_windows.rs @@ -19,11 +19,11 @@ cfg_if::cfg_if! { use super::Bus; pub trait WindowsBusExtManual: 'static { - fn get_pollfd(&self) -> windows::io::RawHandle; + fn pollfd(&self) -> windows::io::RawHandle; } impl WindowsBusExtManual for Bus { - fn get_pollfd(&self) -> windows::io::RawHandle { + fn pollfd(&self) -> windows::io::RawHandle { #[cfg(windows)] unsafe { let mut pollfd = mem::MaybeUninit::zeroed(); diff --git a/gstreamer/src/caps.rs b/gstreamer/src/caps.rs index d21a7b3b5..47f6fd6f3 100644 --- a/gstreamer/src/caps.rs +++ b/gstreamer/src/caps.rs @@ -180,7 +180,7 @@ impl CapsRef { } pub fn get_structure(&self, idx: u32) -> Option<&StructureRef> { - if idx >= self.get_size() { + if idx >= self.size() { return None; } @@ -195,7 +195,7 @@ impl CapsRef { } pub fn get_mut_structure(&mut self, idx: u32) -> Option<&mut StructureRef> { - if idx >= self.get_size() { + if idx >= self.size() { return None; } @@ -210,7 +210,7 @@ impl CapsRef { } pub fn get_features(&self, idx: u32) -> Option<&CapsFeaturesRef> { - if idx >= self.get_size() { + if idx >= self.size() { return None; } @@ -221,7 +221,7 @@ impl CapsRef { } pub fn get_mut_features(&mut self, idx: u32) -> Option<&mut CapsFeaturesRef> { - if idx >= self.get_size() { + if idx >= self.size() { return None; } @@ -232,7 +232,7 @@ impl CapsRef { } pub fn set_features(&mut self, idx: u32, features: Option) { - assert!(idx < self.get_size()); + assert!(idx < self.size()); unsafe { ffi::gst_caps_set_features( @@ -254,7 +254,7 @@ impl CapsRef { } } - pub fn get_size(&self) -> u32 { + pub fn size(&self) -> u32 { unsafe { ffi::gst_caps_get_size(self.as_ptr()) } } @@ -403,7 +403,7 @@ macro_rules! define_iter( impl<'a> $name<'a> { fn new(caps: $typ) -> $name<'a> { skip_assert_initialized!(); - let n_structures = caps.get_size(); + let n_structures = caps.size(); $name { caps, @@ -887,12 +887,12 @@ mod tests { .structure(Structure::builder("video/x-raw").build()) .build(); - let audio = Caps::from_iter(caps.iter().filter(|s| s.get_name() == "audio/x-raw")); + let audio = Caps::from_iter(caps.iter().filter(|s| s.name() == "audio/x-raw")); assert_eq!(audio.to_string(), "audio/x-raw"); let audio = Caps::from_iter_with_features( caps.iter_with_features() - .filter(|(s, _)| s.get_name() == "audio/x-raw"), + .filter(|(s, _)| s.name() == "audio/x-raw"), ); assert_eq!(audio.to_string(), "audio/x-raw(ANY)"); } diff --git a/gstreamer/src/caps_features.rs b/gstreamer/src/caps_features.rs index 40b399899..ac058c39e 100644 --- a/gstreamer/src/caps_features.rs +++ b/gstreamer/src/caps_features.rs @@ -270,7 +270,7 @@ impl CapsFeaturesRef { } pub fn is_empty(&self) -> bool { - self.get_size() == 0 && !self.is_any() + self.size() == 0 && !self.is_any() } pub fn is_any(&self) -> bool { @@ -286,12 +286,12 @@ impl CapsFeaturesRef { } } - pub fn get_size(&self) -> u32 { + pub fn size(&self) -> u32 { unsafe { ffi::gst_caps_features_get_size(self.as_ptr()) } } pub fn get_nth(&self, idx: u32) -> Option<&str> { - if idx >= self.get_size() { + if idx >= self.size() { return None; } @@ -373,7 +373,7 @@ pub struct Iter<'a> { impl<'a> Iter<'a> { fn new(caps_features: &'a CapsFeaturesRef) -> Iter<'a> { skip_assert_initialized!(); - let n_features = caps_features.get_size(); + let n_features = caps_features.size(); Iter { caps_features, diff --git a/gstreamer/src/clock.rs b/gstreamer/src/clock.rs index 6eb8989b6..2892e9040 100644 --- a/gstreamer/src/clock.rs +++ b/gstreamer/src/clock.rs @@ -36,7 +36,7 @@ glib::wrapper! { } impl ClockId { - pub fn get_time(&self) -> ClockTime { + pub fn time(&self) -> ClockTime { unsafe { from_glib(ffi::gst_clock_id_get_time(self.to_glib_none().0)) } } @@ -62,7 +62,7 @@ impl ClockId { #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] - pub fn get_clock(&self) -> Option { + pub fn clock(&self) -> Option { unsafe { from_glib_full(ffi::gst_clock_id_get_clock(self.to_glib_none().0)) } } @@ -77,14 +77,14 @@ impl ClockId { } } - pub fn get_type(&self) -> ClockEntryType { + pub fn type_(&self) -> ClockEntryType { unsafe { let ptr: *mut ffi::GstClockEntry = self.to_glib_none().0 as *mut _; from_glib((*ptr).type_) } } - pub fn get_status(&self) -> &AtomicClockReturn { + pub fn status(&self) -> &AtomicClockReturn { unsafe { let ptr: *mut ffi::GstClockEntry = self.to_glib_none().0 as *mut _; &*((&(*ptr).status) as *const i32 as *const AtomicClockReturn) @@ -115,7 +115,7 @@ impl convert::TryFrom for SingleShotClockId { fn try_from(id: ClockId) -> Result { skip_assert_initialized!(); - match id.get_type() { + match id.type_() { ClockEntryType::Single => Ok(SingleShotClockId(id)), _ => Err(glib::bool_error!("Not a single-shot clock id")), } @@ -217,7 +217,7 @@ impl convert::TryFrom for PeriodicClockId { fn try_from(id: ClockId) -> Result { skip_assert_initialized!(); - match id.get_type() { + match id.type_() { ClockEntryType::Periodic => Ok(PeriodicClockId(id)), _ => Err(glib::bool_error!("Not a periodic clock id")), } @@ -225,7 +225,7 @@ impl convert::TryFrom for PeriodicClockId { } impl PeriodicClockId { - pub fn get_interval(&self) -> ClockTime { + pub fn interval(&self) -> ClockTime { unsafe { let ptr: *mut ffi::GstClockEntry = self.to_glib_none().0 as *mut _; from_glib((*ptr).interval) @@ -398,7 +398,7 @@ pub trait ClockExtManual: 'static { fn unset_clock_flags(&self, flags: ClockFlags); - fn get_clock_flags(&self) -> ClockFlags; + fn clock_flags(&self) -> ClockFlags; } impl> ClockExtManual for O { @@ -484,7 +484,7 @@ impl> ClockExtManual for O { } } - fn get_clock_flags(&self) -> ClockFlags { + fn clock_flags(&self) -> ClockFlags { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); @@ -504,7 +504,7 @@ mod tests { crate::init().unwrap(); let clock = SystemClock::obtain(); - let now = clock.get_time(); + let now = clock.time(); let id = clock.new_single_shot_id(now + 20 * crate::MSECOND); let (res, _) = id.wait(); @@ -518,7 +518,7 @@ mod tests { let (sender, receiver) = channel(); let clock = SystemClock::obtain(); - let now = clock.get_time(); + let now = clock.time(); let id = clock.new_single_shot_id(now + 20 * crate::MSECOND); let res = id.wait_async(move |_, _, _| { sender.send(()).unwrap(); @@ -534,7 +534,7 @@ mod tests { crate::init().unwrap(); let clock = SystemClock::obtain(); - let now = clock.get_time(); + let now = clock.time(); let id = clock.new_periodic_id(now + 20 * crate::MSECOND, 20 * crate::MSECOND); let (res, _) = id.wait(); @@ -551,7 +551,7 @@ mod tests { let (sender, receiver) = channel(); let clock = SystemClock::obtain(); - let now = clock.get_time(); + let now = clock.time(); let id = clock.new_periodic_id(now + 20 * crate::MSECOND, 20 * crate::MSECOND); let res = id.wait_async(move |_, _, _| { let _ = sender.send(()); diff --git a/gstreamer/src/context.rs b/gstreamer/src/context.rs index d818d8091..edce48282 100644 --- a/gstreamer/src/context.rs +++ b/gstreamer/src/context.rs @@ -24,7 +24,7 @@ impl Context { } impl ContextRef { - pub fn get_context_type(&self) -> &str { + pub fn context_type(&self) -> &str { unsafe { let raw = ffi::gst_context_get_context_type(self.as_mut_ptr()); CStr::from_ptr(raw).to_str().unwrap() @@ -44,11 +44,11 @@ impl ContextRef { unsafe { from_glib(ffi::gst_context_is_persistent(self.as_mut_ptr())) } } - pub fn get_structure(&self) -> &StructureRef { + pub fn structure(&self) -> &StructureRef { unsafe { StructureRef::from_glib_borrow(ffi::gst_context_get_structure(self.as_mut_ptr())) } } - pub fn get_mut_structure(&mut self) -> &mut StructureRef { + pub fn structure_mut(&mut self) -> &mut StructureRef { unsafe { StructureRef::from_glib_borrow_mut(ffi::gst_context_writable_structure( self.as_mut_ptr(), @@ -66,8 +66,8 @@ impl fmt::Debug for Context { impl fmt::Debug for ContextRef { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Context") - .field("type", &self.get_context_type()) - .field("structure", &self.get_structure()) + .field("type", &self.context_type()) + .field("structure", &self.structure()) .finish() } } diff --git a/gstreamer/src/date_time.rs b/gstreamer/src/date_time.rs index 4317175fc..e5768a801 100644 --- a/gstreamer/src/date_time.rs +++ b/gstreamer/src/date_time.rs @@ -223,7 +223,7 @@ impl DateTime { } } - pub fn get_day(&self) -> Option { + pub fn day(&self) -> Option { if !self.has_day() { return None; } @@ -231,7 +231,7 @@ impl DateTime { unsafe { Some(ffi::gst_date_time_get_day(self.to_glib_none().0)) } } - pub fn get_hour(&self) -> Option { + pub fn hour(&self) -> Option { if !self.has_time() { return None; } @@ -239,7 +239,7 @@ impl DateTime { unsafe { Some(ffi::gst_date_time_get_hour(self.to_glib_none().0)) } } - pub fn get_microsecond(&self) -> Option { + pub fn microsecond(&self) -> Option { if !self.has_second() { return None; } @@ -247,7 +247,7 @@ impl DateTime { unsafe { Some(ffi::gst_date_time_get_microsecond(self.to_glib_none().0)) } } - pub fn get_minute(&self) -> Option { + pub fn minute(&self) -> Option { if !self.has_time() { return None; } @@ -255,7 +255,7 @@ impl DateTime { unsafe { Some(ffi::gst_date_time_get_minute(self.to_glib_none().0)) } } - pub fn get_month(&self) -> Option { + pub fn month(&self) -> Option { if !self.has_month() { return None; } @@ -263,7 +263,7 @@ impl DateTime { unsafe { Some(ffi::gst_date_time_get_month(self.to_glib_none().0)) } } - pub fn get_second(&self) -> Option { + pub fn second(&self) -> Option { if !self.has_second() { return None; } @@ -271,7 +271,7 @@ impl DateTime { unsafe { Some(ffi::gst_date_time_get_second(self.to_glib_none().0)) } } - pub fn get_time_zone_offset(&self) -> Option { + pub fn time_zone_offset(&self) -> Option { if !self.has_time() { return None; } @@ -304,12 +304,12 @@ impl DateTime { // to `glib/v2_58`. So we need to build a new `gst::DateTime` with `0f64` // and then discard seconds again DateTime::new( - self.get_time_zone_offset(), - self.get_year(), - self.get_month(), - self.get_day(), - self.get_hour(), - self.get_minute(), + self.time_zone_offset(), + self.year(), + self.month(), + self.day(), + self.hour(), + self.minute(), Some(0.0), ) .and_then(|d| d.to_g_date_time()) @@ -317,11 +317,11 @@ impl DateTime { .and_then(|d| { DateTime::new( None, // UTC TZ offset - d.get_year(), - Some(d.get_month()), - Some(d.get_day_of_month()), - Some(d.get_hour()), - Some(d.get_minute()), + d.year(), + Some(d.month()), + Some(d.day_of_month()), + Some(d.hour()), + Some(d.minute()), None, // No second ) }) @@ -369,7 +369,7 @@ impl cmp::PartialOrd for DateTime { (self.clone(), other.clone()) }; - let year_delta = self_norm.get_year() - other_norm.get_year(); + let year_delta = self_norm.year() - other_norm.year(); if year_delta != 0 { return get_cmp(year_delta); } @@ -386,7 +386,7 @@ impl cmp::PartialOrd for DateTime { return None; } - let month_delta = self_norm.get_month().unwrap() - other_norm.get_month().unwrap(); + let month_delta = self_norm.month().unwrap() - other_norm.month().unwrap(); if month_delta != 0 { return get_cmp(month_delta); } @@ -403,7 +403,7 @@ impl cmp::PartialOrd for DateTime { return None; } - let day_delta = self_norm.get_day().unwrap() - other_norm.get_day().unwrap(); + let day_delta = self_norm.day().unwrap() - other_norm.day().unwrap(); if day_delta != 0 { return get_cmp(day_delta); } @@ -420,12 +420,12 @@ impl cmp::PartialOrd for DateTime { return None; } - let hour_delta = self_norm.get_hour().unwrap() - other_norm.get_hour().unwrap(); + let hour_delta = self_norm.hour().unwrap() - other_norm.hour().unwrap(); if hour_delta != 0 { return get_cmp(hour_delta); } - let minute_delta = self_norm.get_minute().unwrap() - other_norm.get_minute().unwrap(); + let minute_delta = self_norm.minute().unwrap() - other_norm.minute().unwrap(); if minute_delta != 0 { return get_cmp(minute_delta); } @@ -441,12 +441,12 @@ impl cmp::PartialOrd for DateTime { // One has second, the other doesn't => can't compare (note 1) return None; } - let second_delta = self_norm.get_second().unwrap() - other_norm.get_second().unwrap(); + let second_delta = self_norm.second().unwrap() - other_norm.second().unwrap(); if second_delta != 0 { return get_cmp(second_delta); } - get_cmp(self_norm.get_microsecond().unwrap() - other_norm.get_microsecond().unwrap()) + get_cmp(self_norm.microsecond().unwrap() - other_norm.microsecond().unwrap()) } } @@ -461,24 +461,24 @@ impl fmt::Debug for DateTime { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut debug_struct = f.debug_struct("DateTime"); if self.has_year() { - debug_struct.field("year", &self.get_year()); + debug_struct.field("year", &self.year()); } if self.has_month() { - debug_struct.field("month", &self.get_month()); + debug_struct.field("month", &self.month()); } if self.has_day() { - debug_struct.field("day", &self.get_day()); + debug_struct.field("day", &self.day()); } if self.has_time() { - debug_struct.field("hour", &self.get_hour()); - debug_struct.field("minute", &self.get_minute()); + debug_struct.field("hour", &self.hour()); + debug_struct.field("minute", &self.minute()); if self.has_second() { - debug_struct.field("second", &self.get_second()); - debug_struct.field("microsecond", &self.get_microsecond()); + debug_struct.field("second", &self.second()); + debug_struct.field("microsecond", &self.microsecond()); } - debug_struct.field("tz_offset", &self.get_time_zone_offset()); + debug_struct.field("tz_offset", &self.time_zone_offset()); } debug_struct.finish() @@ -541,32 +541,32 @@ mod tests { .unwrap() .to_utc() .unwrap(); - assert_eq!(utc_date_time.get_year(), 2019); - assert_eq!(utc_date_time.get_month().unwrap(), 8); - assert_eq!(utc_date_time.get_day().unwrap(), 20); - assert_eq!(utc_date_time.get_hour().unwrap(), 18); - assert_eq!(utc_date_time.get_minute().unwrap(), 9); - assert_eq!(utc_date_time.get_second().unwrap(), 42); - assert_eq!(utc_date_time.get_microsecond().unwrap(), 123_456); + assert_eq!(utc_date_time.year(), 2019); + assert_eq!(utc_date_time.month().unwrap(), 8); + assert_eq!(utc_date_time.day().unwrap(), 20); + assert_eq!(utc_date_time.hour().unwrap(), 18); + assert_eq!(utc_date_time.minute().unwrap(), 9); + assert_eq!(utc_date_time.second().unwrap(), 42); + assert_eq!(utc_date_time.microsecond().unwrap(), 123_456); // Year, month, day and hour offset let utc_date_time = DateTime::new(2f32, 2019, 1, 1, 0, 0, 42.123_456f64) .unwrap() .to_utc() .unwrap(); - assert_eq!(utc_date_time.get_year(), 2018); - assert_eq!(utc_date_time.get_month().unwrap(), 12); - assert_eq!(utc_date_time.get_day().unwrap(), 31); - assert_eq!(utc_date_time.get_hour().unwrap(), 22); - assert_eq!(utc_date_time.get_minute().unwrap(), 0); - assert_eq!(utc_date_time.get_second().unwrap(), 42); - assert_eq!(utc_date_time.get_microsecond().unwrap(), 123_456); + assert_eq!(utc_date_time.year(), 2018); + assert_eq!(utc_date_time.month().unwrap(), 12); + assert_eq!(utc_date_time.day().unwrap(), 31); + assert_eq!(utc_date_time.hour().unwrap(), 22); + assert_eq!(utc_date_time.minute().unwrap(), 0); + assert_eq!(utc_date_time.second().unwrap(), 42); + assert_eq!(utc_date_time.microsecond().unwrap(), 123_456); // Date without an hour (which implies no TZ) let utc_date_time = DateTime::new_ymd(2019, 1, 1).unwrap().to_utc().unwrap(); - assert_eq!(utc_date_time.get_year(), 2019); - assert_eq!(utc_date_time.get_month().unwrap(), 1); - assert_eq!(utc_date_time.get_day().unwrap(), 1); + assert_eq!(utc_date_time.year(), 2019); + assert_eq!(utc_date_time.month().unwrap(), 1); + assert_eq!(utc_date_time.day().unwrap(), 1); assert!(!utc_date_time.has_time()); assert!(!utc_date_time.has_second()); @@ -575,11 +575,11 @@ mod tests { .unwrap() .to_utc() .unwrap(); - assert_eq!(utc_date_time.get_year(), 2018); - assert_eq!(utc_date_time.get_month().unwrap(), 5); - assert_eq!(utc_date_time.get_day().unwrap(), 28); - assert_eq!(utc_date_time.get_hour().unwrap(), 14); - assert_eq!(utc_date_time.get_minute().unwrap(), 6); + assert_eq!(utc_date_time.year(), 2018); + assert_eq!(utc_date_time.month().unwrap(), 5); + assert_eq!(utc_date_time.day().unwrap(), 28); + assert_eq!(utc_date_time.hour().unwrap(), 14); + assert_eq!(utc_date_time.minute().unwrap(), 6); assert!(!utc_date_time.has_second()); } diff --git a/gstreamer/src/date_time_serde.rs b/gstreamer/src/date_time_serde.rs index 269f1789a..5681e26f7 100644 --- a/gstreamer/src/date_time_serde.rs +++ b/gstreamer/src/date_time_serde.rs @@ -54,9 +54,9 @@ impl StaticType for Date { impl<'a> Serialize for Date { fn serialize(&self, serializer: S) -> Result { DateTimeVariants::YMD( - self.0.get_year() as i32, - self.0.get_month().to_glib() as i32, - self.0.get_day() as i32, + self.0.year() as i32, + self.0.month().to_glib() as i32, + self.0.day() as i32, ) .serialize(serializer) } @@ -66,34 +66,30 @@ impl<'a> Serialize for DateTime { fn serialize(&self, serializer: S) -> Result { let variant = if self.has_second() { DateTimeVariants::YMDhmsTz( - self.get_year(), - self.get_month().unwrap(), - self.get_day().unwrap(), - self.get_hour().unwrap(), - self.get_minute().unwrap(), - f64::from(self.get_second().unwrap()) - + f64::from(self.get_microsecond().unwrap()) / 1_000_000f64, - self.get_time_zone_offset().unwrap(), + self.year(), + self.month().unwrap(), + self.day().unwrap(), + self.hour().unwrap(), + self.minute().unwrap(), + f64::from(self.second().unwrap()) + + f64::from(self.microsecond().unwrap()) / 1_000_000f64, + self.time_zone_offset().unwrap(), ) } else if self.has_time() { DateTimeVariants::YMDhmTz( - self.get_year(), - self.get_month().unwrap(), - self.get_day().unwrap(), - self.get_hour().unwrap(), - self.get_minute().unwrap(), - self.get_time_zone_offset().unwrap(), + self.year(), + self.month().unwrap(), + self.day().unwrap(), + self.hour().unwrap(), + self.minute().unwrap(), + self.time_zone_offset().unwrap(), ) } else if self.has_day() { - DateTimeVariants::YMD( - self.get_year(), - self.get_month().unwrap(), - self.get_day().unwrap(), - ) + DateTimeVariants::YMD(self.year(), self.month().unwrap(), self.day().unwrap()) } else if self.has_month() { - DateTimeVariants::YM(self.get_year(), self.get_month().unwrap()) + DateTimeVariants::YM(self.year(), self.month().unwrap()) } else if self.has_year() { - DateTimeVariants::Y(self.get_year()) + DateTimeVariants::Y(self.year()) } else { return Err(ser::Error::custom(format!( "no parts could be found in `DateTime` {}", diff --git a/gstreamer/src/element.rs b/gstreamer/src/element.rs index 99b1c215d..38cdb43b3 100644 --- a/gstreamer/src/element.rs +++ b/gstreamer/src/element.rs @@ -120,7 +120,7 @@ impl FromGlib for NotifyWatchId { } pub trait ElementExtManual: 'static { - fn get_element_class(&self) -> &glib::Class; + fn element_class(&self) -> &glib::Class; fn change_state(&self, transition: StateChange) -> Result; @@ -135,12 +135,12 @@ pub trait ElementExtManual: 'static { ) -> (Result, State, State); fn set_state(&self, state: State) -> Result; - fn get_current_state(&self) -> State { - self.get_state(ClockTime::from(0)).1 + fn current_state(&self) -> State { + self.state(ClockTime::from(0)).1 } - fn get_pending_state(&self) -> State { - self.get_state(ClockTime::from(0)).2 + fn pending_state(&self) -> State { + self.state(ClockTime::from(0)).2 } fn query(&self, query: &mut QueryRef) -> bool; @@ -150,7 +150,7 @@ pub trait ElementExtManual: 'static { fn get_metadata<'a>(&self, key: &str) -> Option<&'a str>; fn get_pad_template(&self, name: &str) -> Option; - fn get_pad_template_list(&self) -> Vec; + fn pad_template_list(&self) -> Vec; #[allow(clippy::too_many_arguments)] fn message_full( @@ -168,7 +168,7 @@ pub trait ElementExtManual: 'static { fn unset_element_flags(&self, flags: ElementFlags); - fn get_element_flags(&self) -> ElementFlags; + fn element_flags(&self) -> ElementFlags; #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] @@ -192,9 +192,9 @@ pub trait ElementExtManual: 'static { fn iterate_sink_pads(&self) -> crate::Iterator; fn iterate_src_pads(&self) -> crate::Iterator; - fn get_pads(&self) -> Vec; - fn get_sink_pads(&self) -> Vec; - fn get_src_pads(&self) -> Vec; + fn pads(&self) -> Vec; + fn sink_pads(&self) -> Vec; + fn src_pads(&self) -> Vec; fn num_pads(&self) -> u16; fn num_sink_pads(&self) -> u16; @@ -264,12 +264,12 @@ pub trait ElementExtManual: 'static { F: FnOnce(&Self) -> T + Send + 'static, T: Send + 'static; - fn get_current_running_time(&self) -> crate::ClockTime; - fn get_current_clock_time(&self) -> crate::ClockTime; + fn current_running_time(&self) -> crate::ClockTime; + fn current_clock_time(&self) -> crate::ClockTime; } impl> ElementExtManual for O { - fn get_element_class(&self) -> &glib::Class { + fn element_class(&self) -> &glib::Class { unsafe { let klass = (*(self.as_ptr() as *mut glib::gobject_ffi::GTypeInstance)).g_class as *const glib::Class; @@ -353,15 +353,15 @@ impl> ElementExtManual for O { } fn get_metadata<'a>(&self, key: &str) -> Option<&'a str> { - self.get_element_class().get_metadata(key) + self.element_class().get_metadata(key) } fn get_pad_template(&self, name: &str) -> Option { - self.get_element_class().get_pad_template(name) + self.element_class().get_pad_template(name) } - fn get_pad_template_list(&self) -> Vec { - self.get_element_class().get_pad_template_list() + fn pad_template_list(&self) -> Vec { + self.element_class().pad_template_list() } fn set_element_flags(&self, flags: ElementFlags) { @@ -380,7 +380,7 @@ impl> ElementExtManual for O { } } - fn get_element_flags(&self) -> ElementFlags { + fn element_flags(&self) -> ElementFlags { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); @@ -513,7 +513,7 @@ impl> ElementExtManual for O { } } - fn get_pads(&self) -> Vec { + fn pads(&self) -> Vec { unsafe { let elt: &ffi::GstElement = &*(self.as_ptr() as *const _); let _guard = crate::utils::MutexGuard::lock(&elt.object.lock); @@ -521,7 +521,7 @@ impl> ElementExtManual for O { } } - fn get_sink_pads(&self) -> Vec { + fn sink_pads(&self) -> Vec { unsafe { let elt: &ffi::GstElement = &*(self.as_ptr() as *const _); let _guard = crate::utils::MutexGuard::lock(&elt.object.lock); @@ -529,7 +529,7 @@ impl> ElementExtManual for O { } } - fn get_src_pads(&self) -> Vec { + fn src_pads(&self) -> Vec { unsafe { let elt: &ffi::GstElement = &*(self.as_ptr() as *const _); let _guard = crate::utils::MutexGuard::lock(&elt.object.lock); @@ -615,7 +615,7 @@ impl> ElementExtManual for O { let mut dest_val = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_element_query_convert( self.as_ref().to_glib_none().0, - src_val.get_format().to_glib(), + src_val.format().to_glib(), src_val.to_raw_value(), U::get_default_format().to_glib(), dest_val.as_mut_ptr(), @@ -638,8 +638,8 @@ impl> ElementExtManual for O { let mut dest_val = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_element_query_convert( self.as_ref().to_glib_none().0, - src_val.get_format().to_glib(), - src_val.get_value(), + src_val.format().to_glib(), + src_val.value(), dest_format.to_glib(), dest_val.as_mut_ptr(), )); @@ -730,19 +730,19 @@ impl> ElementExtManual for O { let start = start.into(); let stop = stop.into(); - assert_eq!(stop.get_format(), start.get_format()); + assert_eq!(stop.format(), start.format()); unsafe { glib::result_from_gboolean!( ffi::gst_element_seek( self.as_ref().to_glib_none().0, rate, - start.get_format().to_glib(), + start.format().to_glib(), flags.to_glib(), start_type.to_glib(), - start.get_value(), + start.value(), stop_type.to_glib(), - stop.get_value(), + stop.value(), ), "Failed to seek", ) @@ -759,9 +759,9 @@ impl> ElementExtManual for O { glib::result_from_gboolean!( ffi::gst_element_seek_simple( self.as_ref().to_glib_none().0, - seek_pos.get_format().to_glib(), + seek_pos.format().to_glib(), seek_flags.to_glib(), - seek_pos.get_value(), + seek_pos.value(), ), "Failed to seek", ) @@ -820,21 +820,21 @@ impl> ElementExtManual for O { Box::pin(async move { receiver.await.expect("sender dropped") }) } - fn get_current_running_time(&self) -> crate::ClockTime { + fn current_running_time(&self) -> crate::ClockTime { use crate::ElementExt; - let base_time = self.get_base_time(); - let clock_time = self.get_current_clock_time(); + let base_time = self.base_time(); + let clock_time = self.current_clock_time(); clock_time - base_time } - fn get_current_clock_time(&self) -> crate::ClockTime { + fn current_clock_time(&self) -> crate::ClockTime { use crate::ClockExt; use crate::ElementExt; - if let Some(clock) = self.get_clock() { - clock.get_time() + if let Some(clock) = self.clock() { + clock.time() } else { crate::CLOCK_TIME_NONE } @@ -867,7 +867,7 @@ pub unsafe trait ElementClassExt { } } - fn get_pad_template_list(&self) -> Vec { + fn pad_template_list(&self) -> Vec { unsafe { let klass = self as *const _ as *const ffi::GstElementClass; @@ -1391,25 +1391,25 @@ mod tests { let identity = crate::ElementFactory::make("identity", None).unwrap(); let mut pad_names = identity - .get_pads() + .pads() .iter() - .map(|p| p.get_name()) + .map(|p| p.name()) .collect::>(); pad_names.sort(); assert_eq!(pad_names, vec![String::from("sink"), String::from("src")]); let mut pad_names = identity - .get_sink_pads() + .sink_pads() .iter() - .map(|p| p.get_name()) + .map(|p| p.name()) .collect::>(); pad_names.sort(); assert_eq!(pad_names, vec![String::from("sink")]); let mut pad_names = identity - .get_src_pads() + .src_pads() .iter() - .map(|p| p.get_name()) + .map(|p| p.name()) .collect::>(); pad_names.sort(); assert_eq!(pad_names, vec![String::from("src")]); @@ -1424,7 +1424,7 @@ mod tests { let mut pad_names = Vec::new(); identity.foreach_pad(|_element, pad| { - pad_names.push(pad.get_name()); + pad_names.push(pad.name()); true }); diff --git a/gstreamer/src/enums.rs b/gstreamer/src/enums.rs index 7cf17f9be..f4667b4ba 100644 --- a/gstreamer/src/enums.rs +++ b/gstreamer/src/enums.rs @@ -679,7 +679,7 @@ impl StateChange { } } - pub fn get_name<'a>(self) -> &'a str { + pub fn name<'a>(self) -> &'a str { cfg_if::cfg_if! { if #[cfg(feature = "v1_14")] { // This implementation is autogenerated on 1.14 and up diff --git a/gstreamer/src/event.rs b/gstreamer/src/event.rs index 1a08328b6..08e0054fd 100644 --- a/gstreamer/src/event.rs +++ b/gstreamer/src/event.rs @@ -134,7 +134,7 @@ mini_object_wrapper!(Event, EventRef, ffi::GstEvent, || { }); impl EventRef { - pub fn get_seqnum(&self) -> Seqnum { + pub fn seqnum(&self) -> Seqnum { unsafe { let seqnum = ffi::gst_event_get_seqnum(self.as_mut_ptr()); assert_ne!(seqnum, 0); @@ -142,7 +142,7 @@ impl EventRef { } } - pub fn get_running_time_offset(&self) -> i64 { + pub fn running_time_offset(&self) -> i64 { unsafe { ffi::gst_event_get_running_time_offset(self.as_mut_ptr()) } } @@ -150,7 +150,7 @@ impl EventRef { unsafe { ffi::gst_event_set_running_time_offset(self.as_mut_ptr(), offset) } } - pub fn get_structure(&self) -> Option<&StructureRef> { + pub fn structure(&self) -> Option<&StructureRef> { unsafe { let structure = ffi::gst_event_get_structure(self.as_mut_ptr()); if structure.is_null() { @@ -168,26 +168,26 @@ impl EventRef { } pub fn is_upstream(&self) -> bool { - self.get_type().is_upstream() + self.type_().is_upstream() } pub fn is_downstream(&self) -> bool { - self.get_type().is_downstream() + self.type_().is_downstream() } pub fn is_serialized(&self) -> bool { - self.get_type().is_serialized() + self.type_().is_serialized() } pub fn is_sticky(&self) -> bool { - self.get_type().is_sticky() + self.type_().is_sticky() } pub fn is_sticky_multi(&self) -> bool { - self.get_type().is_sticky_multi() + self.type_().is_sticky_multi() } - pub fn get_type(&self) -> EventType { + pub fn type_(&self) -> EventType { unsafe { from_glib((*self.as_ptr()).type_) } } @@ -243,9 +243,9 @@ impl fmt::Debug for EventRef { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Event") .field("ptr", unsafe { &self.as_ptr() }) - .field("type", &self.get_type().get_name()) - .field("seqnum", &self.get_seqnum()) - .field("structure", &self.get_structure()) + .field("type", &self.type_().name()) + .field("seqnum", &self.seqnum()) + .field("structure", &self.structure()) .finish() } } @@ -327,7 +327,7 @@ impl<'a> FlushStop<'a> { FlushStopBuilder::new(reset_time) } - pub fn get_reset_time(&self) -> bool { + pub fn resets_time(&self) -> bool { unsafe { let mut reset_time = mem::MaybeUninit::uninit(); @@ -351,7 +351,7 @@ impl<'a> StreamStart<'a> { StreamStartBuilder::new(stream_id) } - pub fn get_stream_id(&self) -> &'a str { + pub fn stream_id(&self) -> &'a str { unsafe { let mut stream_id = ptr::null(); @@ -360,7 +360,7 @@ impl<'a> StreamStart<'a> { } } - pub fn get_stream_flags(&self) -> crate::StreamFlags { + pub fn stream_flags(&self) -> crate::StreamFlags { unsafe { let mut stream_flags = mem::MaybeUninit::uninit(); @@ -370,7 +370,7 @@ impl<'a> StreamStart<'a> { } } - pub fn get_group_id(&self) -> Option { + pub fn group_id(&self) -> Option { unsafe { let mut group_id = mem::MaybeUninit::uninit(); @@ -387,7 +387,7 @@ impl<'a> StreamStart<'a> { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] - pub fn get_stream(&self) -> Option { + pub fn stream(&self) -> Option { unsafe { let mut stream = ptr::null_mut(); ffi::gst_event_parse_stream(self.as_mut_ptr(), &mut stream); @@ -409,7 +409,7 @@ impl<'a> Caps<'a> { CapsBuilder::new(caps) } - pub fn get_caps(&self) -> &'a crate::CapsRef { + pub fn caps(&self) -> &'a crate::CapsRef { unsafe { let mut caps = ptr::null_mut(); @@ -418,8 +418,8 @@ impl<'a> Caps<'a> { } } - pub fn get_caps_owned(&self) -> crate::Caps { - unsafe { from_glib_none(self.get_caps().as_ptr()) } + pub fn caps_owned(&self) -> crate::Caps { + unsafe { from_glib_none(self.caps().as_ptr()) } } } @@ -438,7 +438,7 @@ impl<'a> Segment<'a> { SegmentBuilder::new(segment.as_ref()) } - pub fn get_segment(&self) -> &'a crate::Segment { + pub fn segment(&self) -> &'a crate::Segment { unsafe { let mut segment = ptr::null(); @@ -467,7 +467,7 @@ impl<'a> StreamCollection<'a> { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] - pub fn get_stream_collection(&self) -> crate::StreamCollection { + pub fn stream_collection(&self) -> crate::StreamCollection { unsafe { let mut stream_collection = ptr::null_mut(); @@ -490,7 +490,7 @@ impl<'a> Tag<'a> { TagBuilder::new(tags) } - pub fn get_tag(&self) -> &'a crate::TagListRef { + pub fn tag(&self) -> &'a crate::TagListRef { unsafe { let mut tags = ptr::null_mut(); @@ -499,8 +499,8 @@ impl<'a> Tag<'a> { } } - pub fn get_tag_owned(&self) -> crate::TagList { - unsafe { from_glib_none(self.get_tag().as_ptr()) } + pub fn tag_owned(&self) -> crate::TagList { + unsafe { from_glib_none(self.tag().as_ptr()) } } } @@ -520,7 +520,7 @@ impl<'a> BufferSize<'a> { assert_initialized_main_thread!(); let minsize = minsize.into(); let maxsize = maxsize.into(); - assert_eq!(minsize.get_format(), maxsize.get_format()); + assert_eq!(minsize.format(), maxsize.format()); BufferSizeBuilder::new(minsize, maxsize, r#async) } @@ -561,7 +561,7 @@ impl<'a> SinkMessage<'a> { SinkMessageBuilder::new(name, msg) } - pub fn get_message(&self) -> crate::Message { + pub fn message(&self) -> crate::Message { unsafe { let mut msg = ptr::null_mut(); @@ -590,7 +590,7 @@ impl<'a> StreamGroupDone<'a> { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] - pub fn get_group_id(&self) -> GroupId { + pub fn group_id(&self) -> GroupId { unsafe { let mut group_id = mem::MaybeUninit::uninit(); @@ -632,7 +632,7 @@ impl<'a> Toc<'a> { TocBuilder::new(toc, updated) } - pub fn get_toc(&self) -> (&'a crate::TocRef, bool) { + pub fn toc(&self) -> (&'a crate::TocRef, bool) { unsafe { let mut toc = ptr::null_mut(); let mut updated = mem::MaybeUninit::uninit(); @@ -645,9 +645,9 @@ impl<'a> Toc<'a> { } } - pub fn get_toc_owned(&self) -> (crate::Toc, bool) { + pub fn toc_owned(&self) -> (crate::Toc, bool) { unsafe { - let (toc, updated) = self.get_toc(); + let (toc, updated) = self.toc(); (from_glib_none(toc.as_ptr()), updated) } } @@ -835,7 +835,7 @@ impl<'a> Seek<'a> { assert_initialized_main_thread!(); let start = start.into(); let stop = stop.into(); - assert_eq!(start.get_format(), stop.get_format()); + assert_eq!(start.format(), stop.format()); SeekBuilder::new(rate, flags, start_type, start, stop_type, stop) } @@ -883,7 +883,7 @@ impl<'a> Seek<'a> { #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] - pub fn get_trickmode_interval(&self) -> crate::ClockTime { + pub fn trickmode_interval(&self) -> crate::ClockTime { unsafe { let mut trickmode_interval = mem::MaybeUninit::uninit(); @@ -924,7 +924,7 @@ impl<'a> Latency<'a> { LatencyBuilder::new(latency) } - pub fn get_latency(&self) -> crate::ClockTime { + pub fn latency(&self) -> crate::ClockTime { unsafe { let mut latency = mem::MaybeUninit::uninit(); @@ -1015,7 +1015,7 @@ impl<'a> TocSelect<'a> { TocSelectBuilder::new(uid) } - pub fn get_uid(&self) -> &'a str { + pub fn uid(&self) -> &'a str { unsafe { let mut uid = ptr::null_mut(); @@ -1045,7 +1045,7 @@ impl<'a> SelectStreams<'a> { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] - pub fn get_streams(&self) -> Vec { + pub fn streams(&self) -> Vec { unsafe { let mut streams = ptr::null_mut(); @@ -1428,9 +1428,9 @@ impl<'a> BufferSizeBuilder<'a> { } event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_buffer_size( - s.minsize.get_format().to_glib(), - s.minsize.get_value(), - s.maxsize.get_value(), + s.minsize.format().to_glib(), + s.minsize.value(), + s.maxsize.value(), s.r#async.to_glib(), )); } @@ -1564,8 +1564,8 @@ impl<'a> SegmentDoneBuilder<'a> { } event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_segment_done( - s.position.get_format().to_glib(), - s.position.get_value() + s.position.format().to_glib(), + s.position.value() )); } @@ -1658,12 +1658,12 @@ impl<'a> SeekBuilder<'a> { { let ev = ffi::gst_event_new_seek( s.rate, - s.start.get_format().to_glib(), + s.start.format().to_glib(), s.flags.to_glib(), s.start_type.to_glib(), - s.start.get_value(), + s.start.value(), s.stop_type.to_glib(), - s.stop.get_value(), + s.stop.value(), ); #[cfg(any(feature = "v1_16", feature = "dox"))] @@ -1734,8 +1734,8 @@ impl<'a> StepBuilder<'a> { } event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_step( - s.amount.get_format().to_glib(), - s.amount.get_value() as u64, + s.amount.format().to_glib(), + s.amount.value() as u64, s.rate, s.flush.to_glib(), s.intermediate.to_glib(), @@ -1933,7 +1933,7 @@ mod tests { match flush_start_evt.view() { EventView::FlushStart(flush_start_evt) => { assert!(!flush_start_evt.is_sticky()); - assert!(flush_start_evt.get_structure().is_none()); + assert!(flush_start_evt.structure().is_none()); } _ => panic!("flush_start_evt.view() is not an EventView::FlushStart(_)"), } @@ -1943,8 +1943,8 @@ mod tests { .build(); match flush_start_evt.view() { EventView::FlushStart(flush_start_evt) => { - assert!(flush_start_evt.get_structure().is_some()); - if let Some(other_fields) = flush_start_evt.get_structure() { + assert!(flush_start_evt.structure().is_some()); + if let Some(other_fields) = flush_start_evt.structure() { assert!(other_fields.has_field("extra-field")); } } @@ -1957,9 +1957,9 @@ mod tests { .build(); match flush_stop_evt.view() { EventView::FlushStop(flush_stop_evt) => { - assert_eq!(flush_stop_evt.get_reset_time(), true); - assert!(flush_stop_evt.get_structure().is_some()); - if let Some(other_fields) = flush_stop_evt.get_structure() { + assert_eq!(flush_stop_evt.resets_time(), true); + assert!(flush_stop_evt.structure().is_some()); + if let Some(other_fields) = flush_stop_evt.structure() { assert!(other_fields.has_field("extra-field")); } } @@ -1979,7 +1979,7 @@ mod tests { structure.set("test", &42u32); } - let structure = flush_start_evt.get_structure().unwrap(); + let structure = flush_start_evt.structure().unwrap(); assert_eq!(structure.get_some("test"), Ok(42u32)); } } diff --git a/gstreamer/src/format.rs b/gstreamer/src/format.rs index 7f3d224d8..9d9a5765b 100644 --- a/gstreamer/src/format.rs +++ b/gstreamer/src/format.rs @@ -48,7 +48,7 @@ pub struct TryFromGenericFormattedValueError(()); pub trait FormattedValue: Copy + Clone + Sized + Into + 'static { fn get_default_format() -> Format; - fn get_format(&self) -> Format; + fn format(&self) -> Format; unsafe fn from_raw(format: Format, value: i64) -> Self; unsafe fn to_raw_value(&self) -> i64; @@ -61,8 +61,8 @@ impl FormattedValue for GenericFormattedValue { Format::Undefined } - fn get_format(&self) -> Format { - self.get_format() + fn format(&self) -> Format { + self.format() } unsafe fn from_raw(format: Format, value: i64) -> Self { @@ -70,7 +70,7 @@ impl FormattedValue for GenericFormattedValue { } unsafe fn to_raw_value(&self) -> i64 { - self.get_value() + self.value() } } @@ -106,7 +106,7 @@ impl GenericFormattedValue { } } - pub fn get_format(&self) -> Format { + pub fn format(&self) -> Format { match *self { GenericFormattedValue::Undefined(_) => Format::Undefined, GenericFormattedValue::Default(_) => Format::Default, @@ -118,7 +118,7 @@ impl GenericFormattedValue { } } - pub fn get_value(&self) -> i64 { + pub fn value(&self) -> i64 { match *self { GenericFormattedValue::Undefined(v) => v.0, GenericFormattedValue::Default(v) => v.map(|v| v as i64).unwrap_or(-1), @@ -278,7 +278,7 @@ macro_rules! impl_format_value_traits( Format::$format } - fn get_format(&self) -> Format { + fn format(&self) -> Format { Format::$format } @@ -524,7 +524,7 @@ impl FormattedValue for Undefined { Format::Undefined } - fn get_format(&self) -> Format { + fn format(&self) -> Format { Format::Undefined } @@ -605,7 +605,7 @@ impl FormattedValue for Percent { Format::Percent } - fn get_format(&self) -> Format { + fn format(&self) -> Format { Format::Percent } diff --git a/gstreamer/src/functions.rs b/gstreamer/src/functions.rs index a4ef874a5..3f94e18c2 100644 --- a/gstreamer/src/functions.rs +++ b/gstreamer/src/functions.rs @@ -212,11 +212,11 @@ mod tests { let bin = parse_bin_from_description_with_name("fakesrc ! fakesink", false, "all_fake").unwrap(); - let name = bin.get_name(); + let name = bin.name(); assert_eq!(name, "all_fake"); let bin = parse_bin_from_description_with_name("fakesrc ! fakesink", false, "").unwrap(); - let name = bin.get_name(); + let name = bin.name(); assert_ne!(name, ""); } } diff --git a/gstreamer/src/ghost_pad.rs b/gstreamer/src/ghost_pad.rs index 25406e9f3..11d1ef7f2 100644 --- a/gstreamer/src/ghost_pad.rs +++ b/gstreamer/src/ghost_pad.rs @@ -101,7 +101,7 @@ impl GhostPad { target: &P, ) -> Result { skip_assert_initialized!(); - Self::builder(name, target.get_direction()).build_with_target(target) + Self::builder(name, target.direction()).build_with_target(target) } pub fn from_template_with_target>( @@ -111,7 +111,7 @@ impl GhostPad { ) -> Result { skip_assert_initialized!(); - if target.get_direction() != templ.get_property_direction() { + if target.direction() != templ.property_direction() { return Err(glib::bool_error!( "Template and target have different directions" )); @@ -135,7 +135,7 @@ impl + IsA> PadBuilder { let proxy = self .0 .unsafe_cast_ref::() - .get_internal() + .internal() .unwrap(); proxy.set_activate_function(func); } @@ -161,7 +161,7 @@ impl + IsA> PadBuilder { let proxy = self .0 .unsafe_cast_ref::() - .get_internal() + .internal() .unwrap(); proxy.set_activatemode_function(func); } @@ -186,7 +186,7 @@ impl + IsA> PadBuilder { let proxy = self .0 .unsafe_cast_ref::() - .get_internal() + .internal() .unwrap(); proxy.set_chain_function(func); } @@ -211,7 +211,7 @@ impl + IsA> PadBuilder { let proxy = self .0 .unsafe_cast_ref::() - .get_internal() + .internal() .unwrap(); proxy.set_chain_list_function(func); } @@ -232,7 +232,7 @@ impl + IsA> PadBuilder { let proxy = self .0 .unsafe_cast_ref::() - .get_internal() + .internal() .unwrap(); proxy.set_event_function(func); } @@ -257,7 +257,7 @@ impl + IsA> PadBuilder { let proxy = self .0 .unsafe_cast_ref::() - .get_internal() + .internal() .unwrap(); proxy.set_event_full_function(func); } @@ -284,7 +284,7 @@ impl + IsA> PadBuilder { let proxy = self .0 .unsafe_cast_ref::() - .get_internal() + .internal() .unwrap(); proxy.set_getrange_function(func); } @@ -305,7 +305,7 @@ impl + IsA> PadBuilder { let proxy = self .0 .unsafe_cast_ref::() - .get_internal() + .internal() .unwrap(); proxy.set_iterate_internal_links_function(func); } @@ -330,7 +330,7 @@ impl + IsA> PadBuilder { let proxy = self .0 .unsafe_cast_ref::() - .get_internal() + .internal() .unwrap(); proxy.set_link_function(func); } @@ -351,7 +351,7 @@ impl + IsA> PadBuilder { let proxy = self .0 .unsafe_cast_ref::() - .get_internal() + .internal() .unwrap(); proxy.set_query_function(func); } @@ -369,7 +369,7 @@ impl + IsA> PadBuilder { let proxy = self .0 .unsafe_cast_ref::() - .get_internal() + .internal() .unwrap(); proxy.set_unlink_function(func); } @@ -384,7 +384,7 @@ impl + IsA> PadBuilder { let proxy = self .0 .unsafe_cast_ref::() - .get_internal() + .internal() .unwrap(); proxy.set_pad_flags(flags); } @@ -395,7 +395,7 @@ impl + IsA> PadBuilder { pub fn build_with_target>(self, target: &P) -> Result { use crate::GhostPadExt; - assert_eq!(self.0.get_direction(), target.get_direction()); + assert_eq!(self.0.direction(), target.direction()); self.0.set_target(Some(target))?; diff --git a/gstreamer/src/log.rs b/gstreamer/src/log.rs index d4c54a89f..07980994c 100644 --- a/gstreamer/src/log.rs +++ b/gstreamer/src/log.rs @@ -84,7 +84,7 @@ impl DebugCategory { } } - pub fn get_threshold(self) -> crate::DebugLevel { + pub fn threshold(self) -> crate::DebugLevel { match self.0 { Some(cat) => unsafe { from_glib(ffi::gst_debug_category_get_threshold(cat.as_ptr())) }, None => crate::DebugLevel::None, @@ -103,14 +103,14 @@ impl DebugCategory { } } - pub fn get_color(self) -> crate::DebugColorFlags { + pub fn color(self) -> crate::DebugColorFlags { match self.0 { Some(cat) => unsafe { from_glib(ffi::gst_debug_category_get_color(cat.as_ptr())) }, None => crate::DebugColorFlags::empty(), } } - pub fn get_name<'a>(self) -> &'a str { + pub fn name<'a>(self) -> &'a str { match self.0 { Some(cat) => unsafe { CStr::from_ptr(ffi::gst_debug_category_get_name(cat.as_ptr())) @@ -121,7 +121,7 @@ impl DebugCategory { } } - pub fn get_description<'a>(self) -> Option<&'a str> { + pub fn description<'a>(self) -> Option<&'a str> { match self.0 { Some(cat) => unsafe { let ptr = ffi::gst_debug_category_get_description(cat.as_ptr()); @@ -181,9 +181,7 @@ unsafe impl Send for DebugCategory {} impl fmt::Debug for DebugCategory { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("DebugCategory") - .field(&self.get_name()) - .finish() + f.debug_tuple("DebugCategory").field(&self.name()).finish() } } @@ -500,7 +498,7 @@ mod tests { let perf_cat = DebugCategory::get("GST_PERFORMANCE") .expect("Unable to find `DebugCategory` with name \"GST_PERFORMANCE\""); - assert_eq!(perf_cat.get_name(), CAT_PERFORMANCE.get_name()); + assert_eq!(perf_cat.name(), CAT_PERFORMANCE.name()); } #[test] diff --git a/gstreamer/src/memory.rs b/gstreamer/src/memory.rs index 390888eaa..c81db4cff 100644 --- a/gstreamer/src/memory.rs +++ b/gstreamer/src/memory.rs @@ -39,13 +39,13 @@ impl fmt::Debug for MemoryRef { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Memory") .field("ptr", unsafe { &self.as_ptr() }) - .field("allocator", &self.get_allocator()) - .field("parent", &self.get_parent()) - .field("maxsize", &self.get_maxsize()) - .field("align", &self.get_align()) - .field("offset", &self.get_offset()) - .field("size", &self.get_size()) - .field("flags", &self.get_flags()) + .field("allocator", &self.allocator()) + .field("parent", &self.parent()) + .field("maxsize", &self.maxsize()) + .field("align", &self.align()) + .field("offset", &self.offset()) + .field("size", &self.size()) + .field("flags", &self.flags()) .finish() } } @@ -166,11 +166,11 @@ impl Memory { } impl MemoryRef { - pub fn get_allocator(&self) -> Option { + pub fn allocator(&self) -> Option { unsafe { from_glib_none(self.0.allocator) } } - pub fn get_parent(&self) -> Option<&MemoryRef> { + pub fn parent(&self) -> Option<&MemoryRef> { unsafe { if self.0.parent.is_null() { None @@ -180,23 +180,23 @@ impl MemoryRef { } } - pub fn get_maxsize(&self) -> usize { + pub fn maxsize(&self) -> usize { self.0.maxsize } - pub fn get_align(&self) -> usize { + pub fn align(&self) -> usize { self.0.align } - pub fn get_offset(&self) -> usize { + pub fn offset(&self) -> usize { self.0.offset } - pub fn get_size(&self) -> usize { + pub fn size(&self) -> usize { self.0.size } - pub fn get_flags(&self) -> MemoryFlags { + pub fn flags(&self) -> MemoryFlags { unsafe { from_glib(self.0.mini_object.flags) } } @@ -205,7 +205,7 @@ impl MemoryRef { Some(val) => val as isize, None => 0, }; - assert!(offset + pos_sz < (self.get_maxsize() as isize)); + assert!(offset + pos_sz < (self.maxsize() as isize)); unsafe { from_glib_full(ffi::gst_memory_copy( self.as_mut_ptr(), @@ -285,7 +285,7 @@ impl MemoryRef { Some(val) => val as isize, None => 0, }; - assert!(offset + pos_sz < (self.get_maxsize() as isize)); + assert!(offset + pos_sz < (self.maxsize() as isize)); unsafe { from_glib_full(ffi::gst_memory_share( self.as_ptr() as *mut _, @@ -299,7 +299,7 @@ impl MemoryRef { } pub fn resize(&mut self, offset: isize, size: usize) { - assert!(offset + (size as isize) < (self.get_maxsize() as isize)); + assert!(offset + (size as isize) < (self.maxsize() as isize)); unsafe { ffi::gst_memory_resize(self.as_mut_ptr(), offset, size) } } @@ -309,11 +309,11 @@ impl MemoryRef { } impl<'a, T> MemoryMap<'a, T> { - pub fn get_size(&self) -> usize { + pub fn size(&self) -> usize { self.map_info.size } - pub fn get_memory(&self) -> &MemoryRef { + pub fn memory(&self) -> &MemoryRef { self.memory } @@ -356,9 +356,7 @@ impl<'a> ops::DerefMut for MemoryMap<'a, Writable> { impl<'a, T> fmt::Debug for MemoryMap<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("MemoryMap") - .field(&self.get_memory()) - .finish() + f.debug_tuple("MemoryMap").field(&self.memory()).finish() } } @@ -386,11 +384,11 @@ impl MappedMemory { unsafe { slice::from_raw_parts(self.map_info.data as *const u8, self.map_info.size) } } - pub fn get_size(&self) -> usize { + pub fn size(&self) -> usize { self.map_info.size } - pub fn get_memory(&self) -> &MemoryRef { + pub fn memory(&self) -> &MemoryRef { self.memory.as_ref().unwrap().as_ref() } @@ -448,9 +446,7 @@ impl Drop for MappedMemory { impl fmt::Debug for MappedMemory { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("MappedMemory") - .field(&self.get_memory()) - .finish() + f.debug_tuple("MappedMemory").field(&self.memory()).finish() } } @@ -476,7 +472,7 @@ impl<'a> Dump<'a> { let map = self.memory.map_readable().expect("Failed to map memory"); let data = map.as_slice(); - let size = self.size.unwrap_or_else(|| self.memory.get_size()); + let size = self.size.unwrap_or_else(|| self.memory.size()); let data = &data[0..size]; if debug { @@ -506,7 +502,7 @@ mod tests { crate::init().unwrap(); let mem = crate::Memory::from_slice(vec![1, 2, 3, 4]); - println!("{}", mem.dump(Some(mem.get_size()))); + println!("{}", mem.dump(Some(mem.size()))); let mem = crate::Memory::from_slice(vec![1, 2, 3, 4]); println!("{:?}", mem.dump(Some(2))); diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index 1045e90b6..38fbe42e3 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -26,11 +26,11 @@ mini_object_wrapper!(Message, MessageRef, ffi::GstMessage, || { }); impl MessageRef { - pub fn get_src(&self) -> Option { + pub fn src(&self) -> Option { unsafe { from_glib_none((*self.as_ptr()).src) } } - pub fn get_seqnum(&self) -> Seqnum { + pub fn seqnum(&self) -> Seqnum { unsafe { let seqnum = ffi::gst_message_get_seqnum(self.as_mut_ptr()); @@ -53,7 +53,7 @@ impl MessageRef { } } - pub fn get_structure(&self) -> Option<&StructureRef> { + pub fn structure(&self) -> Option<&StructureRef> { unsafe { let structure = ffi::gst_message_get_structure(self.as_mut_ptr()); if structure.is_null() { @@ -117,7 +117,7 @@ impl MessageRef { } } - pub fn get_type(&self) -> MessageType { + pub fn type_(&self) -> MessageType { unsafe { from_glib((*self.as_ptr()).type_) } } } @@ -152,12 +152,12 @@ impl fmt::Debug for MessageRef { .field( "src", &self - .get_src() - .map(|s| s.get_name()) + .src() + .map(|s| s.name()) .as_ref() .map(glib::GString::as_str), ) - .field("structure", &self.get_structure()) + .field("structure", &self.structure()) .finish() } } @@ -248,7 +248,7 @@ impl<'a> Error<'a> { ErrorBuilder::new(error, message) } - pub fn get_error(&self) -> glib::Error { + pub fn error(&self) -> glib::Error { unsafe { let mut error = ptr::null_mut(); @@ -258,7 +258,7 @@ impl<'a> Error<'a> { } } - pub fn get_debug(&self) -> Option { + pub fn debug(&self) -> Option { unsafe { let mut debug = ptr::null_mut(); @@ -270,7 +270,7 @@ impl<'a> Error<'a> { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] - pub fn get_details(&self) -> Option<&StructureRef> { + pub fn details(&self) -> Option<&StructureRef> { unsafe { let mut details = ptr::null(); @@ -298,7 +298,7 @@ impl<'a> Warning<'a> { WarningBuilder::new(error, message) } - pub fn get_error(&self) -> glib::Error { + pub fn error(&self) -> glib::Error { unsafe { let mut error = ptr::null_mut(); @@ -308,7 +308,7 @@ impl<'a> Warning<'a> { } } - pub fn get_debug(&self) -> Option { + pub fn debug(&self) -> Option { unsafe { let mut debug = ptr::null_mut(); @@ -320,7 +320,7 @@ impl<'a> Warning<'a> { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] - pub fn get_details(&self) -> Option<&StructureRef> { + pub fn details(&self) -> Option<&StructureRef> { unsafe { let mut details = ptr::null(); @@ -348,7 +348,7 @@ impl<'a> Info<'a> { InfoBuilder::new(error, message) } - pub fn get_error(&self) -> glib::Error { + pub fn error(&self) -> glib::Error { unsafe { let mut error = ptr::null_mut(); @@ -358,7 +358,7 @@ impl<'a> Info<'a> { } } - pub fn get_debug(&self) -> Option { + pub fn debug(&self) -> Option { unsafe { let mut debug = ptr::null_mut(); @@ -370,7 +370,7 @@ impl<'a> Info<'a> { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] - pub fn get_details(&self) -> Option<&StructureRef> { + pub fn details(&self) -> Option<&StructureRef> { unsafe { let mut details = ptr::null(); @@ -398,7 +398,7 @@ impl<'a> Tag<'a> { TagBuilder::new(tags) } - pub fn get_tags(&self) -> TagList { + pub fn tags(&self) -> TagList { unsafe { let mut tags = ptr::null_mut(); ffi::gst_message_parse_tag(self.as_mut_ptr(), &mut tags); @@ -420,7 +420,7 @@ impl<'a> Buffering<'a> { BufferingBuilder::new(percent) } - pub fn get_percent(&self) -> i32 { + pub fn percent(&self) -> i32 { unsafe { let mut p = mem::MaybeUninit::uninit(); ffi::gst_message_parse_buffering(self.as_mut_ptr(), p.as_mut_ptr()); @@ -428,7 +428,7 @@ impl<'a> Buffering<'a> { } } - pub fn get_buffering_stats(&self) -> (crate::BufferingMode, i32, i32, i64) { + pub fn buffering_stats(&self) -> (crate::BufferingMode, i32, i32, i64) { unsafe { let mut mode = mem::MaybeUninit::uninit(); let mut avg_in = mem::MaybeUninit::uninit(); @@ -470,7 +470,7 @@ impl<'a> StateChanged<'a> { StateChangedBuilder::new(old, new, pending) } - pub fn get_old(&self) -> crate::State { + pub fn old(&self) -> crate::State { unsafe { let mut state = mem::MaybeUninit::uninit(); @@ -485,7 +485,7 @@ impl<'a> StateChanged<'a> { } } - pub fn get_current(&self) -> crate::State { + pub fn current(&self) -> crate::State { unsafe { let mut state = mem::MaybeUninit::uninit(); @@ -500,7 +500,7 @@ impl<'a> StateChanged<'a> { } } - pub fn get_pending(&self) -> crate::State { + pub fn pending(&self) -> crate::State { unsafe { let mut state = mem::MaybeUninit::uninit(); @@ -633,7 +633,7 @@ impl<'a> ClockProvide<'a> { ClockProvideBuilder::new(clock, ready) } - pub fn get_clock(&self) -> Option { + pub fn clock(&self) -> Option { let mut clock = ptr::null_mut(); unsafe { @@ -643,7 +643,7 @@ impl<'a> ClockProvide<'a> { } } - pub fn get_ready(&self) -> bool { + pub fn is_ready(&self) -> bool { unsafe { let mut ready = mem::MaybeUninit::uninit(); @@ -671,7 +671,7 @@ impl<'a> ClockLost<'a> { ClockLostBuilder::new(clock) } - pub fn get_clock(&self) -> Option { + pub fn clock(&self) -> Option { let mut clock = ptr::null_mut(); unsafe { @@ -695,7 +695,7 @@ impl<'a> NewClock<'a> { NewClockBuilder::new(clock) } - pub fn get_clock(&self) -> Option { + pub fn clock(&self) -> Option { let mut clock = ptr::null_mut(); unsafe { @@ -769,7 +769,7 @@ impl<'a> StreamStatus<'a> { } } - pub fn get_stream_status_object(&self) -> Option { + pub fn stream_status_object(&self) -> Option { unsafe { let value = ffi::gst_message_get_stream_status_object(self.as_mut_ptr()); @@ -921,7 +921,7 @@ impl<'a> AsyncDone<'a> { AsyncDoneBuilder::new(running_time) } - pub fn get_running_time(&self) -> crate::ClockTime { + pub fn running_time(&self) -> crate::ClockTime { unsafe { let mut running_time = mem::MaybeUninit::uninit(); @@ -945,7 +945,7 @@ impl<'a> RequestState<'a> { RequestStateBuilder::new(state) } - pub fn get_requested_state(&self) -> crate::State { + pub fn requested_state(&self) -> crate::State { unsafe { let mut state = mem::MaybeUninit::uninit(); @@ -1074,7 +1074,7 @@ impl<'a> Qos<'a> { } } - pub fn get_values(&self) -> (i64, f64, i32) { + pub fn values(&self) -> (i64, f64, i32) { unsafe { let mut jitter = mem::MaybeUninit::uninit(); let mut proportion = mem::MaybeUninit::uninit(); @@ -1095,7 +1095,7 @@ impl<'a> Qos<'a> { } } - pub fn get_stats(&self) -> (GenericFormattedValue, GenericFormattedValue) { + pub fn stats(&self) -> (GenericFormattedValue, GenericFormattedValue) { unsafe { let mut format = mem::MaybeUninit::uninit(); let mut processed = mem::MaybeUninit::uninit(); @@ -1175,7 +1175,7 @@ impl<'a> Toc<'a> { TocBuilder::new(toc, updated) } - pub fn get_toc(&self) -> (crate::Toc, bool) { + pub fn toc(&self) -> (crate::Toc, bool) { unsafe { let mut toc = ptr::null_mut(); let mut updated = mem::MaybeUninit::uninit(); @@ -1198,7 +1198,7 @@ impl<'a> ResetTime<'a> { ResetTimeBuilder::new(running_time) } - pub fn get_running_time(&self) -> crate::ClockTime { + pub fn running_time(&self) -> crate::ClockTime { unsafe { let mut running_time = mem::MaybeUninit::uninit(); @@ -1222,7 +1222,7 @@ impl<'a> StreamStart<'a> { StreamStartBuilder::new() } - pub fn get_group_id(&self) -> Option { + pub fn group_id(&self) -> Option { unsafe { let mut group_id = mem::MaybeUninit::uninit(); @@ -1256,7 +1256,7 @@ impl<'a> NeedContext<'a> { NeedContextBuilder::new(context_type) } - pub fn get_context_type(&self) -> &str { + pub fn context_type(&self) -> &str { unsafe { let mut context_type = ptr::null(); @@ -1280,7 +1280,7 @@ impl<'a> HaveContext<'a> { HaveContextBuilder::new(context) } - pub fn get_context(&self) -> crate::Context { + pub fn context(&self) -> crate::Context { unsafe { let mut context = ptr::null_mut(); ffi::gst_message_parse_have_context(self.as_mut_ptr(), &mut context); @@ -1302,7 +1302,7 @@ impl<'a> DeviceAdded<'a> { DeviceAddedBuilder::new(device) } - pub fn get_device(&self) -> crate::Device { + pub fn device(&self) -> crate::Device { unsafe { let mut device = ptr::null_mut(); @@ -1326,7 +1326,7 @@ impl<'a> DeviceRemoved<'a> { DeviceRemovedBuilder::new(device) } - pub fn get_device(&self) -> crate::Device { + pub fn device(&self) -> crate::Device { unsafe { let mut device = ptr::null_mut(); @@ -1401,7 +1401,7 @@ impl<'a> StreamCollection<'a> { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] - pub fn get_stream_collection(&self) -> crate::StreamCollection { + pub fn stream_collection(&self) -> crate::StreamCollection { unsafe { let mut collection = ptr::null_mut(); @@ -1431,7 +1431,7 @@ impl<'a> StreamsSelected<'a> { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] - pub fn get_stream_collection(&self) -> crate::StreamCollection { + pub fn stream_collection(&self) -> crate::StreamCollection { unsafe { let mut collection = ptr::null_mut(); @@ -1443,7 +1443,7 @@ impl<'a> StreamsSelected<'a> { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] - pub fn get_streams(&self) -> Vec { + pub fn streams(&self) -> Vec { unsafe { let n = ffi::gst_message_streams_selected_get_size(self.as_mut_ptr()); @@ -1478,7 +1478,7 @@ impl<'a> Redirect<'a> { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] - pub fn get_entries(&self) -> Vec<(&str, Option, Option<&StructureRef>)> { + pub fn entries(&self) -> Vec<(&str, Option, Option<&StructureRef>)> { unsafe { let n = ffi::gst_message_get_num_redirect_entries(self.as_mut_ptr()); @@ -1535,7 +1535,7 @@ impl<'a> DeviceChanged<'a> { #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] - pub fn get_device_changed(&self) -> (crate::Device, crate::Device) { + pub fn device_changed(&self) -> (crate::Device, crate::Device) { unsafe { let mut device = ptr::null_mut(); let mut changed_device = ptr::null_mut(); @@ -2000,7 +2000,7 @@ impl<'a> StepDoneBuilder<'a> { eos: bool, ) -> Self { skip_assert_initialized!(); - assert_eq!(amount.get_format(), duration.get_format()); + assert_eq!(amount.format(), duration.format()); Self { builder: MessageBuilder::new(), amount, @@ -2014,12 +2014,12 @@ impl<'a> StepDoneBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_step_done( src, - s.amount.get_format().to_glib(), - s.amount.get_value() as u64, + s.amount.format().to_glib(), + s.amount.value() as u64, s.rate, s.flush.to_glib(), s.intermediate.to_glib(), - s.duration.get_value() as u64, + s.duration.value() as u64, s.eos.to_glib(), )); } @@ -2207,8 +2207,8 @@ impl<'a> SegmentStartBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_segment_start( src, - s.position.get_format().to_glib(), - s.position.get_value(), + s.position.format().to_glib(), + s.position.value(), )); } @@ -2228,8 +2228,8 @@ impl<'a> SegmentDoneBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_segment_done( src, - s.position.get_format().to_glib(), - s.position.get_value(), + s.position.format().to_glib(), + s.position.value(), )); } @@ -2349,8 +2349,8 @@ impl<'a> StepStartBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_step_start( src, s.active.to_glib(), - s.amount.get_format().to_glib(), - s.amount.get_value() as u64, + s.amount.format().to_glib(), + s.amount.value() as u64, s.rate, s.flush.to_glib(), s.intermediate.to_glib(), @@ -2399,7 +2399,7 @@ impl<'a> QosBuilder<'a> { pub fn stats>(self, processed: V, dropped: V) -> Self { let processed = processed.into(); let dropped = dropped.into(); - assert_eq!(processed.get_format(), dropped.get_format()); + assert_eq!(processed.format(), dropped.format()); Self { stats: Some((processed, dropped)), ..self @@ -2421,9 +2421,9 @@ impl<'a> QosBuilder<'a> { if let Some((processed, dropped)) = s.stats { ffi::gst_message_set_qos_stats( msg, - processed.get_format().to_glib(), - processed.get_value() as u64, - dropped.get_value() as u64, + processed.format().to_glib(), + processed.value() as u64, + dropped.value() as u64, ); } msg @@ -2839,8 +2839,8 @@ mod tests { let eos_msg = Eos::builder().seqnum(seqnum).build(); match eos_msg.view() { MessageView::Eos(eos_msg) => { - assert_eq!(eos_msg.get_seqnum(), seqnum); - assert!(eos_msg.get_structure().is_none()); + assert_eq!(eos_msg.seqnum(), seqnum); + assert!(eos_msg.structure().is_none()); } _ => panic!("eos_msg.view() is not a MessageView::Eos(_)"), } @@ -2849,7 +2849,7 @@ mod tests { let buffering_msg = Buffering::new(42); match buffering_msg.view() { MessageView::Buffering(buffering_msg) => { - assert_eq!(buffering_msg.get_percent(), 42); + assert_eq!(buffering_msg.percent(), 42); } _ => panic!("buffering_msg.view() is not a MessageView::Buffering(_)"), } @@ -2867,8 +2867,8 @@ mod tests { .build(); match eos_msg.view() { MessageView::Eos(eos_msg) => { - assert_eq!(eos_msg.get_seqnum(), seqnum); - if let Some(other_fields) = eos_msg.get_structure() { + assert_eq!(eos_msg.seqnum(), seqnum); + if let Some(other_fields) = eos_msg.structure() { assert!(other_fields.has_field("extra-field")); } } @@ -2880,8 +2880,8 @@ mod tests { .build(); match buffering_msg.view() { MessageView::Buffering(buffering_msg) => { - assert_eq!(buffering_msg.get_percent(), 42); - if let Some(other_fields) = buffering_msg.get_structure() { + assert_eq!(buffering_msg.percent(), 42); + if let Some(other_fields) = buffering_msg.structure() { assert!(other_fields.has_field("extra-field")); } } @@ -2899,7 +2899,7 @@ mod tests { ); match msg.view() { - MessageView::StreamStart(stream_start) => assert_eq!(seqnum, stream_start.get_seqnum()), + MessageView::StreamStart(stream_start) => assert_eq!(seqnum, stream_start.seqnum()), _ => panic!(), } } @@ -2909,7 +2909,7 @@ mod tests { crate::init().unwrap(); let msg = StreamStart::new(); - let seqnum_init = msg.get_seqnum(); + let seqnum_init = msg.seqnum(); // Invalid the seqnum unsafe { @@ -2921,7 +2921,7 @@ mod tests { MessageView::StreamStart(stream_start) => { // get_seqnum is expected to return a new Seqnum, // further in the sequence than the last known seqnum. - assert!(seqnum_init < stream_start.get_seqnum()); + assert!(seqnum_init < stream_start.seqnum()); } _ => panic!(), } diff --git a/gstreamer/src/meta.rs b/gstreamer/src/meta.rs index bacee8c32..a84663ba5 100644 --- a/gstreamer/src/meta.rs +++ b/gstreamer/src/meta.rs @@ -138,7 +138,7 @@ impl<'a, T: MetaAPI, U> AsRef> for MetaRefMut<'a, T, U> { } impl<'a, T: MetaAPI> MetaRef<'a, T> { - pub fn get_api(&self) -> glib::Type { + pub fn api(&self) -> glib::Type { unsafe { let meta = self.meta as *const _ as *const ffi::GstMeta; let info = (*meta).info; @@ -148,7 +148,7 @@ impl<'a, T: MetaAPI> MetaRef<'a, T> { #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] - pub fn get_seqnum(&self) -> MetaSeqnum { + pub fn seqnum(&self) -> MetaSeqnum { unsafe { let meta = self.meta as *const _ as *const ffi::GstMeta; MetaSeqnum(ffi::gst_meta_get_seqnum(meta)) @@ -163,7 +163,7 @@ impl<'a, T: MetaAPI> MetaRef<'a, T> { impl<'a> MetaRef<'a, Meta> { pub fn downcast_ref(&self) -> Option<&MetaRef<'a, T>> { let target_type = T::get_meta_api(); - let type_ = self.get_api(); + let type_ = self.api(); if type_ == glib::Type::INVALID || target_type == type_ { Some(unsafe { &*(self as *const MetaRef<'a, Meta> as *const MetaRef<'a, T>) }) @@ -174,7 +174,7 @@ impl<'a> MetaRef<'a, Meta> { } impl<'a, T: MetaAPI, U> MetaRefMut<'a, T, U> { - pub fn get_api(&self) -> glib::Type { + pub fn api(&self) -> glib::Type { unsafe { let meta = self.meta as *const _ as *const ffi::GstMeta; let info = (*meta).info; @@ -184,7 +184,7 @@ impl<'a, T: MetaAPI, U> MetaRefMut<'a, T, U> { #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] - pub fn get_seqnum(&self) -> u64 { + pub fn seqnum(&self) -> u64 { unsafe { let meta = self.meta as *const _ as *const ffi::GstMeta; ffi::gst_meta_get_seqnum(meta) @@ -215,7 +215,7 @@ impl<'a, T: MetaAPI> MetaRefMut<'a, T, Standalone> { impl<'a, U> MetaRefMut<'a, Meta, U> { pub fn downcast_ref(&mut self) -> Option<&MetaRefMut<'a, T, U>> { let target_type = T::get_meta_api(); - let type_ = self.get_api(); + let type_ = self.api(); if type_ == glib::Type::INVALID || target_type == type_ { Some(unsafe { &*(self as *mut MetaRefMut<'a, Meta, U> as *const MetaRefMut<'a, T, U>) }) @@ -232,7 +232,7 @@ unsafe impl Send for Meta {} unsafe impl Sync for Meta {} impl Meta { - fn get_api(&self) -> glib::Type { + fn api(&self) -> glib::Type { unsafe { glib::Type::from_glib((*self.0.info).api) } } } @@ -247,9 +247,7 @@ unsafe impl MetaAPI for Meta { impl fmt::Debug for Meta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Meta") - .field("api", &self.get_api()) - .finish() + f.debug_struct("Meta").field("api", &self.api()).finish() } } @@ -272,11 +270,11 @@ impl ParentBufferMeta { } } - pub fn get_parent(&self) -> &BufferRef { + pub fn parent(&self) -> &BufferRef { unsafe { BufferRef::from_ptr(self.0.buffer) } } - pub fn get_parent_owned(&self) -> Buffer { + pub fn parent_owned(&self) -> Buffer { unsafe { from_glib_none(self.0.buffer) } } } @@ -292,7 +290,7 @@ unsafe impl MetaAPI for ParentBufferMeta { impl fmt::Debug for ParentBufferMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ParentBufferMeta") - .field("parent", &self.get_parent()) + .field("parent", &self.parent()) .finish() } } @@ -313,11 +311,11 @@ impl ProtectionMeta { } } - pub fn get_info(&self) -> &crate::StructureRef { + pub fn info(&self) -> &crate::StructureRef { unsafe { crate::StructureRef::from_glib_borrow(self.0.info) } } - pub fn get_info_mut(&mut self) -> &mut crate::StructureRef { + pub fn info_mut(&mut self) -> &mut crate::StructureRef { unsafe { crate::StructureRef::from_glib_borrow_mut(self.0.info) } } } @@ -333,7 +331,7 @@ unsafe impl MetaAPI for ProtectionMeta { impl fmt::Debug for ProtectionMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ProtectionMeta") - .field("info", &self.get_info()) + .field("info", &self.info()) .finish() } } @@ -372,19 +370,19 @@ impl ReferenceTimestampMeta { } } - pub fn get_reference(&self) -> &CapsRef { + pub fn reference(&self) -> &CapsRef { unsafe { CapsRef::from_ptr(self.0.reference) } } - pub fn get_parent_owned(&self) -> Caps { + pub fn parent_owned(&self) -> Caps { unsafe { from_glib_none(self.0.reference) } } - pub fn get_timestamp(&self) -> ClockTime { + pub fn timestamp(&self) -> ClockTime { unsafe { from_glib(self.0.timestamp) } } - pub fn get_duration(&self) -> ClockTime { + pub fn duration(&self) -> ClockTime { unsafe { from_glib(self.0.duration) } } } @@ -404,9 +402,9 @@ unsafe impl MetaAPI for ReferenceTimestampMeta { impl fmt::Debug for ReferenceTimestampMeta { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ReferenceTimestampMeta") - .field("reference", &self.get_reference()) - .field("timestamp", &self.get_timestamp()) - .field("duration", &self.get_duration()) + .field("reference", &self.reference()) + .field("timestamp", &self.timestamp()) + .field("duration", &self.duration()) .finish() } } @@ -424,7 +422,7 @@ mod tests { { let meta = ParentBufferMeta::add(buffer.get_mut().unwrap(), &parent); unsafe { - assert_eq!(meta.get_parent().as_ptr(), parent.as_ptr()); + assert_eq!(meta.parent().as_ptr(), parent.as_ptr()); } } @@ -440,7 +438,7 @@ mod tests { let metas = buffer.iter_meta::().collect::>(); assert_eq!(metas.len(), 1); unsafe { - assert_eq!(metas[0].get_parent().as_ptr(), parent.as_ptr()); + assert_eq!(metas[0].parent().as_ptr(), parent.as_ptr()); } } { @@ -451,7 +449,7 @@ mod tests { .collect::>(); assert_eq!(metas.len(), 1); unsafe { - assert_eq!(metas[0].get_parent().as_ptr(), parent.as_ptr()); + assert_eq!(metas[0].parent().as_ptr(), parent.as_ptr()); } } @@ -462,7 +460,7 @@ mod tests { .get_meta_mut::() .unwrap(); unsafe { - assert_eq!(meta.get_parent().as_ptr(), parent.as_ptr()); + assert_eq!(meta.parent().as_ptr(), parent.as_ptr()); } meta.remove(); } diff --git a/gstreamer/src/object.rs b/gstreamer/src/object.rs index cdc4757a6..828e4897a 100644 --- a/gstreamer/src/object.rs +++ b/gstreamer/src/object.rs @@ -19,7 +19,7 @@ pub trait GstObjectExtManual: 'static { fn unset_object_flags(&self, flags: ObjectFlags); - fn get_object_flags(&self) -> ObjectFlags; + fn object_flags(&self) -> ObjectFlags; fn get_g_value_array( &self, @@ -93,7 +93,7 @@ impl> GstObjectExtManual for O { } } - fn get_object_flags(&self) -> ObjectFlags { + fn object_flags(&self) -> ObjectFlags { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); @@ -142,7 +142,7 @@ mod tests { let notify = Arc::new(Mutex::new(None)); let notify_clone = notify.clone(); bin.connect_deep_notify(None, move |_, id, prop| { - *notify_clone.lock().unwrap() = Some((id.clone(), prop.get_name())); + *notify_clone.lock().unwrap() = Some((id.clone(), prop.name())); }); identity.set_property("silent", &false).unwrap(); diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index 8c84c8cd4..f84da6204 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -136,7 +136,7 @@ pub trait PadExtManual: 'static { fn push_event(&self, event: Event) -> bool; fn send_event(&self, event: Event) -> bool; - fn get_last_flow_result(&self) -> Result; + fn last_flow_result(&self) -> Result; fn iterate_internal_links(&self) -> crate::Iterator; fn iterate_internal_links_default>( @@ -259,7 +259,7 @@ pub trait PadExtManual: 'static { fn query_position(&self) -> Option; fn query_position_generic(&self, format: Format) -> Option; - fn get_mode(&self) -> crate::PadMode; + fn mode(&self) -> crate::PadMode; fn sticky_events_foreach Result, Option>>( &self, @@ -272,7 +272,7 @@ pub trait PadExtManual: 'static { fn unset_pad_flags(&self, flags: PadFlags); - fn get_pad_flags(&self) -> PadFlags; + fn pad_flags(&self) -> PadFlags; } impl> PadExtManual for O { @@ -363,7 +363,7 @@ impl> PadExtManual for O { buffer: &mut crate::BufferRef, size: u32, ) -> Result<(), FlowError> { - assert!(buffer.get_size() >= size as usize); + assert!(buffer.size() >= size as usize); unsafe { let mut buffer_ref = buffer.as_mut_ptr(); @@ -406,7 +406,7 @@ impl> PadExtManual for O { buffer: &mut crate::BufferRef, size: u32, ) -> Result<(), FlowError> { - assert!(buffer.get_size() >= size as usize); + assert!(buffer.size() >= size as usize); unsafe { let mut buffer_ref = buffer.as_mut_ptr(); @@ -510,7 +510,7 @@ impl> PadExtManual for O { } } - fn get_last_flow_result(&self) -> Result { + fn last_flow_result(&self) -> Result { let ret: FlowReturn = unsafe { from_glib(ffi::gst_pad_get_last_flow_return( self.as_ref().to_glib_none().0, @@ -766,7 +766,7 @@ impl> PadExtManual for O { let mut dest_val = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_pad_peer_query_convert( self.as_ref().to_glib_none().0, - src_val.get_format().to_glib(), + src_val.format().to_glib(), src_val.to_raw_value(), U::get_default_format().to_glib(), dest_val.as_mut_ptr(), @@ -789,7 +789,7 @@ impl> PadExtManual for O { let mut dest_val = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_pad_peer_query_convert( self.as_ref().to_glib_none().0, - src_val.get_format().to_glib(), + src_val.format().to_glib(), src_val.to_raw_value(), dest_format.to_glib(), dest_val.as_mut_ptr(), @@ -879,7 +879,7 @@ impl> PadExtManual for O { let mut dest_val = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_pad_query_convert( self.as_ref().to_glib_none().0, - src_val.get_format().to_glib(), + src_val.format().to_glib(), src_val.to_raw_value(), U::get_default_format().to_glib(), dest_val.as_mut_ptr(), @@ -903,8 +903,8 @@ impl> PadExtManual for O { let mut dest_val = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_pad_query_convert( self.as_ref().to_glib_none().0, - src_val.get_format().to_glib(), - src_val.get_value(), + src_val.format().to_glib(), + src_val.value(), dest_format.to_glib(), dest_val.as_mut_ptr(), )); @@ -983,7 +983,7 @@ impl> PadExtManual for O { } } - fn get_mode(&self) -> crate::PadMode { + fn mode(&self) -> crate::PadMode { unsafe { let ptr: &ffi::GstPad = &*(self.as_ptr() as *const _); from_glib(ptr.mode) @@ -1065,7 +1065,7 @@ impl> PadExtManual for O { } } - fn get_pad_flags(&self) -> PadFlags { + fn pad_flags(&self) -> PadFlags { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); @@ -1682,7 +1682,7 @@ impl + IsA + glib::object::IsClass> PadBuilder { type_, &[ ("name", &name), - ("direction", &templ.get_property_direction()), + ("direction", &templ.property_direction()), ("template", templ), ], ) @@ -2113,9 +2113,9 @@ mod tests { assert_eq!(events.len(), 3); assert_eq!(buffers.len(), 2); - assert_eq!(events[0].get_type(), crate::EventType::Latency); - assert_eq!(events[1].get_type(), crate::EventType::StreamStart); - assert_eq!(events[2].get_type(), crate::EventType::Segment); + assert_eq!(events[0].type_(), crate::EventType::Latency); + assert_eq!(events[1].type_(), crate::EventType::StreamStart); + assert_eq!(events[2].type_(), crate::EventType::Segment); assert!( buffers.iter().all(|b| b.is_writable()), diff --git a/gstreamer/src/parse_context.rs b/gstreamer/src/parse_context.rs index fb75fa7f0..bc22057d1 100644 --- a/gstreamer/src/parse_context.rs +++ b/gstreamer/src/parse_context.rs @@ -29,7 +29,7 @@ impl ParseContext { unsafe { from_glib_full(ffi::gst_parse_context_new()) } } - pub fn get_missing_elements(&self) -> Vec { + pub fn missing_elements(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_parse_context_get_missing_elements( mut_override(self.to_glib_none().0), diff --git a/gstreamer/src/pipeline.rs b/gstreamer/src/pipeline.rs index 9b6a6ebc1..376b55fb7 100644 --- a/gstreamer/src/pipeline.rs +++ b/gstreamer/src/pipeline.rs @@ -10,7 +10,7 @@ pub trait GstPipelineExtManual: 'static { fn unset_pipeline_flags(&self, flags: PipelineFlags); - fn get_pipeline_flags(&self) -> PipelineFlags; + fn pipeline_flags(&self) -> PipelineFlags; } impl> GstPipelineExtManual for O { @@ -30,7 +30,7 @@ impl> GstPipelineExtManual for O { } } - fn get_pipeline_flags(&self) -> PipelineFlags { + fn pipeline_flags(&self) -> PipelineFlags { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); diff --git a/gstreamer/src/plugin.rs b/gstreamer/src/plugin.rs index 6ccc09a1a..1c5fbb590 100644 --- a/gstreamer/src/plugin.rs +++ b/gstreamer/src/plugin.rs @@ -9,7 +9,7 @@ use glib::translate::*; use glib::IsA; impl Plugin { - pub fn get_cache_data(&self) -> Option<&StructureRef> { + pub fn cache_data(&self) -> Option<&StructureRef> { unsafe { let cache_data = ffi::gst_plugin_get_cache_data(self.to_glib_none().0); if cache_data.is_null() { @@ -28,13 +28,13 @@ impl Plugin { } pub trait GstPluginExtManual: 'static { - fn get_plugin_flags(&self) -> PluginFlags; + fn plugin_flags(&self) -> PluginFlags; - fn get_plugin_name(&self) -> glib::GString; + fn plugin_name(&self) -> glib::GString; } impl> GstPluginExtManual for O { - fn get_plugin_flags(&self) -> PluginFlags { + fn plugin_flags(&self) -> PluginFlags { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); @@ -42,7 +42,7 @@ impl> GstPluginExtManual for O { } } - fn get_plugin_name(&self) -> glib::GString { + fn plugin_name(&self) -> glib::GString { unsafe { from_glib_none(ffi::gst_plugin_get_name(self.as_ref().to_glib_none().0)) } } } diff --git a/gstreamer/src/plugin_feature.rs b/gstreamer/src/plugin_feature.rs index f933d4f39..17530fe5d 100644 --- a/gstreamer/src/plugin_feature.rs +++ b/gstreamer/src/plugin_feature.rs @@ -7,13 +7,13 @@ use glib::object::{Cast, IsA}; use glib::translate::{from_glib, FromGlibPtrFull, ToGlib, ToGlibPtr}; pub trait PluginFeatureExtManual: Sized + 'static { - fn get_rank(&self) -> Rank; + fn rank(&self) -> Rank; fn set_rank(&self, rank: Rank); fn load(&self) -> Result; } impl> PluginFeatureExtManual for O { - fn get_rank(&self) -> Rank { + fn rank(&self) -> Rank { unsafe { let rank = ffi::gst_plugin_feature_get_rank(self.as_ref().to_glib_none().0); from_glib(rank as i32) @@ -48,7 +48,7 @@ mod tests { let factory = crate::ElementFactory::find("identity").unwrap(); let loaded = factory.load().unwrap(); - assert_eq!(factory.get_type(), loaded.get_type()); + assert_eq!(factory.type_(), loaded.type_()); let _element = loaded.create(None).unwrap(); } } diff --git a/gstreamer/src/promise.rs b/gstreamer/src/promise.rs index 3c4f56972..1cf2a13e5 100644 --- a/gstreamer/src/promise.rs +++ b/gstreamer/src/promise.rs @@ -53,7 +53,7 @@ impl Promise { let promise: Borrowed = from_glib_borrow(promise); let res = match promise.wait() { - PromiseResult::Replied => Ok(promise.get_reply()), + PromiseResult::Replied => Ok(promise.reply()), PromiseResult::Interrupted => Err(PromiseError::Interrupted), PromiseResult::Expired => Err(PromiseError::Expired), PromiseResult::Pending => { @@ -103,7 +103,7 @@ impl Promise { } } - pub fn get_reply(&self) -> Option<&StructureRef> { + pub fn reply(&self) -> Option<&StructureRef> { unsafe { let s = ffi::gst_promise_get_reply(self.to_glib_none().0); if s.is_null() { @@ -201,6 +201,6 @@ mod tests { let res = receiver.recv().unwrap(); let res = res.expect("promise failed").expect("promise returned None"); - assert_eq!(res.get_name(), "foo/bar"); + assert_eq!(res.name(), "foo/bar"); } } diff --git a/gstreamer/src/query.rs b/gstreamer/src/query.rs index dc5e61e6f..3071f8a5d 100644 --- a/gstreamer/src/query.rs +++ b/gstreamer/src/query.rs @@ -16,7 +16,7 @@ mini_object_wrapper!(Query, QueryRef, ffi::GstQuery, || { }); impl QueryRef { - pub fn get_structure(&self) -> Option<&StructureRef> { + pub fn structure(&self) -> Option<&StructureRef> { unsafe { let structure = ffi::gst_query_get_structure(self.as_mut_ptr()); if structure.is_null() { @@ -27,7 +27,7 @@ impl QueryRef { } } - pub fn get_mut_structure(&mut self) -> &mut StructureRef { + pub fn structure_mut(&mut self) -> &mut StructureRef { unsafe { let structure = ffi::gst_query_writable_structure(self.as_mut_ptr()); StructureRef::from_glib_borrow_mut(structure) @@ -90,7 +90,7 @@ impl fmt::Debug for QueryRef { let type_ = ffi::gst_query_type_get_name((*self.as_ptr()).type_); CStr::from_ptr(type_).to_str().unwrap() }) - .field("structure", &self.get_structure()) + .field("structure", &self.structure()) .finish() } } @@ -162,7 +162,7 @@ macro_rules! declare_concrete_query( pub struct $name<$param>($param); impl<'a> $name<&'a QueryRef> { - pub fn get_query(&self) -> &QueryRef { + pub fn query(&self) -> &QueryRef { self.0 } } @@ -186,7 +186,7 @@ macro_rules! declare_concrete_query( } impl<'a> $name<&'a mut QueryRef> { - pub fn get_mut_query(&mut self) -> &mut QueryRef { + pub fn query_mut(&mut self) -> &mut QueryRef { self.0 } } @@ -223,7 +223,7 @@ impl Position { } impl Position { - pub fn get_result(&self) -> GenericFormattedValue { + pub fn result(&self) -> GenericFormattedValue { unsafe { let mut fmt = mem::MaybeUninit::uninit(); let mut pos = mem::MaybeUninit::uninit(); @@ -234,7 +234,7 @@ impl Position { } } - pub fn get_format(&self) -> crate::Format { + pub fn format(&self) -> crate::Format { unsafe { let mut fmt = mem::MaybeUninit::uninit(); @@ -248,13 +248,9 @@ impl Position { impl Position { pub fn set>(&mut self, pos: V) { let pos = pos.into(); - assert_eq!(pos.get_format(), self.get_format()); + assert_eq!(pos.format(), self.format()); unsafe { - ffi::gst_query_set_position( - self.0.as_mut_ptr(), - pos.get_format().to_glib(), - pos.get_value(), - ); + ffi::gst_query_set_position(self.0.as_mut_ptr(), pos.format().to_glib(), pos.value()); } } } @@ -268,7 +264,7 @@ impl Duration { } impl Duration { - pub fn get_result(&self) -> GenericFormattedValue { + pub fn result(&self) -> GenericFormattedValue { unsafe { let mut fmt = mem::MaybeUninit::uninit(); let mut pos = mem::MaybeUninit::uninit(); @@ -279,7 +275,7 @@ impl Duration { } } - pub fn get_format(&self) -> crate::Format { + pub fn format(&self) -> crate::Format { unsafe { let mut fmt = mem::MaybeUninit::uninit(); @@ -293,13 +289,9 @@ impl Duration { impl Duration { pub fn set>(&mut self, dur: V) { let dur = dur.into(); - assert_eq!(dur.get_format(), self.get_format()); + assert_eq!(dur.format(), self.format()); unsafe { - ffi::gst_query_set_duration( - self.0.as_mut_ptr(), - dur.get_format().to_glib(), - dur.get_value(), - ); + ffi::gst_query_set_duration(self.0.as_mut_ptr(), dur.format().to_glib(), dur.value()); } } } @@ -319,7 +311,7 @@ impl Default for Latency { } impl Latency { - pub fn get_result(&self) -> (bool, crate::ClockTime, crate::ClockTime) { + pub fn result(&self) -> (bool, crate::ClockTime, crate::ClockTime) { unsafe { let mut live = mem::MaybeUninit::uninit(); let mut min = mem::MaybeUninit::uninit(); @@ -363,7 +355,7 @@ impl Seeking { } impl Seeking { - pub fn get_result(&self) -> (bool, GenericFormattedValue, GenericFormattedValue) { + pub fn result(&self) -> (bool, GenericFormattedValue, GenericFormattedValue) { unsafe { let mut fmt = mem::MaybeUninit::uninit(); let mut seekable = mem::MaybeUninit::uninit(); @@ -385,7 +377,7 @@ impl Seeking { } } - pub fn get_format(&self) -> crate::Format { + pub fn format(&self) -> crate::Format { unsafe { let mut fmt = mem::MaybeUninit::uninit(); ffi::gst_query_parse_seeking( @@ -406,16 +398,16 @@ impl Seeking { let start = start.into(); let end = end.into(); - assert_eq!(self.get_format(), start.get_format()); - assert_eq!(start.get_format(), end.get_format()); + assert_eq!(self.format(), start.format()); + assert_eq!(start.format(), end.format()); unsafe { ffi::gst_query_set_seeking( self.0.as_mut_ptr(), - start.get_format().to_glib(), + start.format().to_glib(), seekable.to_glib(), - start.get_value(), - end.get_value(), + start.value(), + end.value(), ); } } @@ -430,7 +422,7 @@ impl Segment { } impl Segment { - pub fn get_result(&self) -> (f64, GenericFormattedValue, GenericFormattedValue) { + pub fn result(&self) -> (f64, GenericFormattedValue, GenericFormattedValue) { unsafe { let mut rate = mem::MaybeUninit::uninit(); let mut fmt = mem::MaybeUninit::uninit(); @@ -452,7 +444,7 @@ impl Segment { } } - pub fn get_format(&self) -> crate::Format { + pub fn format(&self) -> crate::Format { unsafe { let mut fmt = mem::MaybeUninit::uninit(); @@ -473,15 +465,15 @@ impl Segment { let start = start.into(); let stop = stop.into(); - assert_eq!(start.get_format(), stop.get_format()); + assert_eq!(start.format(), stop.format()); unsafe { ffi::gst_query_set_segment( self.0.as_mut_ptr(), rate, - start.get_format().to_glib(), - start.get_value(), - stop.get_value(), + start.format().to_glib(), + start.value(), + stop.value(), ); } } @@ -494,8 +486,8 @@ impl Convert { let value = value.into(); unsafe { Self(from_glib_full(ffi::gst_query_new_convert( - value.get_format().to_glib(), - value.get_value(), + value.format().to_glib(), + value.value(), dest_fmt.to_glib(), ))) } @@ -503,7 +495,7 @@ impl Convert { } impl Convert { - pub fn get_result(&self) -> (GenericFormattedValue, GenericFormattedValue) { + pub fn result(&self) -> (GenericFormattedValue, GenericFormattedValue) { unsafe { let mut src_fmt = mem::MaybeUninit::uninit(); let mut src = mem::MaybeUninit::uninit(); @@ -553,10 +545,10 @@ impl Convert { unsafe { ffi::gst_query_set_convert( self.0.as_mut_ptr(), - src.get_format().to_glib(), - src.get_value(), - dest.get_format().to_glib(), - dest.get_value(), + src.format().to_glib(), + src.value(), + dest.format().to_glib(), + dest.value(), ); } } @@ -577,7 +569,7 @@ impl Default for Formats { } impl Formats { - pub fn get_result(&self) -> Vec { + pub fn result(&self) -> Vec { unsafe { let mut n = mem::MaybeUninit::uninit(); ffi::gst_query_parse_n_formats(self.0.as_ptr(), n.as_mut_ptr()); @@ -613,7 +605,7 @@ impl Buffering { } impl Buffering { - pub fn get_format(&self) -> crate::Format { + pub fn format(&self) -> crate::Format { unsafe { let mut fmt = mem::MaybeUninit::uninit(); @@ -629,7 +621,7 @@ impl Buffering { } } - pub fn get_percent(&self) -> (bool, i32) { + pub fn percent(&self) -> (bool, i32) { unsafe { let mut busy = mem::MaybeUninit::uninit(); let mut percent = mem::MaybeUninit::uninit(); @@ -644,7 +636,7 @@ impl Buffering { } } - pub fn get_range(&self) -> (GenericFormattedValue, GenericFormattedValue, i64) { + pub fn range(&self) -> (GenericFormattedValue, GenericFormattedValue, i64) { unsafe { let mut fmt = mem::MaybeUninit::uninit(); let mut start = mem::MaybeUninit::uninit(); @@ -666,7 +658,7 @@ impl Buffering { } } - pub fn get_stats(&self) -> (crate::BufferingMode, i32, i32, i64) { + pub fn stats(&self) -> (crate::BufferingMode, i32, i32, i64) { unsafe { let mut mode = mem::MaybeUninit::uninit(); let mut avg_in = mem::MaybeUninit::uninit(); @@ -690,7 +682,7 @@ impl Buffering { } } - pub fn get_ranges(&self) -> Vec<(GenericFormattedValue, GenericFormattedValue)> { + pub fn ranges(&self) -> Vec<(GenericFormattedValue, GenericFormattedValue)> { unsafe { let mut fmt = mem::MaybeUninit::uninit(); ffi::gst_query_parse_buffering_range( @@ -742,15 +734,15 @@ impl Buffering { let start = start.into(); let stop = stop.into(); - assert_eq!(self.get_format(), start.get_format()); - assert_eq!(start.get_format(), stop.get_format()); + assert_eq!(self.format(), start.format()); + assert_eq!(start.format(), stop.format()); unsafe { ffi::gst_query_set_buffering_range( self.0.as_mut_ptr(), - start.get_format().to_glib(), - start.get_value(), - stop.get_value(), + start.format().to_glib(), + start.value(), + stop.value(), estimated_total, ); } @@ -780,17 +772,17 @@ impl Buffering { ranges: &[(V, V)], ) { unsafe { - let fmt = self.get_format(); + let fmt = self.format(); for &(start, stop) in ranges { let start = start.into(); let stop = stop.into(); - assert_eq!(start.get_format(), fmt); - assert_eq!(stop.get_format(), fmt); + assert_eq!(start.format(), fmt); + assert_eq!(stop.format(), fmt); ffi::gst_query_add_buffering_range( self.0.as_mut_ptr(), - start.get_value(), - stop.get_value(), + start.value(), + stop.value(), ); } } @@ -825,7 +817,7 @@ impl Default for Uri { } impl Uri { - pub fn get_uri(&self) -> Option { + pub fn uri(&self) -> Option { unsafe { let mut uri = ptr::null_mut(); ffi::gst_query_parse_uri(self.0.as_ptr(), &mut uri); @@ -833,7 +825,7 @@ impl Uri { } } - pub fn get_redirection(&self) -> (Option, bool) { + pub fn redirection(&self) -> (Option, bool) { unsafe { let mut uri = ptr::null_mut(); ffi::gst_query_parse_uri_redirection(self.0.as_ptr(), &mut uri); @@ -896,7 +888,7 @@ impl Allocation { } } - pub fn get_allocation_pools(&self) -> Vec<(Option, u32, u32, u32)> { + pub fn allocation_pools(&self) -> Vec<(Option, u32, u32, u32)> { unsafe { let n = ffi::gst_query_get_n_allocation_pools(self.0.as_ptr()); let mut pools = Vec::with_capacity(n as usize); @@ -926,7 +918,7 @@ impl Allocation { } } - pub fn get_allocation_metas(&self) -> Vec<(glib::Type, Option<&crate::StructureRef>)> { + pub fn allocation_metas(&self) -> Vec<(glib::Type, Option<&crate::StructureRef>)> { unsafe { let n = ffi::gst_query_get_n_allocation_metas(self.0.as_ptr()); let mut metas = Vec::with_capacity(n as usize); @@ -1074,7 +1066,7 @@ impl Scheduling { } } - pub fn get_scheduling_modes(&self) -> Vec { + pub fn scheduling_modes(&self) -> Vec { unsafe { let n = ffi::gst_query_get_n_scheduling_modes(self.0.as_ptr()); let mut res = Vec::with_capacity(n as usize); @@ -1089,7 +1081,7 @@ impl Scheduling { } } - pub fn get_result(&self) -> (crate::SchedulingFlags, i32, i32, i32) { + pub fn result(&self) -> (crate::SchedulingFlags, i32, i32, i32) { unsafe { let mut flags = mem::MaybeUninit::uninit(); let mut minsize = mem::MaybeUninit::uninit(); @@ -1149,7 +1141,7 @@ impl AcceptCaps { } impl AcceptCaps { - pub fn get_caps(&self) -> &crate::CapsRef { + pub fn caps(&self) -> &crate::CapsRef { unsafe { let mut caps = ptr::null_mut(); ffi::gst_query_parse_accept_caps(self.0.as_ptr(), &mut caps); @@ -1157,11 +1149,11 @@ impl AcceptCaps { } } - pub fn get_caps_owned(&self) -> crate::Caps { - unsafe { from_glib_none(self.get_caps().as_ptr()) } + pub fn caps_owned(&self) -> crate::Caps { + unsafe { from_glib_none(self.caps().as_ptr()) } } - pub fn get_result(&self) -> bool { + pub fn result(&self) -> bool { unsafe { let mut accepted = mem::MaybeUninit::uninit(); ffi::gst_query_parse_accept_caps_result(self.0.as_ptr(), accepted.as_mut_ptr()); @@ -1191,7 +1183,7 @@ impl Caps { } impl Caps { - pub fn get_filter(&self) -> Option<&crate::CapsRef> { + pub fn filter(&self) -> Option<&crate::CapsRef> { unsafe { let mut caps = ptr::null_mut(); ffi::gst_query_parse_caps(self.0.as_ptr(), &mut caps); @@ -1203,11 +1195,11 @@ impl Caps { } } - pub fn get_filter_owned(&self) -> Option { - unsafe { self.get_filter().map(|caps| from_glib_none(caps.as_ptr())) } + pub fn filter_owned(&self) -> Option { + unsafe { self.filter().map(|caps| from_glib_none(caps.as_ptr())) } } - pub fn get_result(&self) -> Option<&crate::CapsRef> { + pub fn result(&self) -> Option<&crate::CapsRef> { unsafe { let mut caps = ptr::null_mut(); ffi::gst_query_parse_caps_result(self.0.as_ptr(), &mut caps); @@ -1219,8 +1211,8 @@ impl Caps { } } - pub fn get_result_owned(&self) -> Option { - unsafe { self.get_result().map(|caps| from_glib_none(caps.as_ptr())) } + pub fn result_owned(&self) -> Option { + unsafe { self.result().map(|caps| from_glib_none(caps.as_ptr())) } } } @@ -1259,7 +1251,7 @@ impl Context { } impl Context { - pub fn get_context(&self) -> Option<&crate::ContextRef> { + pub fn context(&self) -> Option<&crate::ContextRef> { unsafe { let mut context = ptr::null_mut(); ffi::gst_query_parse_context(self.0.as_ptr(), &mut context); @@ -1271,14 +1263,14 @@ impl Context { } } - pub fn get_context_owned(&self) -> Option { + pub fn context_owned(&self) -> Option { unsafe { - self.get_context() + self.context() .map(|context| from_glib_none(context.as_ptr())) } } - pub fn get_context_type(&self) -> &str { + pub fn context_type(&self) -> &str { unsafe { let mut context_type = ptr::null(); ffi::gst_query_parse_context_type(self.0.as_ptr(), &mut context_type); @@ -1317,7 +1309,7 @@ impl Default for Bitrate { impl Bitrate { #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] - pub fn get_bitrate(&self) -> u32 { + pub fn bitrate(&self) -> u32 { unsafe { let mut bitrate = mem::MaybeUninit::uninit(); ffi::gst_query_parse_bitrate(self.0.as_ptr(), bitrate.as_mut_ptr()); @@ -1351,10 +1343,10 @@ mod tests { skip_assert_initialized!(); match query.view_mut() { QueryView::Position(ref mut p) => { - let pos = p.get_result(); + let pos = p.result(); assert_eq!(pos.try_into(), Ok(crate::CLOCK_TIME_NONE)); p.set(3 * crate::SECOND); - let pos = p.get_result(); + let pos = p.result(); assert_eq!(pos.try_into(), Ok(3 * crate::SECOND)); } _ => panic!("Wrong concrete Query in Query"), @@ -1365,7 +1357,7 @@ mod tests { skip_assert_initialized!(); match query.view() { QueryView::Position(ref p) => { - let pos = p.get_result(); + let pos = p.result(); assert_eq!(pos.try_into(), Ok(3 * crate::SECOND)); unsafe { assert!(!p.as_mut_ptr().is_null()); @@ -1376,10 +1368,10 @@ mod tests { } let mut p = Position::new(crate::Format::Time); - let pos = p.get_result(); + let pos = p.result(); assert_eq!(pos.try_into(), Ok(crate::CLOCK_TIME_NONE)); - p.get_mut_structure().set("check_mut", &true); + p.structure_mut().set("check_mut", &true); // deref assert!(!p.is_serialized()); @@ -1387,7 +1379,7 @@ mod tests { { check_mut(&mut p); - let structure = p.get_structure(); + let structure = p.structure(); structure.unwrap().has_field("check_mut"); // Expected: cannot borrow `p` as mutable because it is also borrowed as immutable @@ -1411,7 +1403,7 @@ mod tests { } if let QueryView::Duration(d) = &query.view() { - let duration = d.get_result(); + let duration = d.result(); assert_eq!(duration.try_into(), Ok(2 * crate::SECOND)); } } diff --git a/gstreamer/src/sample.rs b/gstreamer/src/sample.rs index ec9628aa4..7de1f848c 100644 --- a/gstreamer/src/sample.rs +++ b/gstreamer/src/sample.rs @@ -106,7 +106,7 @@ impl Sample { } impl SampleRef { - pub fn get_buffer(&self) -> Option<&BufferRef> { + pub fn buffer(&self) -> Option<&BufferRef> { unsafe { let ptr = ffi::gst_sample_get_buffer(self.as_mut_ptr()); if ptr.is_null() { @@ -117,14 +117,11 @@ impl SampleRef { } } - pub fn get_buffer_owned(&self) -> Option { - unsafe { - self.get_buffer() - .map(|buffer| from_glib_none(buffer.as_ptr())) - } + pub fn buffer_owned(&self) -> Option { + unsafe { self.buffer().map(|buffer| from_glib_none(buffer.as_ptr())) } } - pub fn get_buffer_list(&self) -> Option<&BufferListRef> { + pub fn buffer_list(&self) -> Option<&BufferListRef> { unsafe { let ptr = ffi::gst_sample_get_buffer_list(self.as_mut_ptr()); if ptr.is_null() { @@ -135,14 +132,11 @@ impl SampleRef { } } - pub fn get_buffer_list_owned(&self) -> Option { - unsafe { - self.get_buffer_list() - .map(|list| from_glib_none(list.as_ptr())) - } + pub fn buffer_list_owned(&self) -> Option { + unsafe { self.buffer_list().map(|list| from_glib_none(list.as_ptr())) } } - pub fn get_caps(&self) -> Option<&CapsRef> { + pub fn caps(&self) -> Option<&CapsRef> { unsafe { let ptr = ffi::gst_sample_get_caps(self.as_mut_ptr()); if ptr.is_null() { @@ -153,15 +147,15 @@ impl SampleRef { } } - pub fn get_caps_owned(&self) -> Option { - unsafe { self.get_caps().map(|caps| from_glib_none(caps.as_ptr())) } + pub fn caps_owned(&self) -> Option { + unsafe { self.caps().map(|caps| from_glib_none(caps.as_ptr())) } } - pub fn get_segment(&self) -> Option { + pub fn segment(&self) -> Option { unsafe { from_glib_none(ffi::gst_sample_get_segment(self.as_mut_ptr())) } } - pub fn get_info(&self) -> Option<&StructureRef> { + pub fn info(&self) -> Option<&StructureRef> { unsafe { let ptr = ffi::gst_sample_get_info(self.as_mut_ptr()); if ptr.is_null() { @@ -217,10 +211,10 @@ impl fmt::Debug for Sample { impl fmt::Debug for SampleRef { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Sample") - .field("buffer", &self.get_buffer()) - .field("caps", &self.get_caps()) - .field("segment", &self.get_segment()) - .field("info", &self.get_info()) + .field("buffer", &self.buffer()) + .field("caps", &self.caps()) + .field("segment", &self.segment()) + .field("info", &self.info()) .finish() } } @@ -239,6 +233,6 @@ mod tests { .build(); let sample = Sample::builder().info(info).build(); - assert!(sample.get_info().is_some()); + assert!(sample.info().is_some()); } } diff --git a/gstreamer/src/sample_serde.rs b/gstreamer/src/sample_serde.rs index c36f04bbe..f51126331 100644 --- a/gstreamer/src/sample_serde.rs +++ b/gstreamer/src/sample_serde.rs @@ -14,11 +14,11 @@ use crate::Structure; impl<'a> Serialize for SampleRef { fn serialize(&self, serializer: S) -> Result { let mut sample = serializer.serialize_struct("Sample", 5)?; - sample.serialize_field("buffer", &self.get_buffer())?; - sample.serialize_field("buffer_list", &self.get_buffer_list())?; - sample.serialize_field("caps", &self.get_caps())?; - sample.serialize_field("segment", &self.get_segment())?; - sample.serialize_field("info", &self.get_info())?; + sample.serialize_field("buffer", &self.buffer())?; + sample.serialize_field("buffer_list", &self.buffer_list())?; + sample.serialize_field("caps", &self.caps())?; + sample.serialize_field("segment", &self.segment())?; + sample.serialize_field("info", &self.info())?; sample.end() } } @@ -276,17 +276,17 @@ mod tests { ])), )"#; let sample: Sample = ron::de::from_str(buffer_ron).unwrap(); - let buffer = sample.get_buffer().unwrap(); - assert_eq!(buffer.get_pts(), 1.into()); - assert_eq!(buffer.get_offset_end(), 4); + let buffer = sample.buffer().unwrap(); + assert_eq!(buffer.pts(), 1.into()); + assert_eq!(buffer.offset_end(), 4); { let data = buffer.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![1, 2, 3, 4].as_slice()); } - assert!(sample.get_buffer_list().is_none()); - assert!(sample.get_caps().is_some()); - assert!(sample.get_segment().is_some()); - assert!(sample.get_info().is_some()); + assert!(sample.buffer_list().is_none()); + assert!(sample.caps().is_some()); + assert!(sample.segment().is_some()); + assert!(sample.info().is_some()); let buffer_ron = r#" ( @@ -309,12 +309,12 @@ mod tests { info: None, )"#; let sample: Sample = ron::de::from_str(buffer_ron).unwrap(); - assert!(sample.get_buffer().is_none()); - assert!(sample.get_buffer_list().is_some()); - assert!(sample.get_caps().is_none()); + assert!(sample.buffer().is_none()); + assert!(sample.buffer_list().is_some()); + assert!(sample.caps().is_none()); // Not true in GStreamer 1.x, should be fixed in version 2.0 //assert!(sample.get_segment().is_none()); - assert!(sample.get_info().is_none()); + assert!(sample.info().is_none()); } #[test] @@ -363,16 +363,16 @@ mod tests { }; let sample_ser = ron::ser::to_string(&sample).unwrap(); let sample_de: Sample = ron::de::from_str(sample_ser.as_str()).unwrap(); - let buffer_de = sample_de.get_buffer().unwrap(); - assert_eq!(buffer_de.get_pts(), 1.into()); - assert_eq!(buffer_de.get_offset_end(), 4); + let buffer_de = sample_de.buffer().unwrap(); + assert_eq!(buffer_de.pts(), 1.into()); + assert_eq!(buffer_de.offset_end(), 4); { let data = buffer_de.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![1, 2, 3, 4].as_slice()); } - assert!(sample_de.get_buffer_list().is_none()); - assert!(sample_de.get_caps().is_some()); - assert!(sample_de.get_segment().is_some()); - assert!(sample_de.get_info().is_some()); + assert!(sample_de.buffer_list().is_none()); + assert!(sample_de.caps().is_some()); + assert!(sample_de.segment().is_some()); + assert!(sample_de.info().is_some()); } } diff --git a/gstreamer/src/segment.rs b/gstreamer/src/segment.rs index 5b2842655..bb7d71484 100644 --- a/gstreamer/src/segment.rs +++ b/gstreamer/src/segment.rs @@ -27,8 +27,7 @@ impl Segment { } pub fn downcast(self) -> Result, Self> { - if T::get_default_format() == Format::Undefined - || T::get_default_format() == self.get_format() + if T::get_default_format() == Format::Undefined || T::get_default_format() == self.format() { Ok(FormattedSegment(self.0, PhantomData)) } else { @@ -37,8 +36,7 @@ impl Segment { } pub fn downcast_ref(&self) -> Option<&FormattedSegment> { - if T::get_default_format() == Format::Undefined - || T::get_default_format() == self.get_format() + if T::get_default_format() == Format::Undefined || T::get_default_format() == self.format() { Some(unsafe { &*(self as *const FormattedSegment @@ -50,8 +48,7 @@ impl Segment { } pub fn downcast_mut(&mut self) -> Option<&mut FormattedSegment> { - if T::get_default_format() == Format::Undefined - || T::get_default_format() == self.get_format() + if T::get_default_format() == Format::Undefined || T::get_default_format() == self.format() { Some(unsafe { &mut *(self as *mut FormattedSegment @@ -95,8 +92,8 @@ impl FormattedSegment { let stop = stop.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), start.get_format()); - assert_eq!(self.get_format(), stop.get_format()); + assert_eq!(self.format(), start.format()); + assert_eq!(self.format(), stop.format()); } unsafe { @@ -104,7 +101,7 @@ impl FormattedSegment { let mut clip_stop = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_segment_clip( &self.0, - start.get_format().to_glib(), + start.format().to_glib(), start.to_raw_value() as u64, stop.to_raw_value() as u64, clip_start.as_mut_ptr(), @@ -112,8 +109,8 @@ impl FormattedSegment { )); if ret { Some(( - T::from_raw(self.get_format(), clip_start.assume_init() as i64), - T::from_raw(self.get_format(), clip_stop.assume_init() as i64), + T::from_raw(self.format(), clip_start.assume_init() as i64), + T::from_raw(self.format(), clip_stop.assume_init() as i64), )) } else { None @@ -136,8 +133,8 @@ impl FormattedSegment { let stop = stop.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), start.get_format()); - assert_eq!(self.get_format(), stop.get_format()); + assert_eq!(self.format(), start.format()); + assert_eq!(self.format(), stop.format()); } unsafe { @@ -145,7 +142,7 @@ impl FormattedSegment { let ret = from_glib(ffi::gst_segment_do_seek( &mut self.0, rate, - self.get_format().to_glib(), + self.format().to_glib(), flags.to_glib(), start_type.to_glib(), start.to_raw_value() as u64, @@ -164,11 +161,7 @@ impl FormattedSegment { pub fn offset_running_time(&mut self, offset: i64) -> Result<(), glib::BoolError> { unsafe { glib::result_from_gboolean!( - ffi::gst_segment_offset_running_time( - &mut self.0, - self.get_format().to_glib(), - offset, - ), + ffi::gst_segment_offset_running_time(&mut self.0, self.format().to_glib(), offset,), "Offset is not in the segment" ) } @@ -178,15 +171,15 @@ impl FormattedSegment { let running_time = running_time.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), running_time.get_format()); + assert_eq!(self.format(), running_time.format()); } unsafe { T::from_raw( - self.get_format(), + self.format(), ffi::gst_segment_position_from_running_time( &self.0, - self.get_format().to_glib(), + self.format().to_glib(), running_time.to_raw_value() as u64, ) as i64, ) @@ -197,20 +190,20 @@ impl FormattedSegment { let running_time = running_time.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), running_time.get_format()); + assert_eq!(self.format(), running_time.format()); } unsafe { let mut position = mem::MaybeUninit::uninit(); let ret = ffi::gst_segment_position_from_running_time_full( &self.0, - self.get_format().to_glib(), + self.format().to_glib(), running_time.to_raw_value() as u64, position.as_mut_ptr(), ); ( ret, - T::from_raw(self.get_format(), position.assume_init() as i64), + T::from_raw(self.format(), position.assume_init() as i64), ) } } @@ -219,15 +212,15 @@ impl FormattedSegment { let stream_time = stream_time.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), stream_time.get_format()); + assert_eq!(self.format(), stream_time.format()); } unsafe { T::from_raw( - self.get_format(), + self.format(), ffi::gst_segment_position_from_stream_time( &self.0, - self.get_format().to_glib(), + self.format().to_glib(), stream_time.to_raw_value() as u64, ) as i64, ) @@ -238,20 +231,20 @@ impl FormattedSegment { let stream_time = stream_time.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), stream_time.get_format()); + assert_eq!(self.format(), stream_time.format()); } unsafe { let mut position = mem::MaybeUninit::uninit(); let ret = ffi::gst_segment_position_from_stream_time_full( &self.0, - self.get_format().to_glib(), + self.format().to_glib(), stream_time.to_raw_value() as u64, position.as_mut_ptr(), ); ( ret, - T::from_raw(self.get_format(), position.assume_init() as i64), + T::from_raw(self.format(), position.assume_init() as i64), ) } } @@ -260,14 +253,14 @@ impl FormattedSegment { let running_time = running_time.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), running_time.get_format()); + assert_eq!(self.format(), running_time.format()); } unsafe { glib::result_from_gboolean!( ffi::gst_segment_set_running_time( &mut self.0, - self.get_format().to_glib(), + self.format().to_glib(), running_time.to_raw_value() as u64, ), "Running time is not in the segment" @@ -279,15 +272,15 @@ impl FormattedSegment { let position = position.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), position.get_format()); + assert_eq!(self.format(), position.format()); } unsafe { T::from_raw( - self.get_format(), + self.format(), ffi::gst_segment_to_running_time( &self.0, - self.get_format().to_glib(), + self.format().to_glib(), position.to_raw_value() as u64, ) as i64, ) @@ -298,20 +291,20 @@ impl FormattedSegment { let position = position.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), position.get_format()); + assert_eq!(self.format(), position.format()); } unsafe { let mut running_time = mem::MaybeUninit::uninit(); let ret = ffi::gst_segment_to_running_time_full( &self.0, - self.get_format().to_glib(), + self.format().to_glib(), position.to_raw_value() as u64, running_time.as_mut_ptr(), ); ( ret, - T::from_raw(self.get_format(), running_time.assume_init() as i64), + T::from_raw(self.format(), running_time.assume_init() as i64), ) } } @@ -320,15 +313,15 @@ impl FormattedSegment { let position = position.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), position.get_format()); + assert_eq!(self.format(), position.format()); } unsafe { T::from_raw( - self.get_format(), + self.format(), ffi::gst_segment_to_stream_time( &self.0, - self.get_format().to_glib(), + self.format().to_glib(), position.to_raw_value() as u64, ) as i64, ) @@ -339,25 +332,25 @@ impl FormattedSegment { let position = position.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), position.get_format()); + assert_eq!(self.format(), position.format()); } unsafe { let mut stream_time = mem::MaybeUninit::uninit(); let ret = ffi::gst_segment_to_stream_time_full( &self.0, - self.get_format().to_glib(), + self.format().to_glib(), position.to_raw_value() as u64, stream_time.as_mut_ptr(), ); ( ret, - T::from_raw(self.get_format(), stream_time.assume_init() as i64), + T::from_raw(self.format(), stream_time.assume_init() as i64), ) } } - pub fn get_flags(&self) -> crate::SegmentFlags { + pub fn flags(&self) -> crate::SegmentFlags { unsafe { from_glib(self.0.flags) } } @@ -365,7 +358,7 @@ impl FormattedSegment { self.0.flags = flags.to_glib(); } - pub fn get_rate(&self) -> f64 { + pub fn rate(&self) -> f64 { self.0.rate } @@ -375,7 +368,7 @@ impl FormattedSegment { self.0.rate = rate; } - pub fn get_applied_rate(&self) -> f64 { + pub fn applied_rate(&self) -> f64 { self.0.applied_rate } @@ -385,103 +378,103 @@ impl FormattedSegment { self.0.applied_rate = applied_rate; } - pub fn get_format(&self) -> Format { + pub fn format(&self) -> Format { unsafe { from_glib(self.0.format) } } - pub fn get_base(&self) -> T { - unsafe { T::from_raw(self.get_format(), self.0.base as i64) } + pub fn base(&self) -> T { + unsafe { T::from_raw(self.format(), self.0.base as i64) } } pub fn set_base>(&mut self, base: V) { let base = base.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), base.get_format()); + assert_eq!(self.format(), base.format()); } self.0.base = unsafe { base.to_raw_value() } as u64; } - pub fn get_offset(&self) -> T { - unsafe { T::from_raw(self.get_format(), self.0.offset as i64) } + pub fn offset(&self) -> T { + unsafe { T::from_raw(self.format(), self.0.offset as i64) } } pub fn set_offset>(&mut self, offset: V) { let offset = offset.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), offset.get_format()); + assert_eq!(self.format(), offset.format()); } self.0.offset = unsafe { offset.to_raw_value() } as u64; } - pub fn get_start(&self) -> T { - unsafe { T::from_raw(self.get_format(), self.0.start as i64) } + pub fn start(&self) -> T { + unsafe { T::from_raw(self.format(), self.0.start as i64) } } pub fn set_start>(&mut self, start: V) { let start = start.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), start.get_format()); + assert_eq!(self.format(), start.format()); } self.0.start = unsafe { start.to_raw_value() } as u64; } - pub fn get_stop(&self) -> T { - unsafe { T::from_raw(self.get_format(), self.0.stop as i64) } + pub fn stop(&self) -> T { + unsafe { T::from_raw(self.format(), self.0.stop as i64) } } pub fn set_stop>(&mut self, stop: V) { let stop = stop.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), stop.get_format()); + assert_eq!(self.format(), stop.format()); } self.0.stop = unsafe { stop.to_raw_value() } as u64; } - pub fn get_time(&self) -> T { - unsafe { T::from_raw(self.get_format(), self.0.time as i64) } + pub fn time(&self) -> T { + unsafe { T::from_raw(self.format(), self.0.time as i64) } } pub fn set_time>(&mut self, time: V) { let time = time.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), time.get_format()); + assert_eq!(self.format(), time.format()); } self.0.time = unsafe { time.to_raw_value() } as u64; } - pub fn get_position(&self) -> T { - unsafe { T::from_raw(self.get_format(), self.0.position as i64) } + pub fn position(&self) -> T { + unsafe { T::from_raw(self.format(), self.0.position as i64) } } pub fn set_position>(&mut self, position: V) { let position = position.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), position.get_format()); + assert_eq!(self.format(), position.format()); } self.0.position = unsafe { position.to_raw_value() } as u64; } - pub fn get_duration(&self) -> T { - unsafe { T::from_raw(self.get_format(), self.0.duration as i64) } + pub fn duration(&self) -> T { + unsafe { T::from_raw(self.format(), self.0.duration as i64) } } pub fn set_duration>(&mut self, duration: V) { let duration = duration.into(); if T::get_default_format() == Format::Undefined { - assert_eq!(self.get_format(), duration.get_format()); + assert_eq!(self.format(), duration.format()); } self.0.duration = unsafe { duration.to_raw_value() } as u64; @@ -517,7 +510,7 @@ impl AsRef for FormattedSegment { impl fmt::Debug for FormattedSegment { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let segment = self.as_ref(); - match segment.get_format() { + match segment.format() { Format::Undefined => f .debug_struct("Segment") .field("format", &Format::Undefined) @@ -526,31 +519,31 @@ impl fmt::Debug for FormattedSegment { let segment = segment.downcast_ref::().unwrap(); f.debug_struct("Segment") .field("format", &Format::Time) - .field("start", &segment.get_start().to_string()) - .field("offset", &segment.get_offset().to_string()) - .field("stop", &segment.get_stop().to_string()) - .field("rate", &segment.get_rate()) - .field("applied_rate", &segment.get_applied_rate()) - .field("flags", &segment.get_flags()) - .field("time", &segment.get_time().to_string()) - .field("base", &segment.get_base().to_string()) - .field("position", &segment.get_position().to_string()) - .field("duration", &segment.get_duration().to_string()) + .field("start", &segment.start().to_string()) + .field("offset", &segment.offset().to_string()) + .field("stop", &segment.stop().to_string()) + .field("rate", &segment.rate()) + .field("applied_rate", &segment.applied_rate()) + .field("flags", &segment.flags()) + .field("time", &segment.time().to_string()) + .field("base", &segment.base().to_string()) + .field("position", &segment.position().to_string()) + .field("duration", &segment.duration().to_string()) .finish() } _ => f .debug_struct("Segment") - .field("format", &segment.get_format()) - .field("start", &segment.get_start()) - .field("offset", &segment.get_offset()) - .field("stop", &segment.get_stop()) - .field("rate", &segment.get_rate()) - .field("applied_rate", &segment.get_applied_rate()) - .field("flags", &segment.get_flags()) - .field("time", &segment.get_time()) - .field("base", &segment.get_base()) - .field("position", &segment.get_position()) - .field("duration", &segment.get_duration()) + .field("format", &segment.format()) + .field("start", &segment.start()) + .field("offset", &segment.offset()) + .field("stop", &segment.stop()) + .field("rate", &segment.rate()) + .field("applied_rate", &segment.applied_rate()) + .field("flags", &segment.flags()) + .field("time", &segment.time()) + .field("base", &segment.base()) + .field("position", &segment.position()) + .field("duration", &segment.duration()) .finish(), } } diff --git a/gstreamer/src/segment_serde.rs b/gstreamer/src/segment_serde.rs index 03f834490..1eb3dee26 100644 --- a/gstreamer/src/segment_serde.rs +++ b/gstreamer/src/segment_serde.rs @@ -31,17 +31,17 @@ impl Serialize for FormattedSegment { fn serialize(&self, serializer: S) -> Result { let fmt_seg = unsafe { FormattedSegmentSerde { - flags: self.get_flags(), - rate: self.get_rate(), - applied_rate: self.get_applied_rate(), - format: self.get_format(), - base: self.get_base().to_raw_value(), - offset: self.get_offset().to_raw_value(), - start: self.get_start().to_raw_value(), - stop: self.get_stop().to_raw_value(), - time: self.get_time().to_raw_value(), - position: self.get_position().to_raw_value(), - duration: self.get_duration().to_raw_value(), + flags: self.flags(), + rate: self.rate(), + applied_rate: self.applied_rate(), + format: self.format(), + base: self.base().to_raw_value(), + offset: self.offset().to_raw_value(), + start: self.start().to_raw_value(), + stop: self.stop().to_raw_value(), + time: self.time().to_raw_value(), + position: self.position().to_raw_value(), + duration: self.duration().to_raw_value(), } }; fmt_seg.serialize(serializer) @@ -98,7 +98,7 @@ impl<'de, T: FormattedValue + SpecificFormattedValue> Deserialize<'de> for Forma segment.downcast::().map_err(|segment| { de::Error::custom(format!( "failed to convert segment with format {:?} to {:?}", - segment.get_format(), + segment.format(), T::get_default_format(), )) }) @@ -180,39 +180,36 @@ mod tests { "#; let segment: Segment = ron::de::from_str(segment_ron).unwrap(); + assert_eq!(segment.flags(), SegmentFlags::RESET | SegmentFlags::SEGMENT); + assert!((segment.rate() - 1f64).abs() < std::f64::EPSILON); + assert!((segment.applied_rate() - 0.9f64).abs() < std::f64::EPSILON); + assert_eq!(segment.format(), Format::Time); assert_eq!( - segment.get_flags(), - SegmentFlags::RESET | SegmentFlags::SEGMENT - ); - assert!((segment.get_rate() - 1f64).abs() < std::f64::EPSILON); - assert!((segment.get_applied_rate() - 0.9f64).abs() < std::f64::EPSILON); - assert_eq!(segment.get_format(), Format::Time); - assert_eq!( - segment.get_base(), + segment.base(), GenericFormattedValue::Time(ClockTime::from_nseconds(123)) ); assert_eq!( - segment.get_offset(), + segment.offset(), GenericFormattedValue::Time(ClockTime::from_nseconds(42)) ); assert_eq!( - segment.get_start(), + segment.start(), GenericFormattedValue::Time(ClockTime::from_nseconds(1024)) ); assert_eq!( - segment.get_stop(), + segment.stop(), GenericFormattedValue::Time(ClockTime::from_nseconds(2048)) ); assert_eq!( - segment.get_time(), + segment.time(), GenericFormattedValue::Time(ClockTime::from_nseconds(1042)) ); assert_eq!( - segment.get_position(), + segment.position(), GenericFormattedValue::Time(ClockTime::from_nseconds(256)) ); assert_eq!( - segment.get_duration(), + segment.duration(), GenericFormattedValue::Time(ClockTime::none()) ); } @@ -243,20 +240,17 @@ mod tests { "#; let fmt_seg: FormattedSegment