From 890cd036329975bd049d20300d8543f2a00f6323 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Tue, 27 Apr 2021 17:15:46 +0200 Subject: [PATCH] manual renames of to_glib into into_glib --- examples/src/bin/custom_meta.rs | 6 +- examples/src/bin/rtsp-server-record.rs | 8 +- gstreamer-app/src/app_sink.rs | 21 +++-- gstreamer-app/src/app_src.rs | 10 +-- gstreamer-audio/src/audio_channel_position.rs | 30 +++---- gstreamer-audio/src/audio_decoder.rs | 2 +- gstreamer-audio/src/audio_format.rs | 8 +- gstreamer-audio/src/audio_format_info.rs | 14 +-- gstreamer-audio/src/audio_info.rs | 22 ++--- gstreamer-audio/src/audio_meta.rs | 4 +- gstreamer-audio/src/audio_ring_buffer_spec.rs | 2 +- gstreamer-audio/src/audio_stream_align.rs | 4 +- gstreamer-audio/src/functions.rs | 4 +- gstreamer-audio/src/subclass/audio_decoder.rs | 32 +++---- gstreamer-audio/src/subclass/audio_encoder.rs | 28 +++--- gstreamer-audio/src/subclass/audio_sink.rs | 8 +- gstreamer-audio/src/subclass/audio_src.rs | 10 +-- gstreamer-base/src/aggregator.rs | 6 +- gstreamer-base/src/base_parse.rs | 10 +-- gstreamer-base/src/base_parse_frame.rs | 8 +- gstreamer-base/src/base_sink.rs | 4 +- gstreamer-base/src/base_src.rs | 2 +- gstreamer-base/src/flow_combiner.rs | 4 +- gstreamer-base/src/subclass/aggregator.rs | 40 ++++----- gstreamer-base/src/subclass/aggregator_pad.rs | 4 +- gstreamer-base/src/subclass/base_parse.rs | 14 +-- gstreamer-base/src/subclass/base_sink.rs | 22 ++--- gstreamer-base/src/subclass/base_src.rs | 32 +++---- gstreamer-base/src/subclass/base_transform.rs | 48 +++++------ gstreamer-base/src/subclass/push_src.rs | 6 +- gstreamer-check/src/harness.rs | 16 ++-- gstreamer-gl/egl/src/gl_display_egl.rs | 2 +- gstreamer-gl/src/gl_context.rs | 10 +-- gstreamer-gl/src/gl_memory.rs | 8 +- gstreamer-gl/src/subclass/gl_base_filter.rs | 4 +- gstreamer-gl/src/subclass/gl_filter.rs | 10 +-- gstreamer-net/src/net_client_clock.rs | 4 +- gstreamer-net/src/ntp_clock.rs | 4 +- gstreamer-pbutils/src/encoding_profile.rs | 6 +- .../src/subclass/player_video_renderer.rs | 9 +- gstreamer-rtp/src/rtp_buffer.rs | 6 +- gstreamer-rtsp-server/src/rtsp_auth.rs | 2 +- .../src/rtsp_session_pool.rs | 4 +- gstreamer-rtsp-server/src/rtsp_thread.rs | 2 +- .../src/subclass/rtsp_client.rs | 24 +++--- .../src/subclass/rtsp_media.rs | 10 +-- .../src/subclass/rtsp_media_factory.rs | 2 +- gstreamer-video/src/functions.rs | 10 +-- gstreamer-video/src/subclass/video_decoder.rs | 36 ++++---- gstreamer-video/src/subclass/video_encoder.rs | 30 +++---- gstreamer-video/src/subclass/video_sink.rs | 2 +- gstreamer-video/src/video_codec_frame.rs | 6 +- gstreamer-video/src/video_color_matrix.rs | 4 +- gstreamer-video/src/video_decoder.rs | 12 +-- gstreamer-video/src/video_encoder.rs | 4 +- gstreamer-video/src/video_event.rs | 18 ++-- gstreamer-video/src/video_format.rs | 12 +-- gstreamer-video/src/video_format_info.rs | 10 +-- gstreamer-video/src/video_info.rs | 62 ++++++------- gstreamer-video/src/video_meta.rs | 18 ++-- .../src/video_overlay_composition.rs | 16 ++-- gstreamer-video/src/video_rectangle.rs | 4 +- gstreamer-video/src/video_time_code.rs | 6 +- .../src/web_rtc_session_description.rs | 2 +- gstreamer/src/allocation_params.rs | 2 +- gstreamer/src/bin.rs | 8 +- gstreamer/src/buffer.rs | 22 ++--- gstreamer/src/buffer_pool.rs | 10 ++- gstreamer/src/bufferlist.rs | 6 +- gstreamer/src/bus.rs | 12 +-- gstreamer/src/caps.rs | 4 +- gstreamer/src/caps_features.rs | 6 +- gstreamer/src/clock.rs | 44 +++++----- gstreamer/src/clock_time.rs | 8 +- gstreamer/src/context.rs | 4 +- gstreamer/src/control_binding.rs | 4 +- gstreamer/src/control_source.rs | 4 +- gstreamer/src/date_time_serde.rs | 4 +- gstreamer/src/device_monitor.rs | 6 +- gstreamer/src/device_provider.rs | 4 +- gstreamer/src/element.rs | 60 ++++++------- gstreamer/src/element_factory_list_type.rs | 4 +- gstreamer/src/enums.rs | 46 +++++----- gstreamer/src/event.rs | 58 ++++++------- gstreamer/src/functions.rs | 10 +-- gstreamer/src/ghost_pad.rs | 8 +- gstreamer/src/iterator.rs | 10 +-- gstreamer/src/log.rs | 8 +- gstreamer/src/message.rs | 62 ++++++------- gstreamer/src/meta.rs | 6 +- gstreamer/src/object.rs | 8 +- gstreamer/src/pad.rs | 86 +++++++++---------- gstreamer/src/pad_template.rs | 2 +- gstreamer/src/param_spec.rs | 4 +- gstreamer/src/pipeline.rs | 4 +- gstreamer/src/plugin_feature.rs | 7 +- gstreamer/src/query.rs | 69 ++++++++------- gstreamer/src/segment.rs | 44 +++++----- gstreamer/src/stream.rs | 8 +- gstreamer/src/structure.rs | 14 +-- gstreamer/src/subclass/bin.rs | 4 +- gstreamer/src/subclass/clock.rs | 14 +-- gstreamer/src/subclass/device.rs | 2 +- gstreamer/src/subclass/device_provider.rs | 2 +- gstreamer/src/subclass/element.rs | 12 +-- gstreamer/src/subclass/plugin_1_14.rs | 2 +- gstreamer/src/subclass/uri_handler.rs | 8 +- gstreamer/src/tag_setter.rs | 2 +- gstreamer/src/tags.rs | 14 +-- gstreamer/src/toc.rs | 16 ++-- gstreamer/src/typefind.rs | 4 +- 111 files changed, 782 insertions(+), 752 deletions(-) diff --git a/examples/src/bin/custom_meta.rs b/examples/src/bin/custom_meta.rs index 960dcb832..04471c286 100644 --- a/examples/src/bin/custom_meta.rs +++ b/examples/src/bin/custom_meta.rs @@ -118,7 +118,7 @@ mod custom_meta { // Need to initialize all our fields correctly here. ptr::write(&mut meta.label, params.label); - true.to_glib() + true.into_glib() } // Free function for our meta. This needs to free/drop all memory we allocated. @@ -148,7 +148,7 @@ mod custom_meta { // and do things conditional on that, or even just drop the meta. super::CustomMeta::add(gst::BufferRef::from_mut_ptr(dest), meta.label.clone()); - true.to_glib() + true.into_glib() } // Register the meta itself with its functions. @@ -160,7 +160,7 @@ mod custom_meta { static META_INFO: Lazy = Lazy::new(|| unsafe { MetaInfo( ptr::NonNull::new(gst::ffi::gst_meta_register( - custom_meta_api_get_type().to_glib(), + custom_meta_api_get_type().into_glib(), b"MyCustomMeta\0".as_ptr() as *const _, mem::size_of::(), Some(custom_meta_init), diff --git a/examples/src/bin/rtsp-server-record.rs b/examples/src/bin/rtsp-server-record.rs index 23ba09b02..5d09df196 100644 --- a/examples/src/bin/rtsp-server-record.rs +++ b/examples/src/bin/rtsp-server-record.rs @@ -90,11 +90,11 @@ fn main_loop() -> Result<(), Error> { gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_ACCESS .to_glib_none() .0, - ::static_type().to_glib() as *const u8, - true.to_glib() as *const u8, + ::static_type().into_glib() as *const u8, + true.into_glib() as *const u8, gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_CONSTRUCT.as_ptr() as *const u8, - ::static_type().to_glib() as *const u8, - true.to_glib() as *const u8, + ::static_type().into_glib() as *const u8, + true.into_glib() as *const u8, ptr::null_mut::(), ); } diff --git a/gstreamer-app/src/app_sink.rs b/gstreamer-app/src/app_sink.rs index b1138a556..c1590eb87 100644 --- a/gstreamer-app/src/app_sink.rs +++ b/gstreamer-app/src/app_sink.rs @@ -180,7 +180,7 @@ unsafe extern "C" fn trampoline_new_preroll( if callbacks.panicked.load(Ordering::Relaxed) { let element: Borrowed = from_glib_borrow(appsink); gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); - return gst::FlowReturn::Error.to_glib(); + return gst::FlowReturn::Error.into_glib(); } let ret = if let Some(ref new_preroll) = callbacks.new_preroll { @@ -200,7 +200,7 @@ unsafe extern "C" fn trampoline_new_preroll( gst::FlowReturn::Error }; - ret.to_glib() + ret.into_glib() } unsafe extern "C" fn trampoline_new_sample( @@ -213,7 +213,7 @@ unsafe extern "C" fn trampoline_new_sample( if callbacks.panicked.load(Ordering::Relaxed) { let element: Borrowed = from_glib_borrow(appsink); gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); - return gst::FlowReturn::Error.to_glib(); + return gst::FlowReturn::Error.into_glib(); } let ret = if let Some(ref new_sample) = callbacks.new_sample { @@ -233,7 +233,7 @@ unsafe extern "C" fn trampoline_new_sample( gst::FlowReturn::Error }; - ret.to_glib() + ret.into_glib() } unsafe extern "C" fn destroy_callbacks(ptr: gpointer) { @@ -252,15 +252,18 @@ impl AppSink { // This is not thread-safe before 1.16.3, see // https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/merge_requests/570 if gst::version() < (1, 16, 3, 0) { - if !glib::gobject_ffi::g_object_get_qdata(sink as *mut _, SET_ONCE_QUARK.to_glib()) - .is_null() + if !glib::gobject_ffi::g_object_get_qdata( + sink as *mut _, + SET_ONCE_QUARK.into_glib(), + ) + .is_null() { panic!("AppSink callbacks can only be set once"); } glib::gobject_ffi::g_object_set_qdata( sink as *mut _, - SET_ONCE_QUARK.to_glib(), + SET_ONCE_QUARK.into_glib(), 1 as *mut _, ); } @@ -326,7 +329,7 @@ unsafe extern "C" fn new_sample_trampoline< ) -> gst::ffi::GstFlowReturn { let f: &F = &*(f as *const F); let ret: gst::FlowReturn = f(&from_glib_borrow(this)).into(); - ret.to_glib() + ret.into_glib() } unsafe extern "C" fn new_preroll_trampoline< @@ -337,7 +340,7 @@ unsafe extern "C" fn new_preroll_trampoline< ) -> gst::ffi::GstFlowReturn { let f: &F = &*(f as *const F); let ret: gst::FlowReturn = f(&from_glib_borrow(this)).into(); - ret.to_glib() + ret.into_glib() } #[cfg(any(feature = "v1_10"))] diff --git a/gstreamer-app/src/app_src.rs b/gstreamer-app/src/app_src.rs index 28eaf84d5..414ecd4d9 100644 --- a/gstreamer-app/src/app_src.rs +++ b/gstreamer-app/src/app_src.rs @@ -180,7 +180,7 @@ unsafe extern "C" fn trampoline_seek_data( if callbacks.panicked.load(Ordering::Relaxed) { let element: Borrowed = from_glib_borrow(appsrc); gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); - return false.to_glib(); + return false.into_glib(); } let ret = if let Some(ref seek_data) = callbacks.seek_data { @@ -199,7 +199,7 @@ unsafe extern "C" fn trampoline_seek_data( false }; - ret.to_glib() + ret.into_glib() } unsafe extern "C" fn destroy_callbacks(ptr: gpointer) { @@ -258,7 +258,7 @@ impl AppSrc { // This is not thread-safe before 1.16.3, see // https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/merge_requests/570 if gst::version() < (1, 16, 3, 0) { - if !glib::gobject_ffi::g_object_get_qdata(src as *mut _, SET_ONCE_QUARK.to_glib()) + if !glib::gobject_ffi::g_object_get_qdata(src as *mut _, SET_ONCE_QUARK.into_glib()) .is_null() { panic!("AppSrc callbacks can only be set once"); @@ -266,7 +266,7 @@ impl AppSrc { glib::gobject_ffi::g_object_set_qdata( src as *mut _, - SET_ONCE_QUARK.to_glib(), + SET_ONCE_QUARK.into_glib(), 1 as *mut _, ); } @@ -282,7 +282,7 @@ impl AppSrc { pub fn set_latency(&self, min: gst::ClockTime, max: gst::ClockTime) { unsafe { - ffi::gst_app_src_set_latency(self.to_glib_none().0, min.to_glib(), max.to_glib()); + ffi::gst_app_src_set_latency(self.to_glib_none().0, min.into_glib(), max.into_glib()); } } diff --git a/gstreamer-audio/src/audio_channel_position.rs b/gstreamer-audio/src/audio_channel_position.rs index f0ac71e68..4984013d5 100644 --- a/gstreamer-audio/src/audio_channel_position.rs +++ b/gstreamer-audio/src/audio_channel_position.rs @@ -4,11 +4,11 @@ use crate::AudioChannelPosition; use std::mem; -use glib::translate::{from_glib, ToGlib}; +use glib::translate::{from_glib, IntoGlib}; impl AudioChannelPosition { pub fn to_mask(self) -> u64 { - let pos = self.to_glib(); + let pos = self.into_glib(); if pos < 0 { return 0; } @@ -31,7 +31,7 @@ impl AudioChannelPosition { if i >= len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { - positions[i].to_glib() + positions[i].into_glib() } }); @@ -40,7 +40,7 @@ impl AudioChannelPosition { let valid: bool = from_glib(ffi::gst_audio_channel_positions_to_mask( positions_raw.as_ptr() as *mut _, len as i32, - force_order.to_glib(), + force_order.into_glib(), mask.as_mut_ptr(), )); if valid { @@ -100,7 +100,7 @@ impl AudioChannelPosition { if i >= len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { - positions[i].to_glib() + positions[i].into_glib() } }); @@ -144,7 +144,7 @@ impl AudioChannelPosition { if i >= len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { - positions[i].to_glib() + positions[i].into_glib() } }); @@ -152,7 +152,7 @@ impl AudioChannelPosition { from_glib(ffi::gst_audio_check_valid_channel_positions( positions_raw.as_ptr() as *mut _, len as i32, - force_order.to_glib(), + force_order.into_glib(), )) } } @@ -178,7 +178,7 @@ pub fn buffer_reorder_channels( if i >= from_len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { - from[i].to_glib() + from[i].into_glib() } }); @@ -186,14 +186,14 @@ pub fn buffer_reorder_channels( if i >= to_len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { - to[i].to_glib() + to[i].into_glib() } }); let valid: bool = unsafe { from_glib(ffi::gst_audio_buffer_reorder_channels( buffer.as_mut_ptr(), - format.to_glib(), + format.into_glib(), channels as i32, from_raw.as_ptr() as *mut _, to_raw.as_ptr() as *mut _, @@ -227,7 +227,7 @@ pub fn reorder_channels( if i >= from_len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { - from[i].to_glib() + from[i].into_glib() } }); @@ -235,7 +235,7 @@ pub fn reorder_channels( if i >= to_len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { - to[i].to_glib() + to[i].into_glib() } }); @@ -243,7 +243,7 @@ pub fn reorder_channels( from_glib(ffi::gst_audio_reorder_channels( data.as_mut_ptr() as *mut _, data.len(), - format.to_glib(), + format.into_glib(), channels as i32, from_raw.as_ptr() as *mut _, to_raw.as_ptr() as *mut _, @@ -275,7 +275,7 @@ pub fn channel_reorder_map( if i >= from_len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { - from[i].to_glib() + from[i].into_glib() } }); @@ -283,7 +283,7 @@ pub fn channel_reorder_map( if i >= to_len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { - to[i].to_glib() + to[i].into_glib() } }); diff --git a/gstreamer-audio/src/audio_decoder.rs b/gstreamer-audio/src/audio_decoder.rs index 3ad792e01..728b82a68 100644 --- a/gstreamer-audio/src/audio_decoder.rs +++ b/gstreamer-audio/src/audio_decoder.rs @@ -159,7 +159,7 @@ impl> AudioDecoderExtManual for O { from_glib(_gst_audio_decoder_error( self.as_ref().to_glib_none().0, weight, - T::domain().to_glib(), + T::domain().into_glib(), code.code(), message.to_glib_full(), debug.to_glib_full(), diff --git a/gstreamer-audio/src/audio_format.rs b/gstreamer-audio/src/audio_format.rs index b3a28439f..a86eb646f 100644 --- a/gstreamer-audio/src/audio_format.rs +++ b/gstreamer-audio/src/audio_format.rs @@ -3,7 +3,7 @@ use std::ffi::CStr; use std::str; -use glib::translate::{from_glib, ToGlib}; +use glib::translate::{from_glib, IntoGlib}; use once_cell::sync::Lazy; @@ -104,8 +104,8 @@ impl crate::AudioFormat { unsafe { from_glib(ffi::gst_audio_format_build_integer( - sign.to_glib(), - endianness.to_glib(), + sign.into_glib(), + endianness.into_glib(), width, depth, )) @@ -118,7 +118,7 @@ impl crate::AudioFormat { } unsafe { CStr::from_ptr( - ffi::gst_audio_format_to_string(self.to_glib()) + ffi::gst_audio_format_to_string(self.into_glib()) .as_ref() .expect("gst_audio_format_to_string returned NULL"), ) diff --git a/gstreamer-audio/src/audio_format_info.rs b/gstreamer-audio/src/audio_format_info.rs index 4dbe79557..3990090c5 100644 --- a/gstreamer-audio/src/audio_format_info.rs +++ b/gstreamer-audio/src/audio_format_info.rs @@ -5,7 +5,7 @@ use std::ffi::CStr; use std::fmt; use std::str; -use glib::translate::{from_glib, from_glib_none, FromGlib, ToGlib, ToGlibPtr, ToGlibPtrMut}; +use glib::translate::{from_glib, from_glib_none, FromGlib, IntoGlib, ToGlibPtr, ToGlibPtrMut}; use glib::StaticType; #[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)] @@ -28,11 +28,11 @@ impl FromGlib for AudioEndianness { } } -impl ToGlib for AudioEndianness { +impl IntoGlib for AudioEndianness { type GlibType = i32; - fn to_glib(&self) -> i32 { - match *self { + fn into_glib(self) -> i32 { + match self { AudioEndianness::LittleEndian => 1234, AudioEndianness::BigEndian => 4321, _ => 0, @@ -47,7 +47,7 @@ impl AudioFormatInfo { assert_initialized_main_thread!(); unsafe { - let info = ffi::gst_audio_format_get_info(format.to_glib()); + let info = ffi::gst_audio_format_get_info(format.into_glib()); assert!(!info.is_null()); AudioFormatInfo(&*info) @@ -116,7 +116,7 @@ impl AudioFormatInfo { unsafe { (self.0.unpack_func.as_ref().unwrap())( self.0, - flags.to_glib(), + flags.into_glib(), dest.as_mut_ptr() as *mut _, src.as_ptr() as *const _, nsamples as i32, @@ -150,7 +150,7 @@ impl AudioFormatInfo { unsafe { (self.0.pack_func.as_ref().unwrap())( self.0, - flags.to_glib(), + flags.into_glib(), src.as_ptr() as *const _, dest.as_mut_ptr() as *mut _, nsamples as i32, diff --git a/gstreamer-audio/src/audio_info.rs b/gstreamer-audio/src/audio_info.rs index 78abf1a0c..7f22d605c 100644 --- a/gstreamer-audio/src/audio_info.rs +++ b/gstreamer-audio/src/audio_info.rs @@ -1,6 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr, ToGlibPtrMut}; +use glib::translate::{ + from_glib, from_glib_full, from_glib_none, IntoGlib, ToGlibPtr, ToGlibPtrMut, +}; use gst::prelude::*; use std::fmt; @@ -46,14 +48,14 @@ impl<'a> AudioInfoBuilder<'a> { if i >= self.channels as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { - p[i].to_glib() + p[i].into_glib() } }); let valid: bool = from_glib(ffi::gst_audio_check_valid_channel_positions( positions.as_ptr() as *mut _, self.channels as i32, - true.to_glib(), + true.into_glib(), )); if !valid { return Err(glib::bool_error!("channel positions are invalid")); @@ -71,7 +73,7 @@ impl<'a> AudioInfoBuilder<'a> { ffi::gst_audio_info_set_format( info.as_mut_ptr(), - self.format.to_glib(), + self.format.into_glib(), self.rate as i32, self.channels as i32, positions_ptr as *mut _, @@ -84,11 +86,11 @@ impl<'a> AudioInfoBuilder<'a> { } if let Some(flags) = self.flags { - info.flags = flags.to_glib(); + info.flags = flags.into_glib(); } if let Some(layout) = self.layout { - info.layout = layout.to_glib(); + info.layout = layout.into_glib(); } let positions = array_init::array_init(|i| from_glib(info.position[i])); @@ -179,9 +181,9 @@ impl AudioInfo { let mut dest_val = mem::MaybeUninit::uninit(); if from_glib(ffi::gst_audio_info_convert( &self.0, - src_val.format().to_glib(), + src_val.format().into_glib(), src_val.to_raw_value(), - U::default_format().to_glib(), + U::default_format().into_glib(), dest_val.as_mut_ptr(), )) { Some(U::from_raw(U::default_format(), dest_val.assume_init())) @@ -203,9 +205,9 @@ impl AudioInfo { let mut dest_val = mem::MaybeUninit::uninit(); if from_glib(ffi::gst_audio_info_convert( &self.0, - src_val.format().to_glib(), + src_val.format().into_glib(), src_val.to_raw_value(), - dest_fmt.to_glib(), + dest_fmt.into_glib(), dest_val.as_mut_ptr(), )) { Some(gst::GenericFormattedValue::new( diff --git a/gstreamer-audio/src/audio_meta.rs b/gstreamer-audio/src/audio_meta.rs index 143990dd1..cc5f0a21a 100644 --- a/gstreamer-audio/src/audio_meta.rs +++ b/gstreamer-audio/src/audio_meta.rs @@ -8,7 +8,7 @@ use std::ptr; #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] use std::slice; -use glib::translate::{from_glib, ToGlib}; +use glib::translate::{from_glib, IntoGlib}; #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] use glib::translate::{from_glib_none, ToGlibPtr}; @@ -33,7 +33,7 @@ impl AudioClippingMeta { unsafe { let meta = ffi::gst_buffer_add_audio_clipping_meta( buffer.as_mut_ptr(), - start.format().to_glib(), + start.format().into_glib(), start.value() as u64, end.value() as u64, ); diff --git a/gstreamer-audio/src/audio_ring_buffer_spec.rs b/gstreamer-audio/src/audio_ring_buffer_spec.rs index 1d746f4c7..edb98b24e 100644 --- a/gstreamer-audio/src/audio_ring_buffer_spec.rs +++ b/gstreamer-audio/src/audio_ring_buffer_spec.rs @@ -18,7 +18,7 @@ impl AudioRingBufferSpec { } pub fn set_type(&mut self, value: AudioRingBufferFormatType) { - self.0.type_ = value.to_glib(); + self.0.type_ = value.into_glib(); } pub fn caps(&self) -> Caps { diff --git a/gstreamer-audio/src/audio_stream_align.rs b/gstreamer-audio/src/audio_stream_align.rs index 8c0a9651f..bf9e7d8a9 100644 --- a/gstreamer-audio/src/audio_stream_align.rs +++ b/gstreamer-audio/src/audio_stream_align.rs @@ -20,8 +20,8 @@ impl AudioStreamAlign { let mut out_sample_position = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_audio_stream_align_process( self.to_glib_none_mut().0, - discont.to_glib(), - timestamp.to_glib(), + discont.into_glib(), + timestamp.into_glib(), n_samples, out_timestamp.as_mut_ptr(), out_duration.as_mut_ptr(), diff --git a/gstreamer-audio/src/functions.rs b/gstreamer-audio/src/functions.rs index 4866463d5..1f86452fe 100644 --- a/gstreamer-audio/src/functions.rs +++ b/gstreamer-audio/src/functions.rs @@ -87,14 +87,14 @@ mod tests { #[cfg(feature = "v1_18")] { - use glib::translate::{from_glib_full, ToGlib}; + use glib::translate::{from_glib_full, IntoGlib}; /* audio_make_raw_caps() is a re-implementation so ensure it returns the same caps as the C API */ let c_caps = unsafe { let formats: Vec = [crate::AudioFormat::S16be, crate::AudioFormat::S16le] .iter() - .map(|f| f.to_glib()) + .map(|f| f.into_glib()) .collect(); let caps = ffi::gst_audio_make_raw_caps( formats.as_ptr(), diff --git a/gstreamer-audio/src/subclass/audio_decoder.rs b/gstreamer-audio/src/subclass/audio_decoder.rs index dcbbba1c8..af067ceee 100644 --- a/gstreamer-audio/src/subclass/audio_decoder.rs +++ b/gstreamer-audio/src/subclass/audio_decoder.rs @@ -375,7 +375,7 @@ impl AudioDecoderImplExt for T { .map(|f| { f( element.unsafe_cast_ref::().to_glib_none().0, - hard.to_glib(), + hard.into_glib(), ) }) .unwrap_or(()) @@ -574,7 +574,7 @@ unsafe extern "C" fn audio_decoder_open( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_decoder_close( @@ -593,7 +593,7 @@ unsafe extern "C" fn audio_decoder_close( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_decoder_start( @@ -612,7 +612,7 @@ unsafe extern "C" fn audio_decoder_start( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_decoder_stop( @@ -631,7 +631,7 @@ unsafe extern "C" fn audio_decoder_stop( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_decoder_set_format( @@ -651,7 +651,7 @@ unsafe extern "C" fn audio_decoder_set_format( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_decoder_parse( @@ -677,7 +677,7 @@ unsafe extern "C" fn audio_decoder_parse( } .into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_decoder_handle_frame( @@ -697,7 +697,7 @@ unsafe extern "C" fn audio_decoder_handle_frame( ) .into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_decoder_pre_push( @@ -722,7 +722,7 @@ unsafe extern "C" fn audio_decoder_pre_push( } .into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_decoder_flush( @@ -754,7 +754,7 @@ unsafe extern "C" fn audio_decoder_negotiate( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_decoder_getcaps( @@ -788,7 +788,7 @@ unsafe extern "C" fn audio_decoder_sink_event( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_decoder_sink_query( @@ -802,7 +802,7 @@ unsafe extern "C" fn audio_decoder_sink_query( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_decoder_src_event( @@ -816,7 +816,7 @@ unsafe extern "C" fn audio_decoder_src_event( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_decoder_src_query( @@ -830,7 +830,7 @@ unsafe extern "C" fn audio_decoder_src_query( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_decoder_propose_allocation( @@ -851,7 +851,7 @@ unsafe extern "C" fn audio_decoder_propose_allocation( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_decoder_decide_allocation( @@ -872,5 +872,5 @@ unsafe extern "C" fn audio_decoder_decide_allocation( } } }) - .to_glib() + .into_glib() } diff --git a/gstreamer-audio/src/subclass/audio_encoder.rs b/gstreamer-audio/src/subclass/audio_encoder.rs index 81553e337..155f530b0 100644 --- a/gstreamer-audio/src/subclass/audio_encoder.rs +++ b/gstreamer-audio/src/subclass/audio_encoder.rs @@ -519,7 +519,7 @@ unsafe extern "C" fn audio_encoder_open( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_encoder_close( @@ -538,7 +538,7 @@ unsafe extern "C" fn audio_encoder_close( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_encoder_start( @@ -557,7 +557,7 @@ unsafe extern "C" fn audio_encoder_start( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_encoder_stop( @@ -576,7 +576,7 @@ unsafe extern "C" fn audio_encoder_stop( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_encoder_set_format( @@ -596,7 +596,7 @@ unsafe extern "C" fn audio_encoder_set_format( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_encoder_handle_frame( @@ -616,7 +616,7 @@ unsafe extern "C" fn audio_encoder_handle_frame( ) .into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_encoder_pre_push( @@ -641,7 +641,7 @@ unsafe extern "C" fn audio_encoder_pre_push( } .into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_encoder_flush(ptr: *mut ffi::GstAudioEncoder) { @@ -670,7 +670,7 @@ unsafe extern "C" fn audio_encoder_negotiate( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_encoder_getcaps( @@ -704,7 +704,7 @@ unsafe extern "C" fn audio_encoder_sink_event( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_encoder_sink_query( @@ -718,7 +718,7 @@ unsafe extern "C" fn audio_encoder_sink_query( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_encoder_src_event( @@ -732,7 +732,7 @@ unsafe extern "C" fn audio_encoder_src_event( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_encoder_src_query( @@ -746,7 +746,7 @@ unsafe extern "C" fn audio_encoder_src_query( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_encoder_propose_allocation( @@ -767,7 +767,7 @@ unsafe extern "C" fn audio_encoder_propose_allocation( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audio_encoder_decide_allocation( @@ -788,5 +788,5 @@ unsafe extern "C" fn audio_encoder_decide_allocation( } } }) - .to_glib() + .into_glib() } diff --git a/gstreamer-audio/src/subclass/audio_sink.rs b/gstreamer-audio/src/subclass/audio_sink.rs index f4c564b53..44d9d0ec5 100644 --- a/gstreamer-audio/src/subclass/audio_sink.rs +++ b/gstreamer-audio/src/subclass/audio_sink.rs @@ -217,7 +217,7 @@ unsafe extern "C" fn audiosink_close( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audiosink_delay(ptr: *mut ffi::GstAudioSink) -> u32 { @@ -246,7 +246,7 @@ unsafe extern "C" fn audiosink_open( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audiosink_prepare( @@ -268,7 +268,7 @@ unsafe extern "C" fn audiosink_prepare( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audiosink_unprepare( @@ -287,7 +287,7 @@ unsafe extern "C" fn audiosink_unprepare( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audiosink_write( diff --git a/gstreamer-audio/src/subclass/audio_src.rs b/gstreamer-audio/src/subclass/audio_src.rs index 4b5fc9a08..9abb13dfa 100644 --- a/gstreamer-audio/src/subclass/audio_src.rs +++ b/gstreamer-audio/src/subclass/audio_src.rs @@ -233,7 +233,7 @@ unsafe extern "C" fn audiosrc_close( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audiosrc_delay(ptr: *mut ffi::GstAudioSrc) -> u32 { @@ -262,7 +262,7 @@ unsafe extern "C" fn audiosrc_open( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audiosrc_prepare( @@ -284,7 +284,7 @@ unsafe extern "C" fn audiosrc_prepare( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audiosrc_unprepare( @@ -303,7 +303,7 @@ unsafe extern "C" fn audiosrc_unprepare( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn audiosrc_read( @@ -321,7 +321,7 @@ unsafe extern "C" fn audiosrc_read( let (res, timestamp_res) = imp .read(wrap.unsafe_cast_ref(), data_slice) .unwrap_or((0, gst::CLOCK_TIME_NONE)); - *timestamp = timestamp_res.to_glib(); + *timestamp = timestamp_res.into_glib(); res }) diff --git a/gstreamer-base/src/aggregator.rs b/gstreamer-base/src/aggregator.rs index b8f56da74..b30a32941 100644 --- a/gstreamer-base/src/aggregator.rs +++ b/gstreamer-base/src/aggregator.rs @@ -188,9 +188,9 @@ impl> AggregatorExtManual for O { unsafe { ffi::gst_aggregator_selected_samples( self.as_ref().to_glib_none().0, - pts.to_glib(), - dts.to_glib(), - duration.to_glib(), + pts.into_glib(), + dts.into_glib(), + duration.into_glib(), info.as_ref() .map(|s| s.as_ptr() as *mut _) .unwrap_or(ptr::null_mut()), diff --git a/gstreamer-base/src/base_parse.rs b/gstreamer-base/src/base_parse.rs index d8971a9fa..ad00173ff 100644 --- a/gstreamer-base/src/base_parse.rs +++ b/gstreamer-base/src/base_parse.rs @@ -52,7 +52,7 @@ impl> BaseParseExtManual for O { unsafe { ffi::gst_base_parse_set_duration( self.as_ref().to_glib_none().0, - duration.format().to_glib(), + duration.format().into_glib(), duration.value(), interval as i32, ); @@ -81,9 +81,9 @@ 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.format().to_glib(), + src_val.format().into_glib(), src_val.to_raw_value(), - U::default_format().to_glib(), + U::default_format().into_glib(), dest_val.as_mut_ptr(), )); if ret { @@ -104,9 +104,9 @@ 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.format().to_glib(), + src_val.format().into_glib(), src_val.to_raw_value(), - dest_format.to_glib(), + dest_format.into_glib(), dest_val.as_mut_ptr(), )); if ret { diff --git a/gstreamer-base/src/base_parse_frame.rs b/gstreamer-base/src/base_parse_frame.rs index ff05c2eba..deff09ec8 100644 --- a/gstreamer-base/src/base_parse_frame.rs +++ b/gstreamer-base/src/base_parse_frame.rs @@ -25,11 +25,11 @@ pub enum Overhead { } #[doc(hidden)] -impl ToGlib for Overhead { +impl IntoGlib for Overhead { type GlibType = i32; - fn to_glib(&self) -> i32 { - match *self { + fn into_glib(self) -> i32 { + match self { Overhead::None => 0, Overhead::Frame => -1, Overhead::Bytes(b) => i32::try_from(b).expect("overhead is higher than i32::MAX"), @@ -182,7 +182,7 @@ impl<'a> BaseParseFrame<'a> { pub fn set_overhead(&mut self, overhead: Overhead) { unsafe { - (*self.to_glib_none().0).overhead = overhead.to_glib(); + (*self.to_glib_none().0).overhead = overhead.into_glib(); } } } diff --git a/gstreamer-base/src/base_sink.rs b/gstreamer-base/src/base_sink.rs index 5946de8b1..aa80c8f0e 100644 --- a/gstreamer-base/src/base_sink.rs +++ b/gstreamer-base/src/base_sink.rs @@ -44,7 +44,7 @@ impl> BaseSinkExtManual for O { let mut jitter = 0; let ret: gst::FlowReturn = from_glib(ffi::gst_base_sink_wait( self.as_ref().to_glib_none().0, - time.to_glib(), + time.into_glib(), &mut jitter, )); (ret.into_result(), jitter) @@ -71,7 +71,7 @@ impl> BaseSinkExtManual for O { let mut jitter = 0; let ret: gst::ClockReturn = from_glib(ffi::gst_base_sink_wait_clock( self.as_ref().to_glib_none().0, - time.to_glib(), + time.into_glib(), &mut jitter, )); (ret.into_result(), jitter) diff --git a/gstreamer-base/src/base_src.rs b/gstreamer-base/src/base_src.rs index 4c1fb5083..ccd678960 100644 --- a/gstreamer-base/src/base_src.rs +++ b/gstreamer-base/src/base_src.rs @@ -50,7 +50,7 @@ impl> BaseSrcExtManual for O { fn start_complete(&self, ret: Result) { let ret: gst::FlowReturn = ret.into(); unsafe { - ffi::gst_base_src_start_complete(self.as_ref().to_glib_none().0, ret.to_glib()); + ffi::gst_base_src_start_complete(self.as_ref().to_glib_none().0, ret.into_glib()); } } diff --git a/gstreamer-base/src/flow_combiner.rs b/gstreamer-base/src/flow_combiner.rs index 8b5a5b2ac..d84fad823 100644 --- a/gstreamer-base/src/flow_combiner.rs +++ b/gstreamer-base/src/flow_combiner.rs @@ -68,7 +68,7 @@ impl FlowCombiner { let ret: gst::FlowReturn = unsafe { from_glib(ffi::gst_flow_combiner_update_flow( self.to_glib_none().0, - fret.to_glib(), + fret.into_glib(), )) }; ret.into_result() @@ -84,7 +84,7 @@ impl FlowCombiner { from_glib(ffi::gst_flow_combiner_update_pad_flow( self.to_glib_none().0, pad.as_ref().to_glib_none().0, - fret.to_glib(), + fret.into_glib(), )) }; ret.into_result() diff --git a/gstreamer-base/src/subclass/aggregator.rs b/gstreamer-base/src/subclass/aggregator.rs index e94c782b3..e4a25bf70 100644 --- a/gstreamer-base/src/subclass/aggregator.rs +++ b/gstreamer-base/src/subclass/aggregator.rs @@ -486,8 +486,8 @@ impl AggregatorImplExt for T { Some(f) => gst::result_from_gboolean!( f( aggregator.unsafe_cast_ref::().to_glib_none().0, - mode.to_glib(), - active.to_glib() + mode.into_glib(), + active.into_glib() ), gst::CAT_RUST, "Parent function `src_activate` failed" @@ -509,7 +509,7 @@ impl AggregatorImplExt for T { .expect("Missing parent function `aggregate`"); gst::FlowReturn::from_glib(f( aggregator.unsafe_cast_ref::().to_glib_none().0, - timeout.to_glib(), + timeout.into_glib(), )) .into_result() } @@ -748,7 +748,7 @@ unsafe extern "C" fn aggregator_flush( gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { imp.flush(wrap.unsafe_cast_ref()).into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn aggregator_clip( @@ -783,7 +783,7 @@ unsafe extern "C" fn aggregator_finish_buffer( imp.finish_buffer(wrap.unsafe_cast_ref(), from_glib_full(buffer)) .into() }) - .to_glib() + .into_glib() } #[cfg(any(feature = "v1_18", feature = "dox"))] @@ -800,7 +800,7 @@ unsafe extern "C" fn aggregator_finish_buffer_list( imp.finish_buffer_list(wrap.unsafe_cast_ref(), from_glib_full(buffer_list)) .into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn aggregator_sink_event( @@ -819,7 +819,7 @@ unsafe extern "C" fn aggregator_sink_event( from_glib_full(event), ) }) - .to_glib() + .into_glib() } #[cfg(any(feature = "v1_18", feature = "dox"))] @@ -841,7 +841,7 @@ unsafe extern "C" fn aggregator_sink_event_pre_queue( ) .into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn aggregator_sink_query( @@ -860,7 +860,7 @@ unsafe extern "C" fn aggregator_sink_query( gst::QueryRef::from_mut_ptr(query), ) }) - .to_glib() + .into_glib() } #[cfg(any(feature = "v1_18", feature = "dox"))] @@ -881,7 +881,7 @@ unsafe extern "C" fn aggregator_sink_query_pre_queue( gst::QueryRef::from_mut_ptr(query), ) }) - .to_glib() + .into_glib() } unsafe extern "C" fn aggregator_src_event( @@ -895,7 +895,7 @@ unsafe extern "C" fn aggregator_src_event( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn aggregator_src_query( @@ -909,7 +909,7 @@ unsafe extern "C" fn aggregator_src_query( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn aggregator_src_activate( @@ -930,7 +930,7 @@ unsafe extern "C" fn aggregator_src_activate( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn aggregator_aggregate( @@ -945,7 +945,7 @@ unsafe extern "C" fn aggregator_aggregate( imp.aggregate(wrap.unsafe_cast_ref(), from_glib(timeout)) .into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn aggregator_start( @@ -964,7 +964,7 @@ unsafe extern "C" fn aggregator_start( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn aggregator_stop( @@ -983,7 +983,7 @@ unsafe extern "C" fn aggregator_stop( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn aggregator_get_next_time( @@ -996,7 +996,7 @@ unsafe extern "C" fn aggregator_get_next_time( gst::panic_to_error!(&wrap, &imp.panicked(), gst::CLOCK_TIME_NONE, { imp.next_time(wrap.unsafe_cast_ref()) }) - .to_glib() + .into_glib() } unsafe extern "C" fn aggregator_create_new_pad( @@ -1044,7 +1044,7 @@ unsafe extern "C" fn aggregator_update_src_caps( Err(err) => err.into(), } }) - .to_glib() + .into_glib() } unsafe extern "C" fn aggregator_fixate_src_caps( @@ -1078,7 +1078,7 @@ unsafe extern "C" fn aggregator_negotiated_src_caps( } } }) - .to_glib() + .into_glib() } #[cfg(any(feature = "v1_18", feature = "dox"))] @@ -1093,7 +1093,7 @@ unsafe extern "C" fn aggregator_negotiate( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.negotiate(wrap.unsafe_cast_ref()) }) - .to_glib() + .into_glib() } #[cfg(any(feature = "v1_18", feature = "dox"))] diff --git a/gstreamer-base/src/subclass/aggregator_pad.rs b/gstreamer-base/src/subclass/aggregator_pad.rs index 8aff9ef9a..c963a1206 100644 --- a/gstreamer-base/src/subclass/aggregator_pad.rs +++ b/gstreamer-base/src/subclass/aggregator_pad.rs @@ -117,7 +117,7 @@ unsafe extern "C" fn aggregator_pad_flush( let res: gst::FlowReturn = imp .flush(wrap.unsafe_cast_ref(), &from_glib_borrow(aggregator)) .into(); - res.to_glib() + res.into_glib() } unsafe extern "C" fn aggregator_pad_skip_buffer( @@ -134,5 +134,5 @@ unsafe extern "C" fn aggregator_pad_skip_buffer( &from_glib_borrow(aggregator), &from_glib_borrow(buffer), ) - .to_glib() + .into_glib() } diff --git a/gstreamer-base/src/subclass/base_parse.rs b/gstreamer-base/src/subclass/base_parse.rs index b55dba082..b09bbac3e 100644 --- a/gstreamer-base/src/subclass/base_parse.rs +++ b/gstreamer-base/src/subclass/base_parse.rs @@ -184,9 +184,9 @@ impl BaseParseImplExt for T { let res = from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, - src_val.format().to_glib(), + src_val.format().into_glib(), src_val.to_raw_value(), - dest_format.to_glib(), + dest_format.into_glib(), dest_val.as_mut_ptr(), )); (res, dest_val) @@ -235,7 +235,7 @@ unsafe extern "C" fn base_parse_start( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_parse_stop( @@ -254,7 +254,7 @@ unsafe extern "C" fn base_parse_stop( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_parse_set_sink_caps( @@ -275,7 +275,7 @@ unsafe extern "C" fn base_parse_set_sink_caps( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_parse_handle_frame( @@ -299,7 +299,7 @@ unsafe extern "C" fn base_parse_handle_frame( } Err(flow) => gst::FlowReturn::from_error(flow), } - .to_glib() + .into_glib() } unsafe extern "C" fn base_parse_convert( @@ -325,5 +325,5 @@ unsafe extern "C" fn base_parse_convert( } _ => false, } - .to_glib() + .into_glib() } diff --git a/gstreamer-base/src/subclass/base_sink.rs b/gstreamer-base/src/subclass/base_sink.rs index 02c581db0..7cb9a4ca4 100644 --- a/gstreamer-base/src/subclass/base_sink.rs +++ b/gstreamer-base/src/subclass/base_sink.rs @@ -432,7 +432,7 @@ unsafe extern "C" fn base_sink_start( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_sink_stop( @@ -451,7 +451,7 @@ unsafe extern "C" fn base_sink_stop( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_sink_render( @@ -466,7 +466,7 @@ unsafe extern "C" fn base_sink_render( gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { imp.render(wrap.unsafe_cast_ref(), &buffer).into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_sink_prepare( @@ -481,7 +481,7 @@ unsafe extern "C" fn base_sink_prepare( gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { imp.prepare(wrap.unsafe_cast_ref(), &buffer).into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_sink_render_list( @@ -496,7 +496,7 @@ unsafe extern "C" fn base_sink_render_list( gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { imp.render_list(wrap.unsafe_cast_ref(), &list).into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_sink_prepare_list( @@ -511,7 +511,7 @@ unsafe extern "C" fn base_sink_prepare_list( gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { imp.prepare_list(wrap.unsafe_cast_ref(), &list).into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_sink_query( @@ -526,7 +526,7 @@ unsafe extern "C" fn base_sink_query( gst::panic_to_error!(&wrap, &imp.panicked(), false, { BaseSinkImpl::query(imp, wrap.unsafe_cast_ref(), query) }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_sink_event( @@ -540,7 +540,7 @@ unsafe extern "C" fn base_sink_event( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.event(wrap.unsafe_cast_ref(), from_glib_full(event_ptr)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_sink_get_caps( @@ -577,7 +577,7 @@ unsafe extern "C" fn base_sink_set_caps( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_sink_fixate( @@ -611,7 +611,7 @@ unsafe extern "C" fn base_sink_unlock( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_sink_unlock_stop( @@ -630,5 +630,5 @@ unsafe extern "C" fn base_sink_unlock_stop( } } }) - .to_glib() + .into_glib() } diff --git a/gstreamer-base/src/subclass/base_src.rs b/gstreamer-base/src/subclass/base_src.rs index 495ad2253..87c826613 100644 --- a/gstreamer-base/src/subclass/base_src.rs +++ b/gstreamer-base/src/subclass/base_src.rs @@ -616,7 +616,7 @@ unsafe extern "C" fn base_src_start( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_src_stop( @@ -635,7 +635,7 @@ unsafe extern "C" fn base_src_stop( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_src_is_seekable( @@ -648,7 +648,7 @@ unsafe extern "C" fn base_src_is_seekable( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.is_seekable(wrap.unsafe_cast_ref()) }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_src_get_size( @@ -668,7 +668,7 @@ unsafe extern "C" fn base_src_get_size( None => false, } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_src_get_times( @@ -687,8 +687,8 @@ unsafe extern "C" fn base_src_get_times( gst::panic_to_error!(&wrap, &imp.panicked(), (), { let (start_, stop_) = imp.times(wrap.unsafe_cast_ref(), buffer); - *start = start_.to_glib(); - *stop = stop_.to_glib(); + *start = start_.into_glib(); + *stop = stop_.into_glib(); }); } @@ -707,7 +707,7 @@ unsafe extern "C" fn base_src_fill( imp.fill(wrap.unsafe_cast_ref(), offset, length, buffer) .into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_src_alloc( @@ -732,7 +732,7 @@ unsafe extern "C" fn base_src_alloc( Err(err) => gst::FlowReturn::from(err), } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_src_create( @@ -818,7 +818,7 @@ unsafe extern "C" fn base_src_create( Err(err) => gst::FlowReturn::from(err), } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_src_do_seek( @@ -836,7 +836,7 @@ unsafe extern "C" fn base_src_do_seek( res }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_src_query( @@ -851,7 +851,7 @@ unsafe extern "C" fn base_src_query( gst::panic_to_error!(&wrap, &imp.panicked(), false, { BaseSrcImpl::query(imp, wrap.unsafe_cast_ref(), query) }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_src_event( @@ -865,7 +865,7 @@ unsafe extern "C" fn base_src_event( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.event(wrap.unsafe_cast_ref(), &from_glib_borrow(event_ptr)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_src_get_caps( @@ -900,7 +900,7 @@ unsafe extern "C" fn base_src_negotiate( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_src_set_caps( @@ -921,7 +921,7 @@ unsafe extern "C" fn base_src_set_caps( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_src_fixate( @@ -955,7 +955,7 @@ unsafe extern "C" fn base_src_unlock( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_src_unlock_stop( @@ -974,5 +974,5 @@ unsafe extern "C" fn base_src_unlock_stop( } } }) - .to_glib() + .into_glib() } diff --git a/gstreamer-base/src/subclass/base_transform.rs b/gstreamer-base/src/subclass/base_transform.rs index 37eeabc0f..be3f9f8ee 100644 --- a/gstreamer-base/src/subclass/base_transform.rs +++ b/gstreamer-base/src/subclass/base_transform.rs @@ -362,7 +362,7 @@ impl BaseTransformImplExt for T { .map(|f| { from_glib_full(f( element.unsafe_cast_ref::().to_glib_none().0, - direction.to_glib(), + direction.into_glib(), caps.to_glib_none().0, filter.to_glib_none().0, )) @@ -384,7 +384,7 @@ impl BaseTransformImplExt for T { match (*parent_class).fixate_caps { Some(f) => from_glib_full(f( element.unsafe_cast_ref::().to_glib_none().0, - direction.to_glib(), + direction.into_glib(), caps.to_glib_none().0, othercaps.into_ptr(), )), @@ -433,7 +433,7 @@ impl BaseTransformImplExt for T { .map(|f| { from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, - direction.to_glib(), + direction.into_glib(), caps.to_glib_none().0, )) }) @@ -455,7 +455,7 @@ impl BaseTransformImplExt for T { .map(|f| { from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, - direction.to_glib(), + direction.into_glib(), query.as_mut_ptr(), )) }) @@ -480,7 +480,7 @@ impl BaseTransformImplExt for T { let mut othersize = mem::MaybeUninit::uninit(); let res: bool = from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, - direction.to_glib(), + direction.into_glib(), caps.to_glib_none().0, size, othercaps.to_glib_none().0, @@ -764,7 +764,7 @@ impl BaseTransformImplExt for T { gst::FlowReturn::from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, - is_discont.to_glib(), + is_discont.into_glib(), inbuf.into_ptr(), )) .into_result() @@ -856,8 +856,8 @@ unsafe impl IsSubclassable for BaseTransform { klass.submit_input_buffer = Some(base_transform_submit_input_buffer::); klass.generate_output = Some(base_transform_generate_output::); - klass.passthrough_on_same_caps = T::PASSTHROUGH_ON_SAME_CAPS.to_glib(); - klass.transform_ip_on_passthrough = T::TRANSFORM_IP_ON_PASSTHROUGH.to_glib(); + klass.passthrough_on_same_caps = T::PASSTHROUGH_ON_SAME_CAPS.into_glib(); + klass.transform_ip_on_passthrough = T::TRANSFORM_IP_ON_PASSTHROUGH.into_glib(); match T::MODE { BaseTransformMode::AlwaysInPlace => { @@ -909,7 +909,7 @@ unsafe extern "C" fn base_transform_start( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_transform_stop( @@ -928,7 +928,7 @@ unsafe extern "C" fn base_transform_stop( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_transform_transform_caps( @@ -998,7 +998,7 @@ unsafe extern "C" fn base_transform_set_caps( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_transform_accept_caps( @@ -1017,7 +1017,7 @@ unsafe extern "C" fn base_transform_accept_caps( &from_glib_borrow(caps), ) }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_transform_query( @@ -1037,7 +1037,7 @@ unsafe extern "C" fn base_transform_query( gst::QueryRef::from_mut_ptr(query), ) }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_transform_transform_size( @@ -1067,7 +1067,7 @@ unsafe extern "C" fn base_transform_transform_size( None => false, } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_transform_get_unit_size( @@ -1088,7 +1088,7 @@ unsafe extern "C" fn base_transform_get_unit_size( None => false, } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_transform_prepare_output_buffer( @@ -1116,7 +1116,7 @@ unsafe extern "C" fn base_transform_prepare_output_buffer( Err(err) => err.into(), } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_transform_sink_event( @@ -1130,7 +1130,7 @@ unsafe extern "C" fn base_transform_sink_event( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_transform_src_event( @@ -1144,7 +1144,7 @@ unsafe extern "C" fn base_transform_src_event( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_transform_transform( @@ -1164,7 +1164,7 @@ unsafe extern "C" fn base_transform_transform( ) .into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_transform_transform_ip( @@ -1187,7 +1187,7 @@ unsafe extern "C" fn base_transform_transform_ip( .into() } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_transform_transform_meta( @@ -1210,7 +1210,7 @@ unsafe extern "C" fn base_transform_transform_meta( inbuf, ) }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_transform_copy_metadata( @@ -1245,7 +1245,7 @@ unsafe extern "C" fn base_transform_copy_metadata( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_transform_before_transform( @@ -1278,7 +1278,7 @@ unsafe extern "C" fn base_transform_submit_input_buffer( ) .into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn base_transform_generate_output( @@ -1302,5 +1302,5 @@ unsafe extern "C" fn base_transform_generate_output( Err(err) => err.into(), } }) - .to_glib() + .into_glib() } diff --git a/gstreamer-base/src/subclass/push_src.rs b/gstreamer-base/src/subclass/push_src.rs index 54570753a..4665f8788 100644 --- a/gstreamer-base/src/subclass/push_src.rs +++ b/gstreamer-base/src/subclass/push_src.rs @@ -134,7 +134,7 @@ unsafe extern "C" fn push_src_fill( gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { PushSrcImpl::fill(imp, wrap.unsafe_cast_ref(), buffer).into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn push_src_alloc( @@ -157,7 +157,7 @@ unsafe extern "C" fn push_src_alloc( Err(err) => gst::FlowReturn::from(err), } }) - .to_glib() + .into_glib() } unsafe extern "C" fn push_src_create( @@ -180,5 +180,5 @@ unsafe extern "C" fn push_src_create( Err(err) => gst::FlowReturn::from(err), } }) - .to_glib() + .into_glib() } diff --git a/gstreamer-check/src/harness.rs b/gstreamer-check/src/harness.rs index 59142e052..7da5b6c58 100644 --- a/gstreamer-check/src/harness.rs +++ b/gstreamer-check/src/harness.rs @@ -93,7 +93,7 @@ impl Harness { ) { unsafe { let params = params.map(|p| p.as_ptr()).unwrap_or(ptr::null_mut()); - ffi::gst_harness_add_propose_allocation_meta(self.0.as_ptr(), api.to_glib(), params); + ffi::gst_harness_add_propose_allocation_meta(self.0.as_ptr(), api.into_glib(), params); } } @@ -121,7 +121,7 @@ impl Harness { ffi::gst_harness_add_src( self.0.as_ptr(), src_element_name.to_glib_none().0, - has_clock_wait.to_glib(), + has_clock_wait.into_glib(), ); } } @@ -132,7 +132,7 @@ impl Harness { ffi::gst_harness_add_src_harness( self.0.as_ptr(), src_harness.0.as_ptr(), - has_clock_wait.to_glib(), + has_clock_wait.into_glib(), ); } } @@ -142,7 +142,7 @@ impl Harness { ffi::gst_harness_add_src_parse( self.0.as_ptr(), launchline.to_glib_none().0, - has_clock_wait.to_glib(), + has_clock_wait.into_glib(), ); } } @@ -348,13 +348,13 @@ impl Harness { pub fn set_drop_buffers(&mut self, drop_buffers: bool) { unsafe { - ffi::gst_harness_set_drop_buffers(self.0.as_ptr(), drop_buffers.to_glib()); + ffi::gst_harness_set_drop_buffers(self.0.as_ptr(), drop_buffers.into_glib()); } } pub fn set_forwarding(&mut self, forwarding: bool) { unsafe { - ffi::gst_harness_set_forwarding(self.0.as_ptr(), forwarding.to_glib()); + ffi::gst_harness_set_forwarding(self.0.as_ptr(), forwarding.into_glib()); } } @@ -389,7 +389,7 @@ impl Harness { pub fn set_time(&mut self, time: gst::ClockTime) -> Result<(), glib::BoolError> { unsafe { glib::result_from_gboolean!( - ffi::gst_harness_set_time(self.0.as_ptr(), time.to_glib()), + ffi::gst_harness_set_time(self.0.as_ptr(), time.into_glib()), "Failed to set time", ) } @@ -397,7 +397,7 @@ impl Harness { pub fn set_upstream_latency(&mut self, latency: gst::ClockTime) { unsafe { - ffi::gst_harness_set_upstream_latency(self.0.as_ptr(), latency.to_glib()); + ffi::gst_harness_set_upstream_latency(self.0.as_ptr(), latency.into_glib()); } } diff --git a/gstreamer-gl/egl/src/gl_display_egl.rs b/gstreamer-gl/egl/src/gl_display_egl.rs index 95071f600..6e7f273b4 100644 --- a/gstreamer-gl/egl/src/gl_display_egl.rs +++ b/gstreamer-gl/egl/src/gl_display_egl.rs @@ -23,6 +23,6 @@ impl GLDisplayEGL { } pub unsafe fn from_native(display_type: GLDisplayType, display: uintptr_t) -> gpointer { - ffi::gst_gl_display_egl_get_from_native(display_type.to_glib(), display) + ffi::gst_gl_display_egl_get_from_native(display_type.into_glib(), display) } } diff --git a/gstreamer-gl/src/gl_context.rs b/gstreamer-gl/src/gl_context.rs index 58d9e71b0..81cffe92e 100644 --- a/gstreamer-gl/src/gl_context.rs +++ b/gstreamer-gl/src/gl_context.rs @@ -18,14 +18,14 @@ impl GLContext { from_glib_full(ffi::gst_gl_context_new_wrapped( display.as_ref().to_glib_none().0, handle, - context_type.to_glib(), - available_apis.to_glib(), + context_type.into_glib(), + available_apis.into_glib(), )) } pub fn current_gl_context(context_type: GLPlatform) -> uintptr_t { skip_assert_initialized!(); - unsafe { ffi::gst_gl_context_get_current_gl_context(context_type.to_glib()) as uintptr_t } + unsafe { ffi::gst_gl_context_get_current_gl_context(context_type.into_glib()) as uintptr_t } } pub fn proc_address_with_platform( @@ -36,8 +36,8 @@ impl GLContext { skip_assert_initialized!(); unsafe { ffi::gst_gl_context_get_proc_address_with_platform( - context_type.to_glib(), - gl_api.to_glib(), + context_type.into_glib(), + gl_api.into_glib(), name.to_glib_none().0, ) as uintptr_t } diff --git a/gstreamer-gl/src/gl_memory.rs b/gstreamer-gl/src/gl_memory.rs index 2bf30e956..3fb211e64 100644 --- a/gstreamer-gl/src/gl_memory.rs +++ b/gstreamer-gl/src/gl_memory.rs @@ -41,8 +41,8 @@ impl GLMemoryRef { ffi::gst_gl_memory_copy_into( mut_override(&self.0), tex_id, - target.to_glib(), - tex_format.to_glib(), + target.into_glib(), + tex_format.into_glib(), width, height, ), @@ -68,8 +68,8 @@ impl GLMemoryRef { ffi::gst_gl_memory_copy_teximage( mut_override(&self.0), tex_id, - out_target.to_glib(), - out_tex_format.to_glib(), + out_target.into_glib(), + out_tex_format.into_glib(), out_width, out_height, ), diff --git a/gstreamer-gl/src/subclass/gl_base_filter.rs b/gstreamer-gl/src/subclass/gl_base_filter.rs index 22bae1e19..392912ee7 100644 --- a/gstreamer-gl/src/subclass/gl_base_filter.rs +++ b/gstreamer-gl/src/subclass/gl_base_filter.rs @@ -137,7 +137,7 @@ unsafe extern "C" fn gl_set_caps( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn gl_start( @@ -156,7 +156,7 @@ unsafe extern "C" fn gl_start( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn gl_stop(ptr: *mut GstGLBaseFilter) { diff --git a/gstreamer-gl/src/subclass/gl_filter.rs b/gstreamer-gl/src/subclass/gl_filter.rs index 20e55c4ac..d9547e114 100644 --- a/gstreamer-gl/src/subclass/gl_filter.rs +++ b/gstreamer-gl/src/subclass/gl_filter.rs @@ -217,7 +217,7 @@ impl GLFilterImplExt for T { from_glib_full(f( filter.unsafe_cast_ref::().to_glib_none().0, - direction.to_glib(), + direction.into_glib(), caps.to_glib_none().0, filter_caps.to_glib_none().0, )) @@ -276,7 +276,7 @@ unsafe extern "C" fn filter( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn filter_texture( @@ -301,7 +301,7 @@ unsafe extern "C" fn filter_texture( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn init_fbo(ptr: *mut GstGLFilter) -> glib::ffi::gboolean { @@ -318,7 +318,7 @@ unsafe extern "C" fn init_fbo(ptr: *mut GstGLFilter) -> glib::f } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn set_caps( @@ -344,7 +344,7 @@ unsafe extern "C" fn set_caps( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn transform_internal_caps( diff --git a/gstreamer-net/src/net_client_clock.rs b/gstreamer-net/src/net_client_clock.rs index 22468ed10..1407cd0ce 100644 --- a/gstreamer-net/src/net_client_clock.rs +++ b/gstreamer-net/src/net_client_clock.rs @@ -21,7 +21,7 @@ impl NetClientClock { name.0, remote_address.to_glib_none().0, remote_port, - base_time.to_glib(), + base_time.into_glib(), )) .unsafe_cast() } @@ -32,7 +32,7 @@ impl NetClientClock { name.0, remote_address.to_glib_none().0, remote_port, - base_time.to_glib(), + base_time.into_glib(), )) .unsafe_cast() } diff --git a/gstreamer-net/src/ntp_clock.rs b/gstreamer-net/src/ntp_clock.rs index 6d66c1eaf..58ca6911f 100644 --- a/gstreamer-net/src/ntp_clock.rs +++ b/gstreamer-net/src/ntp_clock.rs @@ -21,7 +21,7 @@ impl NtpClock { name.0, remote_address.to_glib_none().0, remote_port, - base_time.to_glib(), + base_time.into_glib(), )) .unsafe_cast() } @@ -32,7 +32,7 @@ impl NtpClock { name.0, remote_address.to_glib_none().0, remote_port, - base_time.to_glib(), + base_time.into_glib(), )) .unsafe_cast() } diff --git a/gstreamer-pbutils/src/encoding_profile.rs b/gstreamer-pbutils/src/encoding_profile.rs index d6f99b0c5..d657df1bb 100644 --- a/gstreamer-pbutils/src/encoding_profile.rs +++ b/gstreamer-pbutils/src/encoding_profile.rs @@ -33,7 +33,7 @@ impl> EncodingProfileBuilderCommon for O { unsafe { ffi::gst_encoding_profile_set_allow_dynamic_output( self.as_ref().to_glib_none().0, - allow_dynamic_output.to_glib(), + allow_dynamic_output.into_glib(), ); } } @@ -52,7 +52,7 @@ impl> EncodingProfileBuilderCommon for O { unsafe { ffi::gst_encoding_profile_set_enabled( self.as_ref().to_glib_none().0, - enabled.to_glib(), + enabled.into_glib(), ); } } @@ -193,7 +193,7 @@ impl EncodingVideoProfile { unsafe { ffi::gst_encoding_video_profile_set_variableframerate( self.to_glib_none().0, - variableframerate.to_glib(), + variableframerate.into_glib(), ); } } diff --git a/gstreamer-player/src/subclass/player_video_renderer.rs b/gstreamer-player/src/subclass/player_video_renderer.rs index 4c74325ef..9b6c14b8c 100644 --- a/gstreamer-player/src/subclass/player_video_renderer.rs +++ b/gstreamer-player/src/subclass/player_video_renderer.rs @@ -72,9 +72,10 @@ unsafe extern "C" fn video_renderer_create_video_sink RTPBuffer<'a, Writable> { pub fn set_marker(&mut self, m: bool) { unsafe { - ffi::gst_rtp_buffer_set_marker(&mut self.rtp_buffer, m.to_glib()); + ffi::gst_rtp_buffer_set_marker(&mut self.rtp_buffer, m.into_glib()); } } @@ -113,7 +113,7 @@ impl<'a> RTPBuffer<'a, Writable> { } pub fn set_extension(&mut self, extension: bool) { - unsafe { ffi::gst_rtp_buffer_set_extension(&mut self.rtp_buffer, extension.to_glib()) } + unsafe { ffi::gst_rtp_buffer_set_extension(&mut self.rtp_buffer, extension.into_glib()) } } pub fn add_extension_onebyte_header( diff --git a/gstreamer-rtsp-server/src/rtsp_auth.rs b/gstreamer-rtsp-server/src/rtsp_auth.rs index cc9c0a9c2..b8c724a95 100644 --- a/gstreamer-rtsp-server/src/rtsp_auth.rs +++ b/gstreamer-rtsp-server/src/rtsp_auth.rs @@ -102,5 +102,5 @@ where false } } - .to_glib() + .into_glib() } diff --git a/gstreamer-rtsp-server/src/rtsp_session_pool.rs b/gstreamer-rtsp-server/src/rtsp_session_pool.rs index d25da6df5..fd47292fa 100644 --- a/gstreamer-rtsp-server/src/rtsp_session_pool.rs +++ b/gstreamer-rtsp-server/src/rtsp_session_pool.rs @@ -13,7 +13,7 @@ unsafe extern "C" fn trampoline_watch Continue + S func: gpointer, ) -> gboolean { let func: &RefCell = &*(func as *const RefCell); - (&mut *func.borrow_mut())(&from_glib_borrow(pool)).to_glib() + (&mut *func.borrow_mut())(&from_glib_borrow(pool)).into_glib() } unsafe extern "C" fn destroy_closure_watch< @@ -53,7 +53,7 @@ impl> RTSPSessionPoolExtManual for O { into_raw_watch(func), Some(destroy_closure_watch::), ); - glib::ffi::g_source_set_priority(source, priority.to_glib()); + glib::ffi::g_source_set_priority(source, priority.into_glib()); if let Some(name) = name { glib::ffi::g_source_set_name(source, name.to_glib_none().0); diff --git a/gstreamer-rtsp-server/src/rtsp_thread.rs b/gstreamer-rtsp-server/src/rtsp_thread.rs index 54e5a37a3..66f05030f 100644 --- a/gstreamer-rtsp-server/src/rtsp_thread.rs +++ b/gstreamer-rtsp-server/src/rtsp_thread.rs @@ -9,7 +9,7 @@ gst::mini_object_wrapper!(RTSPThread, RTSPThreadRef, ffi::GstRTSPThread, || { impl RTSPThread { pub fn new(type_: crate::RTSPThreadType) -> Option { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_rtsp_thread_new(type_.to_glib())) } + unsafe { from_glib_full(ffi::gst_rtsp_thread_new(type_.into_glib())) } } } diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_client.rs b/gstreamer-rtsp-server/src/subclass/rtsp_client.rs index 0467c891b..457f41958 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_client.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_client.rs @@ -942,7 +942,7 @@ unsafe extern "C" fn client_params_set( let wrap: Borrowed = from_glib_borrow(ptr); imp.params_set(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) - .to_glib() + .into_glib() } unsafe extern "C" fn client_params_get( @@ -954,7 +954,7 @@ unsafe extern "C" fn client_params_get( let wrap: Borrowed = from_glib_borrow(ptr); imp.params_get(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) - .to_glib() + .into_glib() } unsafe extern "C" fn client_make_path_from_uri( @@ -1159,7 +1159,7 @@ unsafe extern "C" fn client_pre_options_request( let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_options_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) - .to_glib() + .into_glib() } unsafe extern "C" fn client_pre_describe_request( @@ -1171,7 +1171,7 @@ unsafe extern "C" fn client_pre_describe_request( let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_describe_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) - .to_glib() + .into_glib() } unsafe extern "C" fn client_pre_setup_request( @@ -1183,7 +1183,7 @@ unsafe extern "C" fn client_pre_setup_request( let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_setup_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) - .to_glib() + .into_glib() } unsafe extern "C" fn client_pre_play_request( @@ -1195,7 +1195,7 @@ unsafe extern "C" fn client_pre_play_request( let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_play_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) - .to_glib() + .into_glib() } unsafe extern "C" fn client_pre_pause_request( @@ -1207,7 +1207,7 @@ unsafe extern "C" fn client_pre_pause_request( let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_pause_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) - .to_glib() + .into_glib() } unsafe extern "C" fn client_pre_teardown_request( @@ -1219,7 +1219,7 @@ unsafe extern "C" fn client_pre_teardown_request( let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_teardown_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) - .to_glib() + .into_glib() } unsafe extern "C" fn client_pre_set_parameter_request( @@ -1231,7 +1231,7 @@ unsafe extern "C" fn client_pre_set_parameter_request( let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_set_parameter_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) - .to_glib() + .into_glib() } unsafe extern "C" fn client_pre_get_parameter_request( @@ -1243,7 +1243,7 @@ unsafe extern "C" fn client_pre_get_parameter_request( let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_get_parameter_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) - .to_glib() + .into_glib() } unsafe extern "C" fn client_pre_announce_request( @@ -1255,7 +1255,7 @@ unsafe extern "C" fn client_pre_announce_request( let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_announce_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) - .to_glib() + .into_glib() } unsafe extern "C" fn client_pre_record_request( @@ -1267,5 +1267,5 @@ unsafe extern "C" fn client_pre_record_request( let wrap: Borrowed = from_glib_borrow(ptr); imp.pre_record_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) - .to_glib() + .into_glib() } diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_media.rs b/gstreamer-rtsp-server/src/subclass/rtsp_media.rs index 17589ba88..90a9e550c 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_media.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_media.rs @@ -408,7 +408,7 @@ impl RTSPMediaImplExt for T { if let Some(f) = (*parent_class).target_state { f( media.unsafe_cast_ref::().to_glib_none().0, - state.to_glib(), + state.into_glib(), ); } } @@ -421,7 +421,7 @@ impl RTSPMediaImplExt for T { if let Some(f) = (*parent_class).new_state { f( media.unsafe_cast_ref::().to_glib_none().0, - state.to_glib(), + state.into_glib(), ); } } @@ -487,7 +487,7 @@ unsafe extern "C" fn media_handle_message( let wrap: Borrowed = from_glib_borrow(ptr); imp.handle_message(wrap.unsafe_cast_ref(), gst::MessageRef::from_ptr(message)) - .to_glib() + .into_glib() } unsafe extern "C" fn media_prepare( @@ -565,7 +565,7 @@ unsafe extern "C" fn media_query_position( match imp.query_position(wrap.unsafe_cast_ref()) { Some(pos) => { - *position = pos.to_glib() as i64; + *position = pos.into_glib() as i64; glib::ffi::GTRUE } None => glib::ffi::GFALSE, @@ -582,7 +582,7 @@ unsafe extern "C" fn media_query_stop( match imp.query_stop(wrap.unsafe_cast_ref()) { Some(s) => { - *stop = s.to_glib() as i64; + *stop = s.into_glib() as i64; glib::ffi::GTRUE } None => glib::ffi::GFALSE, diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs index ef64d06c2..4f9966660 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs @@ -301,7 +301,7 @@ unsafe extern "C" fn factory_create_pipeline( // FIXME We somehow need to ensure the pipeline actually stays alive... glib::gobject_ffi::g_object_set_qdata_full( media as *mut _, - PIPELINE_QUARK.to_glib(), + PIPELINE_QUARK.into_glib(), pipeline as *mut _, Some(transmute::<_, unsafe extern "C" fn(glib::ffi::gpointer)>( glib::gobject_ffi::g_object_unref as *const (), diff --git a/gstreamer-video/src/functions.rs b/gstreamer-video/src/functions.rs index 44b9e5694..7fd0ff4ff 100644 --- a/gstreamer-video/src/functions.rs +++ b/gstreamer-video/src/functions.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr}; +use glib::translate::{from_glib, from_glib_full, IntoGlib, ToGlibPtr}; use glib::ToSendValue; use std::i32; @@ -18,7 +18,7 @@ pub fn convert_sample( let ret = ffi::gst_video_convert_sample( sample.to_glib_none().0, caps.to_glib_none().0, - timeout.to_glib(), + timeout.into_glib(), &mut error, ); @@ -93,7 +93,7 @@ unsafe fn convert_sample_async_unsafe( ffi::gst_video_convert_sample_async( sample.to_glib_none().0, caps.to_glib_none().0, - timeout.to_glib(), + timeout.into_glib(), Some(convert_sample_async_trampoline::), Box::into_raw(user_data) as glib::ffi::gpointer, Some(convert_sample_async_free::), @@ -172,7 +172,7 @@ pub fn guess_framerate(duration: gst::ClockTime) -> Option { let mut dest_n = mem::MaybeUninit::uninit(); let mut dest_d = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_video_guess_framerate( - duration.to_glib(), + duration.into_glib(), dest_n.as_mut_ptr(), dest_d.as_mut_ptr(), )); @@ -290,7 +290,7 @@ mod tests { let formats: Vec = [crate::VideoFormat::Nv12, crate::VideoFormat::Nv16] .iter() - .map(|f| f.to_glib()) + .map(|f| f.into_glib()) .collect(); let caps = ffi::gst_video_make_raw_caps(formats.as_ptr(), formats.len() as u32); from_glib_full(caps) diff --git a/gstreamer-video/src/subclass/video_decoder.rs b/gstreamer-video/src/subclass/video_decoder.rs index df4686676..6dde34b7d 100644 --- a/gstreamer-video/src/subclass/video_decoder.rs +++ b/gstreamer-video/src/subclass/video_decoder.rs @@ -339,7 +339,7 @@ impl VideoDecoderImplExt for T { element.unsafe_cast_ref::().to_glib_none().0, frame.to_glib_none().0, adapter.to_glib_none().0, - at_eos.to_glib(), + at_eos.into_glib(), )) }) .unwrap_or(gst::FlowReturn::Ok) @@ -577,7 +577,7 @@ unsafe extern "C" fn video_decoder_open( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_close( @@ -596,7 +596,7 @@ unsafe extern "C" fn video_decoder_close( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_start( @@ -615,7 +615,7 @@ unsafe extern "C" fn video_decoder_start( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_stop( @@ -634,7 +634,7 @@ unsafe extern "C" fn video_decoder_stop( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_finish( @@ -647,7 +647,7 @@ unsafe extern "C" fn video_decoder_finish( gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { imp.finish(wrap.unsafe_cast_ref()).into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_drain( @@ -660,7 +660,7 @@ unsafe extern "C" fn video_decoder_drain( gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { imp.drain(wrap.unsafe_cast_ref()).into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_set_format( @@ -682,7 +682,7 @@ unsafe extern "C" fn video_decoder_set_format( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_parse( @@ -703,7 +703,7 @@ unsafe extern "C" fn video_decoder_parse( imp.parse(wrap.unsafe_cast_ref(), &wrap_frame, &wrap_adapter, at_eos) .into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_handle_frame( @@ -718,7 +718,7 @@ unsafe extern "C" fn video_decoder_handle_frame( gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_flush( @@ -731,7 +731,7 @@ unsafe extern "C" fn video_decoder_flush( gst::panic_to_error!(&wrap, &imp.panicked(), false, { VideoDecoderImpl::flush(imp, wrap.unsafe_cast_ref()) }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_negotiate( @@ -750,7 +750,7 @@ unsafe extern "C" fn video_decoder_negotiate( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_getcaps( @@ -784,7 +784,7 @@ unsafe extern "C" fn video_decoder_sink_event( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_sink_query( @@ -798,7 +798,7 @@ unsafe extern "C" fn video_decoder_sink_query( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_src_event( @@ -812,7 +812,7 @@ unsafe extern "C" fn video_decoder_src_event( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_src_query( @@ -826,7 +826,7 @@ unsafe extern "C" fn video_decoder_src_query( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_propose_allocation( @@ -847,7 +847,7 @@ unsafe extern "C" fn video_decoder_propose_allocation( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_decoder_decide_allocation( @@ -868,5 +868,5 @@ unsafe extern "C" fn video_decoder_decide_allocation( } } }) - .to_glib() + .into_glib() } diff --git a/gstreamer-video/src/subclass/video_encoder.rs b/gstreamer-video/src/subclass/video_encoder.rs index 8071e4302..b886b577e 100644 --- a/gstreamer-video/src/subclass/video_encoder.rs +++ b/gstreamer-video/src/subclass/video_encoder.rs @@ -509,7 +509,7 @@ unsafe extern "C" fn video_encoder_open( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_encoder_close( @@ -528,7 +528,7 @@ unsafe extern "C" fn video_encoder_close( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_encoder_start( @@ -547,7 +547,7 @@ unsafe extern "C" fn video_encoder_start( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_encoder_stop( @@ -566,7 +566,7 @@ unsafe extern "C" fn video_encoder_stop( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_encoder_finish( @@ -579,7 +579,7 @@ unsafe extern "C" fn video_encoder_finish( gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { imp.finish(wrap.unsafe_cast_ref()).into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_encoder_set_format( @@ -601,7 +601,7 @@ unsafe extern "C" fn video_encoder_set_format( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_encoder_handle_frame( @@ -616,7 +616,7 @@ unsafe extern "C" fn video_encoder_handle_frame( gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_encoder_flush( @@ -629,7 +629,7 @@ unsafe extern "C" fn video_encoder_flush( gst::panic_to_error!(&wrap, &imp.panicked(), false, { VideoEncoderImpl::flush(imp, wrap.unsafe_cast_ref()) }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_encoder_negotiate( @@ -648,7 +648,7 @@ unsafe extern "C" fn video_encoder_negotiate( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_encoder_getcaps( @@ -682,7 +682,7 @@ unsafe extern "C" fn video_encoder_sink_event( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_encoder_sink_query( @@ -696,7 +696,7 @@ unsafe extern "C" fn video_encoder_sink_query( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_encoder_src_event( @@ -710,7 +710,7 @@ unsafe extern "C" fn video_encoder_src_event( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_encoder_src_query( @@ -724,7 +724,7 @@ unsafe extern "C" fn video_encoder_src_query( gst::panic_to_error!(&wrap, &imp.panicked(), false, { imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_encoder_propose_allocation( @@ -745,7 +745,7 @@ unsafe extern "C" fn video_encoder_propose_allocation( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn video_encoder_decide_allocation( @@ -766,5 +766,5 @@ unsafe extern "C" fn video_encoder_decide_allocation( } } }) - .to_glib() + .into_glib() } diff --git a/gstreamer-video/src/subclass/video_sink.rs b/gstreamer-video/src/subclass/video_sink.rs index 90a9d503f..b68ce9075 100644 --- a/gstreamer-video/src/subclass/video_sink.rs +++ b/gstreamer-video/src/subclass/video_sink.rs @@ -74,5 +74,5 @@ unsafe extern "C" fn video_sink_show_frame( gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { imp.show_frame(wrap.unsafe_cast_ref(), &buffer).into() }) - .to_glib() + .into_glib() } diff --git a/gstreamer-video/src/video_codec_frame.rs b/gstreamer-video/src/video_codec_frame.rs index ddd2474d3..fb2e50357 100644 --- a/gstreamer-video/src/video_codec_frame.rs +++ b/gstreamer-video/src/video_codec_frame.rs @@ -92,7 +92,7 @@ impl<'a> VideoCodecFrame<'a> { pub fn set_dts(&mut self, dts: gst::ClockTime) { unsafe { - (*self.to_glib_none().0).dts = dts.to_glib(); + (*self.to_glib_none().0).dts = dts.into_glib(); } } @@ -102,7 +102,7 @@ impl<'a> VideoCodecFrame<'a> { pub fn set_pts(&mut self, pts: gst::ClockTime) { unsafe { - (*self.to_glib_none().0).pts = pts.to_glib(); + (*self.to_glib_none().0).pts = pts.into_glib(); } } @@ -112,7 +112,7 @@ impl<'a> VideoCodecFrame<'a> { pub fn set_duration(&mut self, duration: gst::ClockTime) { unsafe { - (*self.to_glib_none().0).duration = duration.to_glib(); + (*self.to_glib_none().0).duration = duration.into_glib(); } } diff --git a/gstreamer-video/src/video_color_matrix.rs b/gstreamer-video/src/video_color_matrix.rs index ae5e03eb9..bbd8bba77 100644 --- a/gstreamer-video/src/video_color_matrix.rs +++ b/gstreamer-video/src/video_color_matrix.rs @@ -2,7 +2,7 @@ use std::mem; -use glib::translate::ToGlib; +use glib::translate::IntoGlib; impl crate::VideoColorMatrix { pub fn kr_kb(&self) -> Result<(f64, f64), glib::BoolError> { @@ -12,7 +12,7 @@ impl crate::VideoColorMatrix { let mut kb = mem::MaybeUninit::uninit(); glib::result_from_gboolean!( ffi::gst_video_color_matrix_get_Kr_Kb( - self.to_glib(), + self.into_glib(), kr.as_mut_ptr(), kb.as_mut_ptr(), ), diff --git a/gstreamer-video/src/video_decoder.rs b/gstreamer-video/src/video_decoder.rs index aa9f5a35d..4367b23f2 100644 --- a/gstreamer-video/src/video_decoder.rs +++ b/gstreamer-video/src/video_decoder.rs @@ -173,8 +173,8 @@ impl> VideoDecoderExtManual for O { unsafe { ffi::gst_video_decoder_set_latency( self.as_ref().to_glib_none().0, - min_latency.to_glib(), - max_latency.to_glib(), + min_latency.into_glib(), + max_latency.into_glib(), ); } } @@ -246,7 +246,7 @@ impl> VideoDecoderExtManual for O { }; ffi::gst_video_decoder_set_output_state( self.as_ref().to_glib_none().0, - fmt.to_glib(), + fmt.into_glib(), width, height, reference, @@ -277,8 +277,8 @@ impl> VideoDecoderExtManual for O { }; ffi::gst_video_decoder_set_interlaced_output_state( self.as_ref().to_glib_none().0, - fmt.to_glib(), - mode.to_glib(), + fmt.into_glib(), + mode.into_glib(), width, height, reference, @@ -325,7 +325,7 @@ impl> VideoDecoderExtManual for O { from_glib(_gst_video_decoder_error( self.as_ref().to_glib_none().0, weight, - T::domain().to_glib(), + T::domain().into_glib(), code.code(), message.to_glib_full(), debug.to_glib_full(), diff --git a/gstreamer-video/src/video_encoder.rs b/gstreamer-video/src/video_encoder.rs index 40c7b48c4..9e80209d3 100644 --- a/gstreamer-video/src/video_encoder.rs +++ b/gstreamer-video/src/video_encoder.rs @@ -124,8 +124,8 @@ impl> VideoEncoderExtManual for O { unsafe { ffi::gst_video_encoder_set_latency( self.as_ref().to_glib_none().0, - min_latency.to_glib(), - max_latency.to_glib(), + min_latency.into_glib(), + max_latency.into_glib(), ); } } diff --git a/gstreamer-video/src/video_event.rs b/gstreamer-video/src/video_event.rs index e9713fc6b..461dcd161 100644 --- a/gstreamer-video/src/video_event.rs +++ b/gstreamer-video/src/video_event.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, from_glib_full, ToGlib}; +use glib::translate::{from_glib, from_glib_full, IntoGlib}; use glib::ToSendValue; use std::mem; @@ -41,7 +41,7 @@ macro_rules! event_builder_generic_impl { unsafe { let event = $new_fn(&mut self); if let Some(seqnum) = self.seqnum { - gst::ffi::gst_event_set_seqnum(event, seqnum.to_glib()); + gst::ffi::gst_event_set_seqnum(event, seqnum.into_glib()); } if let Some(running_time_offset) = self.running_time_offset { @@ -121,10 +121,10 @@ impl<'a> DownstreamForceKeyUnitEventBuilder<'a> { event_builder_generic_impl!(|s: &mut Self| { ffi::gst_video_event_new_downstream_force_key_unit( - s.timestamp.to_glib(), - s.stream_time.to_glib(), - s.running_time.to_glib(), - s.all_headers.to_glib(), + s.timestamp.into_glib(), + s.stream_time.into_glib(), + s.running_time.into_glib(), + s.all_headers.into_glib(), s.count, ) }); @@ -220,8 +220,8 @@ impl<'a> UpstreamForceKeyUnitEventBuilder<'a> { event_builder_generic_impl!(|s: &mut Self| { ffi::gst_video_event_new_upstream_force_key_unit( - s.running_time.to_glib(), - s.all_headers.to_glib(), + s.running_time.into_glib(), + s.all_headers.into_glib(), s.count, ) }); @@ -308,7 +308,7 @@ impl<'a> StillFrameEventBuilder<'a> { } event_builder_generic_impl!(|s: &mut Self| ffi::gst_video_event_new_still_frame( - s.in_still.to_glib() + s.in_still.into_glib() )); } diff --git a/gstreamer-video/src/video_format.rs b/gstreamer-video/src/video_format.rs index 61a3a5327..a60f3ea17 100644 --- a/gstreamer-video/src/video_format.rs +++ b/gstreamer-video/src/video_format.rs @@ -4,7 +4,7 @@ use once_cell::sync::Lazy; use std::ffi::CStr; use std::str; -use glib::translate::{from_glib, FromGlib, ToGlib}; +use glib::translate::{from_glib, FromGlib, IntoGlib}; #[cfg(feature = "v1_18")] pub static VIDEO_FORMATS_ALL: Lazy> = Lazy::new(|| unsafe { @@ -269,11 +269,11 @@ impl FromGlib for VideoEndianness { } } -impl ToGlib for VideoEndianness { +impl IntoGlib for VideoEndianness { type GlibType = i32; - fn to_glib(&self) -> i32 { - match *self { + fn into_glib(self) -> i32 { + match self { VideoEndianness::LittleEndian => 1234, VideoEndianness::BigEndian => 4321, _ => 0, @@ -297,7 +297,7 @@ impl crate::VideoFormat { from_glib(ffi::gst_video_format_from_masks( depth as i32, bpp as i32, - endianness.to_glib(), + endianness.into_glib(), red_mask, blue_mask, green_mask, @@ -312,7 +312,7 @@ impl crate::VideoFormat { } unsafe { CStr::from_ptr( - ffi::gst_video_format_to_string(self.to_glib()) + ffi::gst_video_format_to_string(self.into_glib()) .as_ref() .expect("gst_video_format_to_string returned NULL"), ) diff --git a/gstreamer-video/src/video_format_info.rs b/gstreamer-video/src/video_format_info.rs index d6c8727af..6fe4d49c9 100644 --- a/gstreamer-video/src/video_format_info.rs +++ b/gstreamer-video/src/video_format_info.rs @@ -5,7 +5,7 @@ use std::ffi::CStr; use std::fmt; use std::str; -use glib::translate::{from_glib, ToGlib}; +use glib::translate::{from_glib, IntoGlib}; pub struct VideoFormatInfo(&'static ffi::GstVideoFormatInfo); @@ -14,7 +14,7 @@ impl VideoFormatInfo { assert_initialized_main_thread!(); unsafe { - let info = ffi::gst_video_format_get_info(format.to_glib()); + let info = ffi::gst_video_format_get_info(format.into_glib()); assert!(!info.is_null()); VideoFormatInfo(&*info) @@ -201,7 +201,7 @@ impl VideoFormatInfo { (self.0.unpack_func.as_ref().unwrap())( self.0, - flags.to_glib(), + flags.into_glib(), dest.as_mut_ptr() as *mut _, src_ptr.as_ptr() as *const _, stride.as_ptr() as *const i32, @@ -277,12 +277,12 @@ impl VideoFormatInfo { (self.0.pack_func.as_ref().unwrap())( self.0, - flags.to_glib(), + flags.into_glib(), src.as_ptr() as *mut _, src_stride, dest_ptr.as_mut_ptr() as *mut _, dest_stride.as_ptr() as *const i32, - chroma_site.to_glib(), + chroma_site.into_glib(), y, width, ); diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index a6605c002..164e25d06 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -1,7 +1,7 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::translate::{ - from_glib, from_glib_full, from_glib_none, FromGlib, FromGlibPtrFull, ToGlib, ToGlibPtr, + from_glib, from_glib_full, from_glib_none, FromGlib, FromGlibPtrFull, IntoGlib, ToGlibPtr, ToGlibPtrMut, }; use gst::prelude::*; @@ -23,11 +23,11 @@ pub enum VideoColorRange { } #[doc(hidden)] -impl ToGlib for VideoColorRange { +impl IntoGlib for VideoColorRange { type GlibType = ffi::GstVideoColorRange; - fn to_glib(&self) -> ffi::GstVideoColorRange { - match *self { + fn into_glib(self) -> ffi::GstVideoColorRange { + match self { VideoColorRange::Unknown => ffi::GST_VIDEO_COLOR_RANGE_UNKNOWN, VideoColorRange::Range0255 => ffi::GST_VIDEO_COLOR_RANGE_0_255, VideoColorRange::Range16235 => ffi::GST_VIDEO_COLOR_RANGE_16_235, @@ -71,7 +71,7 @@ unsafe impl<'a> glib::value::FromValue<'a> for VideoColorRange { impl glib::value::ToValue for VideoColorRange { fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); - unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.to_glib()) } + unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()) } value } @@ -92,10 +92,10 @@ impl VideoColorimetry { assert_initialized_main_thread!(); let colorimetry = ffi::GstVideoColorimetry { - range: range.to_glib(), - matrix: matrix.to_glib(), - transfer: transfer.to_glib(), - primaries: primaries.to_glib(), + range: range.into_glib(), + matrix: matrix.into_glib(), + transfer: transfer.into_glib(), + primaries: primaries.into_glib(), }; VideoColorimetry(colorimetry) @@ -179,9 +179,9 @@ impl crate::VideoChromaSite { unsafe { cfg_if::cfg_if! { if #[cfg(all(feature = "v1_20", not(feature = "dox")))] { - from_glib_full(ffi::gst_video_chroma_site_to_string(self.to_glib())) + from_glib_full(ffi::gst_video_chroma_site_to_string(self.into_glib())) } else { - from_glib_none(ffi::gst_video_chroma_to_string(self.to_glib())) + from_glib_none(ffi::gst_video_chroma_to_string(self.into_glib())) } } } @@ -221,7 +221,7 @@ impl fmt::Display for crate::VideoChromaSite { impl From for crate::VideoMultiviewMode { fn from(v: crate::VideoMultiviewFramePacking) -> Self { skip_assert_initialized!(); - unsafe { from_glib(v.to_glib()) } + unsafe { from_glib(v.into_glib()) } } } @@ -233,7 +233,7 @@ impl std::convert::TryFrom for crate::VideoMultiviewF ) -> Result { skip_assert_initialized!(); - let v2 = unsafe { from_glib(v.to_glib()) }; + let v2 = unsafe { from_glib(v.into_glib()) }; if let crate::VideoMultiviewFramePacking::__Unknown(_) = v2 { Err(glib::bool_error!("Invalid frame packing mode")) @@ -306,15 +306,15 @@ impl<'a> VideoInfoBuilder<'a> { from_glib(if let Some(interlace_mode) = self.interlace_mode { ffi::gst_video_info_set_interlaced_format( info.as_mut_ptr(), - self.format.to_glib(), - interlace_mode.to_glib(), + self.format.into_glib(), + interlace_mode.into_glib(), self.width, self.height, ) } else { ffi::gst_video_info_set_format( info.as_mut_ptr(), - self.format.to_glib(), + self.format.into_glib(), self.width, self.height, ) @@ -324,7 +324,7 @@ impl<'a> VideoInfoBuilder<'a> { let res: bool = { let res = from_glib(ffi::gst_video_info_set_format( info.as_mut_ptr(), - self.format.to_glib(), + self.format.into_glib(), self.width, self.height, )); @@ -332,7 +332,7 @@ impl<'a> VideoInfoBuilder<'a> { if res { if let Some(interlace_mode) = self.interlace_mode { let info = info.as_mut_ptr(); - (*info).interlace_mode = interlace_mode.to_glib(); + (*info).interlace_mode = interlace_mode.into_glib(); } } @@ -345,7 +345,7 @@ impl<'a> VideoInfoBuilder<'a> { let res = if gst::version() < (1, 11, 1, 0) { ffi::gst_video_info_set_format( info.as_mut_ptr(), - self.format.to_glib(), + self.format.into_glib(), self.width, self.height, ); @@ -354,7 +354,7 @@ impl<'a> VideoInfoBuilder<'a> { } else { from_glib(ffi::gst_video_info_set_format( info.as_mut_ptr(), - self.format.to_glib(), + self.format.into_glib(), self.width, self.height, )) @@ -363,7 +363,7 @@ impl<'a> VideoInfoBuilder<'a> { if res { if let Some(interlace_mode) = self.interlace_mode { let info = info.as_mut_ptr(); - (*info).interlace_mode = interlace_mode.to_glib(); + (*info).interlace_mode = interlace_mode.into_glib(); } } @@ -383,7 +383,7 @@ impl<'a> VideoInfoBuilder<'a> { } if let Some(flags) = self.flags { - info.flags = flags.to_glib(); + info.flags = flags.into_glib(); } if let Some(size) = self.size { @@ -395,7 +395,7 @@ impl<'a> VideoInfoBuilder<'a> { } if let Some(chroma_site) = self.chroma_site { - info.chroma_site = chroma_site.to_glib(); + info.chroma_site = chroma_site.into_glib(); } if let Some(colorimetry) = self.colorimetry { @@ -432,18 +432,18 @@ impl<'a> VideoInfoBuilder<'a> { if let Some(multiview_mode) = self.multiview_mode { let ptr = &mut info.ABI._gst_reserved as *mut _ as *mut i32; - ptr::write(ptr.offset(0), multiview_mode.to_glib()); + ptr::write(ptr.offset(0), multiview_mode.into_glib()); } if let Some(multiview_flags) = self.multiview_flags { let ptr = &mut info.ABI._gst_reserved as *mut _ as *mut u32; - ptr::write(ptr.offset(1), multiview_flags.to_glib()); + ptr::write(ptr.offset(1), multiview_flags.into_glib()); } #[cfg(any(feature = "v1_12", feature = "dox"))] if let Some(field_order) = self.field_order { let ptr = &mut info.ABI._gst_reserved as *mut _ as *mut i32; - ptr::write(ptr.offset(2), field_order.to_glib()); + ptr::write(ptr.offset(2), field_order.into_glib()); } Ok(VideoInfo(info)) @@ -756,9 +756,9 @@ 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.format().to_glib(), + src_val.format().into_glib(), src_val.to_raw_value(), - U::default_format().to_glib(), + U::default_format().into_glib(), dest_val.as_mut_ptr(), )) { Some(U::from_raw(U::default_format(), dest_val.assume_init())) @@ -780,9 +780,9 @@ 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.format().to_glib(), + src_val.format().into_glib(), src_val.to_raw_value(), - dest_fmt.to_glib(), + dest_fmt.into_glib(), dest_val.as_mut_ptr(), )) { Some(gst::GenericFormattedValue::new( @@ -968,7 +968,7 @@ impl crate::VideoFieldOrder { } unsafe { CStr::from_ptr( - ffi::gst_video_field_order_to_string(self.to_glib()) + ffi::gst_video_field_order_to_string(self.into_glib()) .as_ref() .expect("gst_video_field_order_to_string returned NULL"), ) diff --git a/gstreamer-video/src/video_meta.rs b/gstreamer-video/src/video_meta.rs index 824dd1391..dd03fa85e 100644 --- a/gstreamer-video/src/video_meta.rs +++ b/gstreamer-video/src/video_meta.rs @@ -3,7 +3,7 @@ use std::fmt; use std::ptr; -use glib::translate::{from_glib, from_glib_none, FromGlib, ToGlib, ToGlibPtr}; +use glib::translate::{from_glib, from_glib_none, FromGlib, IntoGlib, ToGlibPtr}; use gst::prelude::*; #[repr(transparent)] @@ -43,8 +43,8 @@ impl VideoMeta { unsafe { let meta = ffi::gst_buffer_add_video_meta( buffer.as_mut_ptr(), - flags.to_glib(), - format.to_glib(), + flags.into_glib(), + format.into_glib(), width, height, ); @@ -93,8 +93,8 @@ impl VideoMeta { unsafe { let meta = ffi::gst_buffer_add_video_meta_full( buffer.as_mut_ptr(), - flags.to_glib(), - format.to_glib(), + flags.into_glib(), + format.into_glib(), width, height, n_planes, @@ -559,7 +559,7 @@ impl VideoCaptionMeta { unsafe { let meta = ffi::gst_buffer_add_video_caption_meta( buffer.as_mut_ptr(), - caption_type.to_glib(), + caption_type.into_glib(), data.as_ptr(), data.len(), ); @@ -629,8 +629,8 @@ impl VideoAFDMeta { let meta = ffi::gst_buffer_add_video_afd_meta( buffer.as_mut_ptr(), field, - spec.to_glib(), - afd.to_glib(), + spec.into_glib(), + afd.into_glib(), ); Self::from_mut_ptr(buffer, meta) @@ -700,7 +700,7 @@ impl VideoBarMeta { let meta = ffi::gst_buffer_add_video_bar_meta( buffer.as_mut_ptr(), field, - is_letterbox.to_glib(), + is_letterbox.into_glib(), bar_data1, bar_data2, ); diff --git a/gstreamer-video/src/video_overlay_composition.rs b/gstreamer-video/src/video_overlay_composition.rs index 5f446e585..506a1db3d 100644 --- a/gstreamer-video/src/video_overlay_composition.rs +++ b/gstreamer-video/src/video_overlay_composition.rs @@ -3,7 +3,7 @@ use std::fmt; use std::mem; -use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr}; +use glib::translate::{from_glib, from_glib_full, from_glib_none, IntoGlib, ToGlibPtr}; gst::mini_object_wrapper!( VideoOverlayRectangle, @@ -46,7 +46,7 @@ impl VideoOverlayRectangle { render_y, render_width, render_height, - flags.to_glib(), + flags.into_glib(), )) } } @@ -119,7 +119,7 @@ impl VideoOverlayRectangleRef { unsafe { from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_unscaled_raw( self.as_mut_ptr(), - flags.to_glib(), + flags.into_glib(), )) } } @@ -128,7 +128,7 @@ impl VideoOverlayRectangleRef { unsafe { from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_unscaled_ayuv( self.as_mut_ptr(), - flags.to_glib(), + flags.into_glib(), )) } } @@ -137,7 +137,7 @@ impl VideoOverlayRectangleRef { unsafe { from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_unscaled_argb( self.as_mut_ptr(), - flags.to_glib(), + flags.into_glib(), )) } } @@ -146,7 +146,7 @@ impl VideoOverlayRectangleRef { unsafe { from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_raw( self.as_mut_ptr(), - flags.to_glib(), + flags.into_glib(), )) } } @@ -155,7 +155,7 @@ impl VideoOverlayRectangleRef { unsafe { from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_ayuv( self.as_mut_ptr(), - flags.to_glib(), + flags.into_glib(), )) } } @@ -164,7 +164,7 @@ impl VideoOverlayRectangleRef { unsafe { from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_argb( self.as_mut_ptr(), - flags.to_glib(), + flags.into_glib(), )) } } diff --git a/gstreamer-video/src/video_rectangle.rs b/gstreamer-video/src/video_rectangle.rs index d69d4d38a..77bee2ca4 100644 --- a/gstreamer-video/src/video_rectangle.rs +++ b/gstreamer-video/src/video_rectangle.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::ToGlib; +use glib::translate::IntoGlib; #[derive(Clone, Debug, Eq, PartialEq, Hash)] pub struct VideoRectangle { @@ -42,7 +42,7 @@ pub fn center_video_rectangle( h: dst.h, }; unsafe { - ffi::gst_video_sink_center_rect(src_rect, dst_rect, &mut result, scale.to_glib()); + ffi::gst_video_sink_center_rect(src_rect, dst_rect, &mut result, scale.into_glib()); } VideoRectangle::new(result.x, result.y, result.w, result.h) } diff --git a/gstreamer-video/src/video_time_code.rs b/gstreamer-video/src/video_time_code.rs index 9db363c20..f1dcef555 100644 --- a/gstreamer-video/src/video_time_code.rs +++ b/gstreamer-video/src/video_time_code.rs @@ -49,7 +49,7 @@ impl VideoTimeCode { *fps.numer() as u32, *fps.denom() as u32, latest_daily_jam.to_glib_none().0, - flags.to_glib(), + flags.into_glib(), hours, minutes, seconds, @@ -78,7 +78,7 @@ impl VideoTimeCode { *fps.numer() as u32, *fps.denom() as u32, dt.to_glib_none().0, - flags.to_glib(), + flags.into_glib(), field_count, ); @@ -100,7 +100,7 @@ impl VideoTimeCode { } pub fn set_flags(&mut self, flags: VideoTimeCodeFlags) { - self.0.config.flags = flags.to_glib() + self.0.config.flags = flags.into_glib() } pub fn set_hours(&mut self, hours: u32) { diff --git a/gstreamer-webrtc/src/web_rtc_session_description.rs b/gstreamer-webrtc/src/web_rtc_session_description.rs index b86c02176..0152d26f9 100644 --- a/gstreamer-webrtc/src/web_rtc_session_description.rs +++ b/gstreamer-webrtc/src/web_rtc_session_description.rs @@ -11,7 +11,7 @@ impl WebRTCSessionDescription { unsafe { let mut sdp = mem::ManuallyDrop::new(sdp); from_glib_full(ffi::gst_webrtc_session_description_new( - type_.to_glib(), + type_.into_glib(), sdp.to_glib_none_mut().0, )) } diff --git a/gstreamer/src/allocation_params.rs b/gstreamer/src/allocation_params.rs index 6768afa91..236361900 100644 --- a/gstreamer/src/allocation_params.rs +++ b/gstreamer/src/allocation_params.rs @@ -33,7 +33,7 @@ impl AllocationParams { assert_initialized_main_thread!(); let allocationparams = unsafe { ffi::GstAllocationParams { - flags: flags.to_glib(), + flags: flags.into_glib(), align, prefix, padding, diff --git a/gstreamer/src/bin.rs b/gstreamer/src/bin.rs index 4770b1757..5e2192c6d 100644 --- a/gstreamer/src/bin.rs +++ b/gstreamer/src/bin.rs @@ -116,7 +116,7 @@ impl> GstBinExtManual for O { unsafe { from_glib_full(ffi::gst_bin_iterate_all_by_interface( self.as_ref().to_glib_none().0, - iface.to_glib(), + iface.into_glib(), )) } } @@ -177,7 +177,7 @@ impl> GstBinExtManual for O { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); - (*ptr).flags |= flags.to_glib(); + (*ptr).flags |= flags.into_glib(); } } @@ -185,7 +185,7 @@ impl> GstBinExtManual for O { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); - (*ptr).flags &= !flags.to_glib(); + (*ptr).flags &= !flags.into_glib(); } } @@ -216,7 +216,7 @@ where false } } - .to_glib() + .into_glib() } #[cfg(test)] diff --git a/gstreamer/src/buffer.rs b/gstreamer/src/buffer.rs index b5514845f..8296bda0a 100644 --- a/gstreamer/src/buffer.rs +++ b/gstreamer/src/buffer.rs @@ -17,7 +17,7 @@ use crate::ClockTime; use crate::Memory; use crate::MemoryRef; -use glib::translate::{from_glib, from_glib_full, FromGlib, FromGlibPtrFull, ToGlib}; +use glib::translate::{from_glib, from_glib_full, FromGlib, FromGlibPtrFull, IntoGlib}; pub enum Readable {} pub enum Writable {} @@ -218,7 +218,7 @@ impl BufferRef { unsafe { Option::<_>::from_glib_full(ffi::gst_buffer_copy_region( self.as_mut_ptr(), - flags.to_glib(), + flags.into_glib(), offset, size_real, )) @@ -239,7 +239,7 @@ impl BufferRef { ffi::gst_buffer_copy_into( dest.as_mut_ptr(), self.as_mut_ptr(), - flags.to_glib(), + flags.into_glib(), offset, size_real, ), @@ -344,7 +344,7 @@ impl BufferRef { } pub fn set_pts(&mut self, pts: ClockTime) { - self.0.pts = pts.to_glib(); + self.0.pts = pts.into_glib(); } pub fn dts(&self) -> ClockTime { @@ -352,7 +352,7 @@ impl BufferRef { } pub fn set_dts(&mut self, dts: ClockTime) { - self.0.dts = dts.to_glib(); + self.0.dts = dts.into_glib(); } pub fn dts_or_pts(&self) -> ClockTime { @@ -369,7 +369,7 @@ impl BufferRef { } pub fn set_duration(&mut self, duration: ClockTime) { - self.0.duration = duration.to_glib(); + self.0.duration = duration.into_glib(); } pub fn flags(&self) -> BufferFlags { @@ -386,7 +386,7 @@ impl BufferRef { pub fn meta(&self) -> Option> { unsafe { - let meta = ffi::gst_buffer_get_meta(self.as_mut_ptr(), T::meta_api().to_glib()); + let meta = ffi::gst_buffer_get_meta(self.as_mut_ptr(), T::meta_api().into_glib()); if meta.is_null() { None } else { @@ -397,7 +397,7 @@ impl BufferRef { pub fn meta_mut(&mut self) -> Option> { unsafe { - let meta = ffi::gst_buffer_get_meta(self.as_mut_ptr(), T::meta_api().to_glib()); + let meta = ffi::gst_buffer_get_meta(self.as_mut_ptr(), T::meta_api().into_glib()); if meta.is_null() { None } else { @@ -423,7 +423,7 @@ impl BufferRef { let func = user_data as *const _ as usize as *mut F; let res = (*func)(Meta::from_ptr(BufferRef::from_ptr(buffer), *meta)); - res.to_glib() + res.into_glib() } unsafe { @@ -456,9 +456,9 @@ impl BufferRef { match res { Ok(false) | Err(false) => { *meta = ptr::null_mut(); - res.is_ok().to_glib() + res.is_ok().into_glib() } - Ok(true) | Err(true) => res.is_ok().to_glib(), + Ok(true) | Err(true) => res.is_ok().into_glib(), } } diff --git a/gstreamer/src/buffer_pool.rs b/gstreamer/src/buffer_pool.rs index 0770a913b..f4a8627eb 100644 --- a/gstreamer/src/buffer_pool.rs +++ b/gstreamer/src/buffer_pool.rs @@ -6,7 +6,9 @@ use crate::BufferPool; use crate::Structure; use glib::prelude::*; -use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr, ToGlibPtrMut}; +use glib::translate::{ + from_glib, from_glib_full, from_glib_none, IntoGlib, ToGlibPtr, ToGlibPtrMut, +}; use std::mem; use std::ops; @@ -188,7 +190,7 @@ impl BufferPoolAcquireParams { format: ffi::GST_FORMAT_UNDEFINED, start: -1, stop: -1, - flags: flags.to_glib(), + flags: flags.into_glib(), _gst_reserved: [ptr::null_mut(); 4], }) } @@ -201,10 +203,10 @@ impl BufferPoolAcquireParams { skip_assert_initialized!(); unsafe { BufferPoolAcquireParams(ffi::GstBufferPoolAcquireParams { - format: start.format().to_glib(), + format: start.format().into_glib(), start: start.to_raw_value(), stop: stop.to_raw_value(), - flags: flags.to_glib(), + flags: flags.into_glib(), _gst_reserved: [ptr::null_mut(); 4], }) } diff --git a/gstreamer/src/bufferlist.rs b/gstreamer/src/bufferlist.rs index e20030e7b..04ddd2054 100644 --- a/gstreamer/src/bufferlist.rs +++ b/gstreamer/src/bufferlist.rs @@ -1,6 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib}; +use glib::translate::{from_glib, from_glib_full, from_glib_none, IntoGlib}; use std::fmt; use std::ptr; @@ -105,7 +105,7 @@ impl BufferListRef { let func = user_data as *const _ as usize as *mut F; let res = (*func)(BufferRef::from_ptr(*buffer), idx); - res.to_glib() + res.into_glib() } unsafe { @@ -136,7 +136,7 @@ impl BufferListRef { match res { Ok(None) | Err(None) => { *buffer = ptr::null_mut(); - res.is_ok().to_glib() + res.is_ok().into_glib() } Ok(Some(b)) => { *buffer = b.into_ptr(); diff --git a/gstreamer/src/bus.rs b/gstreamer/src/bus.rs index 083b09215..815cbe896 100644 --- a/gstreamer/src/bus.rs +++ b/gstreamer/src/bus.rs @@ -24,7 +24,7 @@ unsafe extern "C" fn trampoline_watch Continue + 'st func: gpointer, ) -> gboolean { let func: &RefCell = &*(func as *const RefCell); - (&mut *func.borrow_mut())(&from_glib_borrow(bus), &Message::from_glib_borrow(msg)).to_glib() + (&mut *func.borrow_mut())(&from_glib_borrow(bus), &Message::from_glib_borrow(msg)).into_glib() } unsafe extern "C" fn destroy_closure_watch Continue + 'static>( @@ -47,7 +47,7 @@ unsafe extern "C" fn trampoline_sync< func: gpointer, ) -> ffi::GstBusSyncReply { let f: &F = &*(func as *const F); - let res = f(&from_glib_borrow(bus), &Message::from_glib_borrow(msg)).to_glib(); + let res = f(&from_glib_borrow(bus), &Message::from_glib_borrow(msg)).into_glib(); if res == ffi::GST_BUS_DROP { ffi::gst_mini_object_unref(msg as *mut _); @@ -74,7 +74,7 @@ fn into_raw_sync BusSyncReply + Send + Sync + 'static>( impl Bus { pub fn add_signal_watch_full(&self, priority: Priority) { unsafe { - ffi::gst_bus_add_signal_watch_full(self.to_glib_none().0, priority.to_glib()); + ffi::gst_bus_add_signal_watch_full(self.to_glib_none().0, priority.into_glib()); } } @@ -94,7 +94,7 @@ impl Bus { into_raw_watch(func), Some(destroy_closure_watch::), ); - glib::ffi::g_source_set_priority(source, priority.to_glib()); + glib::ffi::g_source_set_priority(source, priority.into_glib()); if let Some(name) = name { glib::ffi::g_source_set_name(source, name.to_glib_none().0); @@ -162,7 +162,7 @@ impl Bus { // This is not thread-safe before 1.16.3, see // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/merge_requests/416 if crate::version() < (1, 16, 3, 0) { - if !glib::gobject_ffi::g_object_get_qdata(bus as *mut _, SET_ONCE_QUARK.to_glib()) + if !glib::gobject_ffi::g_object_get_qdata(bus as *mut _, SET_ONCE_QUARK.into_glib()) .is_null() { panic!("Bus sync handler can only be set once"); @@ -170,7 +170,7 @@ impl Bus { glib::gobject_ffi::g_object_set_qdata( bus as *mut _, - SET_ONCE_QUARK.to_glib(), + SET_ONCE_QUARK.into_glib(), 1 as *mut _, ); } diff --git a/gstreamer/src/caps.rs b/gstreamer/src/caps.rs index d50d214d0..75f4c2c42 100644 --- a/gstreamer/src/caps.rs +++ b/gstreamer/src/caps.rs @@ -9,7 +9,7 @@ use std::str; use crate::CapsIntersectMode; -use glib::translate::{from_glib, from_glib_full, FromGlibPtrFull, ToGlib, ToGlibPtr}; +use glib::translate::{from_glib, from_glib_full, FromGlibPtrFull, IntoGlib, ToGlibPtr}; use glib::value::ToSendValue; mini_object_wrapper!(Caps, CapsRef, ffi::GstCaps, || { ffi::gst_caps_get_type() }); @@ -314,7 +314,7 @@ impl CapsRef { from_glib_full(ffi::gst_caps_intersect_full( self.as_mut_ptr(), other.as_mut_ptr(), - mode.to_glib(), + mode.into_glib(), )) } } diff --git a/gstreamer/src/caps_features.rs b/gstreamer/src/caps_features.rs index 0b8fcabf5..de42ede71 100644 --- a/gstreamer/src/caps_features.rs +++ b/gstreamer/src/caps_features.rs @@ -321,7 +321,7 @@ impl CapsFeaturesRef { unsafe { from_glib(ffi::gst_caps_features_contains_id( self.as_ptr(), - feature.to_glib(), + feature.into_glib(), )) } } @@ -365,11 +365,11 @@ impl CapsFeaturesRef { } pub fn add_from_quark(&mut self, feature: glib::Quark) { - unsafe { ffi::gst_caps_features_add_id(self.as_mut_ptr(), feature.to_glib()) } + unsafe { ffi::gst_caps_features_add_id(self.as_mut_ptr(), feature.into_glib()) } } pub fn remove_by_quark(&mut self, feature: glib::Quark) { - unsafe { ffi::gst_caps_features_remove_id(self.as_mut_ptr(), feature.to_glib()) } + unsafe { ffi::gst_caps_features_remove_id(self.as_mut_ptr(), feature.into_glib()) } } pub fn iter(&self) -> Iter { diff --git a/gstreamer/src/clock.rs b/gstreamer/src/clock.rs index 2d8c10afb..59a4c9c33 100644 --- a/gstreamer/src/clock.rs +++ b/gstreamer/src/clock.rs @@ -302,11 +302,11 @@ impl AtomicClockReturn { } pub fn store(&self, val: ClockReturn) { - self.0.store(val.to_glib(), atomic::Ordering::SeqCst) + self.0.store(val.into_glib(), atomic::Ordering::SeqCst) } pub fn swap(&self, val: ClockReturn) -> ClockReturn { - unsafe { from_glib(self.0.swap(val.to_glib(), atomic::Ordering::SeqCst)) } + unsafe { from_glib(self.0.swap(val.into_glib(), atomic::Ordering::SeqCst)) } } pub fn compare_exchange( @@ -317,8 +317,8 @@ impl AtomicClockReturn { unsafe { self.0 .compare_exchange( - current.to_glib(), - new.to_glib(), + current.into_glib(), + new.into_glib(), atomic::Ordering::SeqCst, atomic::Ordering::SeqCst, ) @@ -343,11 +343,11 @@ impl Clock { unsafe { from_glib(ffi::gst_clock_adjust_with_calibration( ptr::null_mut(), - internal_target.to_glib(), - cinternal.to_glib(), - cexternal.to_glib(), - cnum.to_glib(), - cdenom.to_glib(), + internal_target.into_glib(), + cinternal.into_glib(), + cexternal.into_glib(), + cnum.into_glib(), + cdenom.into_glib(), )) } } @@ -363,11 +363,11 @@ impl Clock { unsafe { from_glib(ffi::gst_clock_unadjust_with_calibration( ptr::null_mut(), - external_target.to_glib(), - cinternal.to_glib(), - cexternal.to_glib(), - cnum.to_glib(), - cdenom.to_glib(), + external_target.into_glib(), + cinternal.into_glib(), + cexternal.into_glib(), + cnum.into_glib(), + cdenom.into_glib(), )) } } @@ -407,8 +407,8 @@ impl> ClockExtManual for O { unsafe { PeriodicClockId(from_glib_full(ffi::gst_clock_new_periodic_id( self.as_ref().to_glib_none().0, - start_time.to_glib(), - interval.to_glib(), + start_time.into_glib(), + interval.into_glib(), ))) } } @@ -424,8 +424,8 @@ impl> ClockExtManual for O { let res: bool = from_glib(ffi::gst_clock_periodic_id_reinit( self.as_ref().to_glib_none().0, id.to_glib_none().0, - start_time.to_glib(), - interval.to_glib(), + start_time.into_glib(), + interval.into_glib(), )); if res { Ok(()) @@ -441,7 +441,7 @@ impl> ClockExtManual for O { unsafe { SingleShotClockId(from_glib_full(ffi::gst_clock_new_single_shot_id( self.as_ref().to_glib_none().0, - time.to_glib(), + time.into_glib(), ))) } } @@ -455,7 +455,7 @@ impl> ClockExtManual for O { let res: bool = from_glib(ffi::gst_clock_single_shot_id_reinit( self.as_ref().to_glib_none().0, id.to_glib_none().0, - time.to_glib(), + time.into_glib(), )); if res { Ok(()) @@ -469,7 +469,7 @@ impl> ClockExtManual for O { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); - (*ptr).flags |= flags.to_glib(); + (*ptr).flags |= flags.into_glib(); } } @@ -477,7 +477,7 @@ impl> ClockExtManual for O { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); - (*ptr).flags &= !flags.to_glib(); + (*ptr).flags &= !flags.into_glib(); } } diff --git a/gstreamer/src/clock_time.rs b/gstreamer/src/clock_time.rs index d9c084ce4..ede950835 100644 --- a/gstreamer/src/clock_time.rs +++ b/gstreamer/src/clock_time.rs @@ -283,10 +283,10 @@ impl fmt::Display for ClockTime { } #[doc(hidden)] -impl ToGlib for ClockTime { +impl IntoGlib for ClockTime { type GlibType = ffi::GstClockTime; - fn to_glib(&self) -> ffi::GstClockTime { + fn into_glib(self) -> ffi::GstClockTime { match self.0 { None => ffi::GST_CLOCK_TIME_NONE, Some(v) => v, @@ -325,7 +325,9 @@ unsafe impl<'a> glib::value::FromValue<'a> for ClockTime { impl glib::value::ToValue for ClockTime { fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); - unsafe { glib::gobject_ffi::g_value_set_uint64(value.to_glib_none_mut().0, self.to_glib()) } + unsafe { + glib::gobject_ffi::g_value_set_uint64(value.to_glib_none_mut().0, self.into_glib()) + } value } diff --git a/gstreamer/src/context.rs b/gstreamer/src/context.rs index edce48282..7dc9b61c4 100644 --- a/gstreamer/src/context.rs +++ b/gstreamer/src/context.rs @@ -3,7 +3,7 @@ use std::ffi::CStr; use std::fmt; -use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr}; +use glib::translate::{from_glib, from_glib_full, IntoGlib, ToGlibPtr}; use crate::StructureRef; @@ -17,7 +17,7 @@ impl Context { unsafe { from_glib_full(ffi::gst_context_new( context_type.to_glib_none().0, - persistent.to_glib(), + persistent.into_glib(), )) } } diff --git a/gstreamer/src/control_binding.rs b/gstreamer/src/control_binding.rs index c5d200b90..4804dc443 100644 --- a/gstreamer/src/control_binding.rs +++ b/gstreamer/src/control_binding.rs @@ -26,8 +26,8 @@ impl> ControlBindingExtManual for O { glib::result_from_gboolean!( ffi::gst_control_binding_get_g_value_array( self.as_ref().to_glib_none().0, - timestamp.to_glib(), - interval.to_glib(), + timestamp.into_glib(), + interval.into_glib(), n_values, values.as_mut_ptr() as *mut glib::gobject_ffi::GValue, ), diff --git a/gstreamer/src/control_source.rs b/gstreamer/src/control_source.rs index 51b20926c..46e0354e1 100644 --- a/gstreamer/src/control_source.rs +++ b/gstreamer/src/control_source.rs @@ -26,8 +26,8 @@ impl> ControlSourceExtManual for O { glib::result_from_gboolean!( ffi::gst_control_source_get_value_array( self.as_ref().to_glib_none().0, - timestamp.to_glib(), - interval.to_glib(), + timestamp.into_glib(), + interval.into_glib(), n_values, values.to_glib_none().0, ), diff --git a/gstreamer/src/date_time_serde.rs b/gstreamer/src/date_time_serde.rs index 1fedde466..8eea7694c 100644 --- a/gstreamer/src/date_time_serde.rs +++ b/gstreamer/src/date_time_serde.rs @@ -2,7 +2,7 @@ use std::convert::{TryFrom, TryInto}; -use glib::translate::{FromGlib, ToGlib}; +use glib::translate::{FromGlib, IntoGlib}; use glib::value::{ToValue, ToValueOptional}; use glib::StaticType; @@ -60,7 +60,7 @@ impl<'a> Serialize for Date { fn serialize(&self, serializer: S) -> Result { DateTimeVariants::YMD( self.0.year() as i32, - self.0.month().to_glib() as i32, + self.0.month().into_glib() as i32, self.0.day() as i32, ) .serialize(serializer) diff --git a/gstreamer/src/device_monitor.rs b/gstreamer/src/device_monitor.rs index 27c08bd09..f4711760e 100644 --- a/gstreamer/src/device_monitor.rs +++ b/gstreamer/src/device_monitor.rs @@ -30,10 +30,10 @@ impl Default for DeviceMonitor { #[derive(Debug, PartialEq, Eq)] pub struct DeviceMonitorFilterId(NonZeroU32); -impl ToGlib for DeviceMonitorFilterId { +impl IntoGlib for DeviceMonitorFilterId { type GlibType = libc::c_uint; - fn to_glib(&self) -> libc::c_uint { + fn into_glib(self) -> libc::c_uint { self.0.get() } } @@ -86,7 +86,7 @@ impl> DeviceMonitorExtManual for O { glib::result_from_gboolean!( ffi::gst_device_monitor_remove_filter( self.as_ref().to_glib_none().0, - filter_id.to_glib() + filter_id.into_glib() ), "Failed to remove the filter" ) diff --git a/gstreamer/src/device_provider.rs b/gstreamer/src/device_provider.rs index 70b04d691..30665e1e9 100644 --- a/gstreamer/src/device_provider.rs +++ b/gstreamer/src/device_provider.rs @@ -22,8 +22,8 @@ impl DeviceProvider { ffi::gst_device_provider_register( plugin.to_glib_none().0, name.to_glib_none().0, - rank.to_glib() as u32, - type_.to_glib() + rank.into_glib() as u32, + type_.into_glib() ), "Failed to register device provider factory" ) diff --git a/gstreamer/src/element.rs b/gstreamer/src/element.rs index 0c37a553f..ff91f0462 100644 --- a/gstreamer/src/element.rs +++ b/gstreamer/src/element.rs @@ -78,8 +78,8 @@ impl Element { ffi::gst_element_register( plugin.to_glib_none().0, name.to_glib_none().0, - rank.to_glib() as u32, - type_.to_glib() + rank.into_glib() as u32, + type_.into_glib() ), "Failed to register element factory" ) @@ -97,10 +97,10 @@ pub enum ElementMessageType { #[derive(Debug, PartialEq, Eq)] pub struct NotifyWatchId(NonZeroU64); -impl ToGlib for NotifyWatchId { +impl IntoGlib for NotifyWatchId { type GlibType = libc::c_ulong; - fn to_glib(&self) -> libc::c_ulong { + fn into_glib(self) -> libc::c_ulong { self.0.get() as libc::c_ulong } } @@ -278,7 +278,7 @@ impl> ElementExtManual for O { let ret: StateChangeReturn = unsafe { from_glib(ffi::gst_element_change_state( self.as_ref().to_glib_none().0, - transition.to_glib(), + transition.into_glib(), )) }; ret.into_result() @@ -291,7 +291,7 @@ impl> ElementExtManual for O { let ret: StateChangeReturn = unsafe { from_glib(ffi::gst_element_continue_state( self.as_ref().to_glib_none().0, - ret.to_glib(), + ret.into_glib(), )) }; ret.into_result() @@ -308,7 +308,7 @@ impl> ElementExtManual for O { self.as_ref().to_glib_none().0, state.as_mut_ptr(), pending.as_mut_ptr(), - timeout.to_glib(), + timeout.into_glib(), )); ( ret.into_result(), @@ -322,7 +322,7 @@ impl> ElementExtManual for O { let ret: StateChangeReturn = unsafe { from_glib(ffi::gst_element_set_state( self.as_ref().to_glib_none().0, - state.to_glib(), + state.into_glib(), )) }; ret.into_result() @@ -362,7 +362,7 @@ impl> ElementExtManual for O { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); - (*ptr).flags |= flags.to_glib(); + (*ptr).flags |= flags.into_glib(); } } @@ -370,7 +370,7 @@ impl> ElementExtManual for O { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); - (*ptr).flags &= !flags.to_glib(); + (*ptr).flags &= !flags.into_glib(); } } @@ -402,7 +402,7 @@ impl> ElementExtManual for O { ffi::gst_element_message_full( self.as_ref().to_glib_none().0, type_, - T::domain().to_glib(), + T::domain().into_glib(), code.code(), message.to_glib_full(), debug.to_glib_full(), @@ -436,7 +436,7 @@ impl> ElementExtManual for O { ffi::gst_element_message_full_with_details( self.as_ref().to_glib_none().0, type_, - T::domain().to_glib(), + T::domain().into_glib(), code.code(), message.to_glib_full(), debug.to_glib_full(), @@ -472,7 +472,7 @@ impl> ElementExtManual for O { ffi::gst_element_message_full( self.as_ref().to_glib_none().0, ffi::GST_MESSAGE_ERROR, - error_domain.to_glib(), + error_domain.into_glib(), error_code, message.to_glib_full(), debug.to_glib_full(), @@ -567,7 +567,7 @@ impl> ElementExtManual for O { from_glib(ffi::gst_element_add_property_deep_notify_watch( self.as_ref().to_glib_none().0, property_name.0, - include_value.to_glib(), + include_value.into_glib(), )) } } @@ -584,7 +584,7 @@ impl> ElementExtManual for O { from_glib(ffi::gst_element_add_property_notify_watch( self.as_ref().to_glib_none().0, property_name.0, - include_value.to_glib(), + include_value.into_glib(), )) } } @@ -595,7 +595,7 @@ impl> ElementExtManual for O { unsafe { ffi::gst_element_remove_property_notify_watch( self.as_ref().to_glib_none().0, - watch_id.to_glib(), + watch_id.into_glib(), ); } } @@ -609,9 +609,9 @@ 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.format().to_glib(), + src_val.format().into_glib(), src_val.to_raw_value(), - U::default_format().to_glib(), + U::default_format().into_glib(), dest_val.as_mut_ptr(), )); if ret { @@ -632,9 +632,9 @@ 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.format().to_glib(), + src_val.format().into_glib(), src_val.value(), - dest_format.to_glib(), + dest_format.into_glib(), dest_val.as_mut_ptr(), )); if ret { @@ -653,7 +653,7 @@ impl> ElementExtManual for O { let mut duration = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_element_query_duration( self.as_ref().to_glib_none().0, - T::default_format().to_glib(), + T::default_format().into_glib(), duration.as_mut_ptr(), )); if ret { @@ -669,7 +669,7 @@ impl> ElementExtManual for O { let mut duration = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_element_query_duration( self.as_ref().to_glib_none().0, - format.to_glib(), + format.into_glib(), duration.as_mut_ptr(), )); if ret { @@ -685,7 +685,7 @@ impl> ElementExtManual for O { let mut cur = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_element_query_position( self.as_ref().to_glib_none().0, - T::default_format().to_glib(), + T::default_format().into_glib(), cur.as_mut_ptr(), )); if ret { @@ -701,7 +701,7 @@ impl> ElementExtManual for O { let mut cur = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_element_query_position( self.as_ref().to_glib_none().0, - format.to_glib(), + format.into_glib(), cur.as_mut_ptr(), )); if ret { @@ -731,11 +731,11 @@ impl> ElementExtManual for O { ffi::gst_element_seek( self.as_ref().to_glib_none().0, rate, - start.format().to_glib(), - flags.to_glib(), - start_type.to_glib(), + start.format().into_glib(), + flags.into_glib(), + start_type.into_glib(), start.value(), - stop_type.to_glib(), + stop_type.into_glib(), stop.value(), ), "Failed to seek", @@ -753,8 +753,8 @@ impl> ElementExtManual for O { glib::result_from_gboolean!( ffi::gst_element_seek_simple( self.as_ref().to_glib_none().0, - seek_pos.format().to_glib(), - seek_flags.to_glib(), + seek_pos.format().into_glib(), + seek_flags.into_glib(), seek_pos.value(), ), "Failed to seek", diff --git a/gstreamer/src/element_factory_list_type.rs b/gstreamer/src/element_factory_list_type.rs index d27bc972f..a36427ba6 100644 --- a/gstreamer/src/element_factory_list_type.rs +++ b/gstreamer/src/element_factory_list_type.rs @@ -36,10 +36,10 @@ bitflags! { } #[doc(hidden)] -impl ToGlib for ElementFactoryListType { +impl IntoGlib for ElementFactoryListType { type GlibType = ffi::GstElementFactoryListType; - fn to_glib(&self) -> ffi::GstElementFactoryListType { + fn into_glib(self) -> ffi::GstElementFactoryListType { self.bits() } } diff --git a/gstreamer/src/enums.rs b/gstreamer/src/enums.rs index fc6e5811a..c229a47bb 100644 --- a/gstreamer/src/enums.rs +++ b/gstreamer/src/enums.rs @@ -347,7 +347,7 @@ impl From> for ClockReturn { impl PartialEq for crate::TypeFindProbability { fn eq(&self, other: &crate::TypeFindProbability) -> bool { - (self.to_glib() as u32).eq(&(other.to_glib() as u32)) + (self.into_glib() as u32).eq(&(other.into_glib() as u32)) } } @@ -355,13 +355,13 @@ impl Eq for crate::TypeFindProbability {} impl PartialOrd for crate::TypeFindProbability { fn partial_cmp(&self, other: &Self) -> Option { - (self.to_glib() as u32).partial_cmp(&(other.to_glib() as u32)) + (self.into_glib() as u32).partial_cmp(&(other.into_glib() as u32)) } } impl Ord for crate::TypeFindProbability { fn cmp(&self, other: &Self) -> cmp::Ordering { - (self.to_glib() as u32).cmp(&(other.to_glib() as u32)) + (self.into_glib() as u32).cmp(&(other.into_glib() as u32)) } } @@ -369,14 +369,14 @@ impl ops::Add for crate::TypeFindProbability { type Output = crate::TypeFindProbability; fn add(self, rhs: u32) -> crate::TypeFindProbability { - let res = (self.to_glib() as u32).saturating_add(rhs); + let res = (self.into_glib() as u32).saturating_add(rhs); unsafe { from_glib(res as i32) } } } impl ops::AddAssign for crate::TypeFindProbability { fn add_assign(&mut self, rhs: u32) { - let res = (self.to_glib() as u32).saturating_add(rhs); + let res = (self.into_glib() as u32).saturating_add(rhs); *self = unsafe { from_glib(res as i32) }; } } @@ -385,21 +385,21 @@ impl ops::Sub for crate::TypeFindProbability { type Output = crate::TypeFindProbability; fn sub(self, rhs: u32) -> crate::TypeFindProbability { - let res = (self.to_glib() as u32).saturating_sub(rhs); + let res = (self.into_glib() as u32).saturating_sub(rhs); unsafe { from_glib(res as i32) } } } impl ops::SubAssign for crate::TypeFindProbability { fn sub_assign(&mut self, rhs: u32) { - let res = (self.to_glib() as u32).saturating_sub(rhs); + let res = (self.into_glib() as u32).saturating_sub(rhs); *self = unsafe { from_glib(res as i32) }; } } impl PartialEq for crate::Rank { fn eq(&self, other: &crate::Rank) -> bool { - (self.to_glib() as u32).eq(&(other.to_glib() as u32)) + (self.into_glib() as u32).eq(&(other.into_glib() as u32)) } } @@ -407,13 +407,13 @@ impl Eq for crate::Rank {} impl PartialOrd for crate::Rank { fn partial_cmp(&self, other: &Self) -> Option { - (self.to_glib() as u32).partial_cmp(&(other.to_glib() as u32)) + (self.into_glib() as u32).partial_cmp(&(other.into_glib() as u32)) } } impl Ord for crate::Rank { fn cmp(&self, other: &Self) -> cmp::Ordering { - (self.to_glib() as u32).cmp(&(other.to_glib() as u32)) + (self.into_glib() as u32).cmp(&(other.into_glib() as u32)) } } @@ -421,14 +421,14 @@ impl ops::Add for crate::Rank { type Output = crate::Rank; fn add(self, rhs: u32) -> crate::Rank { - let res = (self.to_glib() as u32).saturating_add(rhs); + let res = (self.into_glib() as u32).saturating_add(rhs); unsafe { from_glib(res as i32) } } } impl ops::AddAssign for crate::Rank { fn add_assign(&mut self, rhs: u32) { - let res = (self.to_glib() as u32).saturating_add(rhs); + let res = (self.into_glib() as u32).saturating_add(rhs); *self = unsafe { from_glib(res as i32) }; } } @@ -437,14 +437,14 @@ impl ops::Sub for crate::Rank { type Output = crate::Rank; fn sub(self, rhs: u32) -> crate::Rank { - let res = (self.to_glib() as u32).saturating_sub(rhs); + let res = (self.into_glib() as u32).saturating_sub(rhs); unsafe { from_glib(res as i32) } } } impl ops::SubAssign for crate::Rank { fn sub_assign(&mut self, rhs: u32) { - let res = (self.to_glib() as u32).saturating_sub(rhs); + let res = (self.into_glib() as u32).saturating_sub(rhs); *self = unsafe { from_glib(res as i32) }; } } @@ -504,11 +504,11 @@ pub enum MessageType { } #[doc(hidden)] -impl ToGlib for MessageType { +impl IntoGlib for MessageType { type GlibType = ffi::GstMessageType; - fn to_glib(&self) -> ffi::GstMessageType { - match *self { + fn into_glib(self) -> ffi::GstMessageType { + match self { MessageType::Unknown => ffi::GST_MESSAGE_UNKNOWN, MessageType::Eos => ffi::GST_MESSAGE_EOS, MessageType::Error => ffi::GST_MESSAGE_ERROR, @@ -626,7 +626,7 @@ impl ToValue for MessageType { fn to_value(&self) -> Value { let mut value = glib::Value::for_value_type::(); unsafe { - glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.to_glib() as i32) + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib() as i32) } value } @@ -638,8 +638,8 @@ impl ToValue for MessageType { impl State { pub fn next(self, pending: Self) -> Self { - let current = self.to_glib(); - let pending = pending.to_glib(); + let current = self.into_glib(); + let pending = pending.into_glib(); let sign = (pending - current).signum(); @@ -650,8 +650,8 @@ impl State { impl StateChange { pub fn new(current: State, next: State) -> Self { skip_assert_initialized!(); - let current = current.to_glib(); - let next = next.to_glib(); + let current = current.into_glib(); + let next = next.into_glib(); unsafe { from_glib((current << 3) | next) } } @@ -694,7 +694,7 @@ impl StateChange { use std::ffi::CStr; unsafe { CStr::from_ptr( - ffi::gst_state_change_get_name(self.to_glib()) + ffi::gst_state_change_get_name(self.into_glib()) .as_ref() .expect("gst_state_change_get_name returned NULL"), ) diff --git a/gstreamer/src/event.rs b/gstreamer/src/event.rs index 9d7a99add..a249ea07d 100644 --- a/gstreamer/src/event.rs +++ b/gstreamer/src/event.rs @@ -11,7 +11,7 @@ use std::num::NonZeroU32; use std::ops::Deref; use std::ptr; -use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr}; +use glib::translate::{from_glib, from_glib_full, from_glib_none, IntoGlib, ToGlibPtr}; use glib::value::ToSendValue; #[cfg(any(feature = "v1_10", feature = "dox"))] @@ -36,10 +36,10 @@ impl Seqnum { } } -impl ToGlib for Seqnum { +impl IntoGlib for Seqnum { type GlibType = u32; - fn to_glib(&self) -> u32 { + fn into_glib(self) -> u32 { self.0.get() } } @@ -77,23 +77,23 @@ impl GroupId { impl EventType { pub fn is_upstream(self) -> bool { - (self.to_glib() as u32) & ffi::GST_EVENT_TYPE_UPSTREAM != 0 + (self.into_glib() as u32) & ffi::GST_EVENT_TYPE_UPSTREAM != 0 } pub fn is_downstream(self) -> bool { - (self.to_glib() as u32) & ffi::GST_EVENT_TYPE_DOWNSTREAM != 0 + (self.into_glib() as u32) & ffi::GST_EVENT_TYPE_DOWNSTREAM != 0 } pub fn is_serialized(self) -> bool { - (self.to_glib() as u32) & ffi::GST_EVENT_TYPE_SERIALIZED != 0 + (self.into_glib() as u32) & ffi::GST_EVENT_TYPE_SERIALIZED != 0 } pub fn is_sticky(self) -> bool { - (self.to_glib() as u32) & ffi::GST_EVENT_TYPE_STICKY != 0 + (self.into_glib() as u32) & ffi::GST_EVENT_TYPE_STICKY != 0 } pub fn is_sticky_multi(self) -> bool { - (self.to_glib() as u32) & ffi::GST_EVENT_TYPE_STICKY_MULTI != 0 + (self.into_glib() as u32) & ffi::GST_EVENT_TYPE_STICKY_MULTI != 0 } } @@ -103,8 +103,8 @@ impl PartialOrd for EventType { return None; } - let v1 = self.to_glib() as u32; - let v2 = other.to_glib() as u32; + let v1 = self.into_glib() as u32; + let v2 = other.into_glib() as u32; let stream_start = ffi::GST_EVENT_STREAM_START as u32; let segment = ffi::GST_EVENT_SEGMENT as u32; @@ -1267,7 +1267,7 @@ impl<'a> FlushStopBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_flush_stop(s.reset_time.to_glib())); + event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_flush_stop(s.reset_time.into_glib())); } pub struct StreamStartBuilder<'a> { @@ -1320,7 +1320,7 @@ impl<'a> StreamStartBuilder<'a> { event_builder_generic_impl!(|s: &Self| { let ev = ffi::gst_event_new_stream_start(s.stream_id.to_glib_none().0); if let Some(flags) = s.flags { - ffi::gst_event_set_stream_flags(ev, flags.to_glib()); + ffi::gst_event_set_stream_flags(ev, flags.into_glib()); } if let Some(group_id) = s.group_id { ffi::gst_event_set_group_id(ev, group_id.0.get()); @@ -1431,10 +1431,10 @@ impl<'a> BufferSizeBuilder<'a> { } event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_buffer_size( - s.minsize.format().to_glib(), + s.minsize.format().into_glib(), s.minsize.value(), s.maxsize.value(), - s.r#async.to_glib(), + s.r#async.into_glib(), )); } @@ -1516,7 +1516,7 @@ impl<'a> TocBuilder<'a> { event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_toc( s.toc.to_glib_none().0, - s.updated.to_glib() + s.updated.into_glib() )); } @@ -1567,7 +1567,7 @@ impl<'a> SegmentDoneBuilder<'a> { } event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_segment_done( - s.position.format().to_glib(), + s.position.format().into_glib(), s.position.value() )); } @@ -1589,8 +1589,8 @@ impl<'a> GapBuilder<'a> { } event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_gap( - s.timestamp.to_glib(), - s.duration.to_glib() + s.timestamp.into_glib(), + s.duration.into_glib() )); } @@ -1615,10 +1615,10 @@ impl<'a> QosBuilder<'a> { } event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_qos( - s.type_.to_glib(), + s.type_.into_glib(), s.proportion, s.diff, - s.timestamp.to_glib(), + s.timestamp.into_glib(), )); } @@ -1661,17 +1661,17 @@ impl<'a> SeekBuilder<'a> { { let ev = ffi::gst_event_new_seek( s.rate, - s.start.format().to_glib(), - s.flags.to_glib(), - s.start_type.to_glib(), + s.start.format().into_glib(), + s.flags.into_glib(), + s.start_type.into_glib(), s.start.value(), - s.stop_type.to_glib(), + s.stop_type.into_glib(), s.stop.value(), ); #[cfg(any(feature = "v1_16", feature = "dox"))] if let Some(trickmode_interval) = s.trickmode_interval { - ffi::gst_event_set_seek_trickmode_interval(ev, trickmode_interval.to_glib()); + ffi::gst_event_set_seek_trickmode_interval(ev, trickmode_interval.into_glib()); } ev @@ -1713,7 +1713,7 @@ impl<'a> LatencyBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_latency(s.latency.to_glib())); + event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_latency(s.latency.into_glib())); } pub struct StepBuilder<'a> { @@ -1737,11 +1737,11 @@ impl<'a> StepBuilder<'a> { } event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_step( - s.amount.format().to_glib(), + s.amount.format().into_glib(), s.amount.value() as u64, s.rate, - s.flush.to_glib(), - s.intermediate.to_glib(), + s.flush.into_glib(), + s.intermediate.into_glib(), )); } diff --git a/gstreamer/src/functions.rs b/gstreamer/src/functions.rs index 386a550e1..e413228ea 100644 --- a/gstreamer/src/functions.rs +++ b/gstreamer/src/functions.rs @@ -38,9 +38,9 @@ pub fn parse_bin_from_description_full( let mut error = ptr::null_mut(); let ret = ffi::gst_parse_bin_from_description_full( bin_description.to_glib_none().0, - ghost_unlinked_pads.to_glib(), + ghost_unlinked_pads.into_glib(), context.to_glib_none_mut().0, - flags.to_glib(), + flags.into_glib(), &mut error, ); if error.is_null() { @@ -81,7 +81,7 @@ pub fn parse_launch_full( let ret = ffi::gst_parse_launch_full( pipeline_description.to_glib_none().0, context.to_glib_none_mut().0, - flags.to_glib(), + flags.into_glib(), &mut error, ); if error.is_null() { @@ -103,7 +103,7 @@ pub fn parse_launchv_full( let ret = ffi::gst_parse_launchv_full( argv.to_glib_none().0, context.to_glib_none_mut().0, - flags.to_glib(), + flags.into_glib(), &mut error, ); if error.is_null() { @@ -173,7 +173,7 @@ pub fn type_is_plugin_api(type_: glib::types::Type) -> Option>() as u32, - T::static_type().to_glib(), + T::static_type().into_glib(), ptr::null_mut(), &DUMMY_COOKIE as *const _ as *mut _, Some(rs_iterator_copy::), @@ -572,7 +572,7 @@ impl glib::translate::FromGlibPtrNone<*const ffi::GstIterator> fo #[inline] unsafe fn from_glib_none(ptr: *const ffi::GstIterator) -> Self { assert_ne!( - glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().to_glib()), + glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().into_glib()), glib::ffi::GFALSE ); from_glib_full(ffi::gst_iterator_copy(ptr)) @@ -584,7 +584,7 @@ impl glib::translate::FromGlibPtrNone<*mut ffi::GstIterator> for #[inline] unsafe fn from_glib_none(ptr: *mut ffi::GstIterator) -> Self { assert_ne!( - glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().to_glib()), + glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().into_glib()), glib::ffi::GFALSE ); from_glib_full(ffi::gst_iterator_copy(ptr)) @@ -597,7 +597,7 @@ impl glib::translate::FromGlibPtrBorrow<*mut ffi::GstIterator> fo unsafe fn from_glib_borrow(ptr: *mut ffi::GstIterator) -> Borrowed { assert!(!ptr.is_null()); assert_ne!( - glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().to_glib()), + glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().into_glib()), glib::ffi::GFALSE ); Borrowed::new(Self { @@ -613,7 +613,7 @@ impl glib::translate::FromGlibPtrFull<*mut ffi::GstIterator> for unsafe fn from_glib_full(ptr: *mut ffi::GstIterator) -> Self { assert!(!ptr.is_null()); assert_ne!( - glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().to_glib()), + glib::gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().into_glib()), glib::ffi::GFALSE ); Self { diff --git a/gstreamer/src/log.rs b/gstreamer/src/log.rs index 9d511d4aa..7d32fdba7 100644 --- a/gstreamer/src/log.rs +++ b/gstreamer/src/log.rs @@ -59,7 +59,7 @@ impl DebugCategory { unsafe { let ptr = _gst_debug_category_new( name.to_glib_none().0, - color.to_glib(), + color.into_glib(), description.to_glib_none().0, ); // Can be NULL if the debug system is compiled out @@ -93,7 +93,7 @@ impl DebugCategory { pub fn set_threshold(self, threshold: crate::DebugLevel) { if let Some(cat) = self.0 { - unsafe { ffi::gst_debug_category_set_threshold(cat.as_ptr(), threshold.to_glib()) } + unsafe { ffi::gst_debug_category_set_threshold(cat.as_ptr(), threshold.into_glib()) } } } @@ -152,7 +152,7 @@ impl DebugCategory { }; unsafe { - if level.to_glib() as i32 > cat.as_ref().threshold { + if level.into_glib() as i32 > cat.as_ref().threshold { return; } } @@ -165,7 +165,7 @@ impl DebugCategory { unsafe { ffi::gst_debug_log( cat.as_ptr(), - level.to_glib(), + level.into_glib(), file.to_glib_none().0, module.to_glib_none().0, line as i32, diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index e400b527d..b82138158 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -17,7 +17,9 @@ use std::ops::Deref; use std::ptr; use glib::prelude::*; -use glib::translate::{from_glib, from_glib_full, from_glib_none, mut_override, ToGlib, ToGlibPtr}; +use glib::translate::{ + from_glib, from_glib_full, from_glib_none, mut_override, IntoGlib, ToGlibPtr, +}; mini_object_wrapper!(Message, MessageRef, ffi::GstMessage, || { ffi::gst_message_get_type() @@ -1929,7 +1931,7 @@ impl<'a> BufferingBuilder<'a> { if let Some((mode, avg_in, avg_out, buffering_left)) = s.stats { ffi::gst_message_set_buffering_stats( msg, - mode.to_glib(), + mode.into_glib(), avg_in, avg_out, buffering_left, @@ -1960,9 +1962,9 @@ impl<'a> StateChangedBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_state_changed( src, - s.old.to_glib(), - s.new.to_glib(), - s.pending.to_glib(), + s.old.into_glib(), + s.new.into_glib(), + s.pending.into_glib(), )); } @@ -2015,13 +2017,13 @@ impl<'a> StepDoneBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_step_done( src, - s.amount.format().to_glib(), + s.amount.format().into_glib(), s.amount.value() as u64, s.rate, - s.flush.to_glib(), - s.intermediate.to_glib(), + s.flush.into_glib(), + s.intermediate.into_glib(), s.duration.value() as u64, - s.eos.to_glib(), + s.eos.into_glib(), )); } @@ -2044,7 +2046,7 @@ impl<'a> ClockProvideBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_clock_provide( src, s.clock.to_glib_none().0, - s.ready.to_glib() + s.ready.into_glib() )); } @@ -2108,9 +2110,9 @@ impl<'a> StructureChangeBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_structure_change( src, - s.type_.to_glib(), + s.type_.into_glib(), s.owner.to_glib_none().0, - s.busy.to_glib(), + s.busy.into_glib(), )); } @@ -2141,7 +2143,7 @@ impl<'a> StreamStatusBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| { let msg = - ffi::gst_message_new_stream_status(src, s.type_.to_glib(), s.owner.to_glib_none().0); + ffi::gst_message_new_stream_status(src, s.type_.into_glib(), s.owner.to_glib_none().0); if let Some(status_object) = s.status_object { ffi::gst_message_set_stream_status_object( msg, @@ -2208,7 +2210,7 @@ impl<'a> SegmentStartBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_segment_start( src, - s.position.format().to_glib(), + s.position.format().into_glib(), s.position.value(), )); } @@ -2229,7 +2231,7 @@ impl<'a> SegmentDoneBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_segment_done( src, - s.position.format().to_glib(), + s.position.format().into_glib(), s.position.value(), )); } @@ -2295,7 +2297,7 @@ impl<'a> AsyncDoneBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_async_done( src, - s.running_time.to_glib() + s.running_time.into_glib() )); } @@ -2315,7 +2317,7 @@ impl<'a> RequestStateBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_request_state( src, - s.state.to_glib() + s.state.into_glib() )); } @@ -2349,12 +2351,12 @@ 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.format().to_glib(), + s.active.into_glib(), + s.amount.format().into_glib(), s.amount.value() as u64, s.rate, - s.flush.to_glib(), - s.intermediate.to_glib(), + s.flush.into_glib(), + s.intermediate.into_glib(), )); } @@ -2410,11 +2412,11 @@ impl<'a> QosBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| { let msg = ffi::gst_message_new_qos( src, - s.live.to_glib(), - s.running_time.to_glib(), - s.stream_time.to_glib(), - s.timestamp.to_glib(), - s.duration.to_glib(), + s.live.into_glib(), + s.running_time.into_glib(), + s.stream_time.into_glib(), + s.timestamp.into_glib(), + s.duration.into_glib(), ); if let Some((jitter, proportion, quality)) = s.values { ffi::gst_message_set_qos_values(msg, jitter, proportion, quality); @@ -2422,7 +2424,7 @@ impl<'a> QosBuilder<'a> { if let Some((processed, dropped)) = s.stats { ffi::gst_message_set_qos_stats( msg, - processed.format().to_glib(), + processed.format().into_glib(), processed.value() as u64, dropped.value() as u64, ); @@ -2451,7 +2453,7 @@ impl<'a> ProgressBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_progress( src, - s.type_.to_glib(), + s.type_.into_glib(), s.code.to_glib_none().0, s.text.to_glib_none().0, )); @@ -2476,7 +2478,7 @@ impl<'a> TocBuilder<'a> { message_builder_generic_impl!(|s: &Self, src| ffi::gst_message_new_toc( src, s.toc.to_glib_none().0, - s.updated.to_glib() + s.updated.into_glib() )); } @@ -2496,7 +2498,7 @@ impl<'a> ResetTimeBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_reset_time( src, - s.running_time.to_glib() + s.running_time.into_glib() )); } diff --git a/gstreamer/src/meta.rs b/gstreamer/src/meta.rs index abc2e111c..5558ea63d 100644 --- a/gstreamer/src/meta.rs +++ b/gstreamer/src/meta.rs @@ -18,7 +18,7 @@ use crate::ClockTime; #[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] -use glib::translate::ToGlib; +use glib::translate::IntoGlib; use glib::translate::{from_glib, from_glib_none, FromGlib, ToGlibPtr}; pub unsafe trait MetaAPI: Sync + Send + Sized { @@ -362,8 +362,8 @@ impl ReferenceTimestampMeta { let meta = ffi::gst_buffer_add_reference_timestamp_meta( buffer.as_mut_ptr(), reference.to_glib_none().0, - timestamp.to_glib(), - duration.to_glib(), + timestamp.into_glib(), + duration.into_glib(), ); Self::from_mut_ptr(buffer, meta) diff --git a/gstreamer/src/object.rs b/gstreamer/src/object.rs index 6ee84bd4f..8310f1c95 100644 --- a/gstreamer/src/object.rs +++ b/gstreamer/src/object.rs @@ -78,7 +78,7 @@ impl> GstObjectExtManual for O { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); - (*ptr).flags |= flags.to_glib(); + (*ptr).flags |= flags.into_glib(); } } @@ -86,7 +86,7 @@ impl> GstObjectExtManual for O { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); - (*ptr).flags &= !flags.to_glib(); + (*ptr).flags &= !flags.into_glib(); } } @@ -111,8 +111,8 @@ impl> GstObjectExtManual for O { ffi::gst_object_get_g_value_array( self.as_ref().to_glib_none().0, property_name.to_glib_none().0, - timestamp.to_glib(), - interval.to_glib(), + timestamp.into_glib(), + interval.into_glib(), n_values, values.as_mut_ptr() as *mut glib::gobject_ffi::GValue, ), diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index 19e432ad6..c7e8914f0 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -31,16 +31,16 @@ use std::ptr; use glib::ffi::gpointer; use glib::prelude::*; use glib::translate::{ - from_glib, from_glib_borrow, from_glib_full, FromGlib, FromGlibPtrBorrow, ToGlib, ToGlibPtr, + from_glib, from_glib_borrow, from_glib_full, FromGlib, FromGlibPtrBorrow, IntoGlib, ToGlibPtr, }; #[derive(Debug, PartialEq, Eq)] pub struct PadProbeId(NonZeroU64); -impl ToGlib for PadProbeId { +impl IntoGlib for PadProbeId { type GlibType = libc::c_ulong; - fn to_glib(&self) -> libc::c_ulong { + fn into_glib(self) -> libc::c_ulong { self.0.get() as libc::c_ulong } } @@ -283,7 +283,7 @@ impl> PadExtManual for O { let func_box: Box = Box::new(func); let id = ffi::gst_pad_add_probe( self.as_ref().to_glib_none().0, - mask.to_glib(), + mask.into_glib(), Some(trampoline_pad_probe::), Box::into_raw(func_box) as gpointer, Some(destroy_closure::), @@ -299,7 +299,7 @@ impl> PadExtManual for O { fn remove_probe(&self, id: PadProbeId) { unsafe { - ffi::gst_pad_remove_probe(self.as_ref().to_glib_none().0, id.to_glib()); + ffi::gst_pad_remove_probe(self.as_ref().to_glib_none().0, id.into_glib()); } } @@ -557,7 +557,7 @@ impl> PadExtManual for O { from_glib(ffi::gst_pad_link_full( self.as_ref().to_glib_none().0, sinkpad.as_ref().to_glib_none().0, - flags.to_glib(), + flags.into_glib(), )) }; ret.into_result() @@ -765,9 +765,9 @@ 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.format().to_glib(), + src_val.format().into_glib(), src_val.to_raw_value(), - U::default_format().to_glib(), + U::default_format().into_glib(), dest_val.as_mut_ptr(), )); if ret { @@ -788,9 +788,9 @@ 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.format().to_glib(), + src_val.format().into_glib(), src_val.to_raw_value(), - dest_format.to_glib(), + dest_format.into_glib(), dest_val.as_mut_ptr(), )); if ret { @@ -809,7 +809,7 @@ impl> PadExtManual for O { let mut duration = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_pad_peer_query_duration( self.as_ref().to_glib_none().0, - T::default_format().to_glib(), + T::default_format().into_glib(), duration.as_mut_ptr(), )); if ret { @@ -825,7 +825,7 @@ impl> PadExtManual for O { let mut duration = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_pad_peer_query_duration( self.as_ref().to_glib_none().0, - format.to_glib(), + format.into_glib(), duration.as_mut_ptr(), )); if ret { @@ -841,7 +841,7 @@ impl> PadExtManual for O { let mut cur = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_pad_peer_query_position( self.as_ref().to_glib_none().0, - T::default_format().to_glib(), + T::default_format().into_glib(), cur.as_mut_ptr(), )); if ret { @@ -857,7 +857,7 @@ impl> PadExtManual for O { let mut cur = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_pad_peer_query_position( self.as_ref().to_glib_none().0, - format.to_glib(), + format.into_glib(), cur.as_mut_ptr(), )); if ret { @@ -878,9 +878,9 @@ 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.format().to_glib(), + src_val.format().into_glib(), src_val.to_raw_value(), - U::default_format().to_glib(), + U::default_format().into_glib(), dest_val.as_mut_ptr(), )); if ret { @@ -902,9 +902,9 @@ 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.format().to_glib(), + src_val.format().into_glib(), src_val.value(), - dest_format.to_glib(), + dest_format.into_glib(), dest_val.as_mut_ptr(), )); if ret { @@ -923,7 +923,7 @@ impl> PadExtManual for O { let mut duration = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_pad_query_duration( self.as_ref().to_glib_none().0, - T::default_format().to_glib(), + T::default_format().into_glib(), duration.as_mut_ptr(), )); if ret { @@ -939,7 +939,7 @@ impl> PadExtManual for O { let mut duration = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_pad_query_duration( self.as_ref().to_glib_none().0, - format.to_glib(), + format.into_glib(), duration.as_mut_ptr(), )); if ret { @@ -955,7 +955,7 @@ impl> PadExtManual for O { let mut cur = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_pad_query_position( self.as_ref().to_glib_none().0, - T::default_format().to_glib(), + T::default_format().into_glib(), cur.as_mut_ptr(), )); if ret { @@ -971,7 +971,7 @@ impl> PadExtManual for O { let mut cur = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_pad_query_position( self.as_ref().to_glib_none().0, - format.to_glib(), + format.into_glib(), cur.as_mut_ptr(), )); if ret { @@ -1052,7 +1052,7 @@ impl> PadExtManual for O { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); - (*ptr).flags |= flags.to_glib(); + (*ptr).flags |= flags.into_glib(); } } @@ -1060,7 +1060,7 @@ impl> PadExtManual for O { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); - (*ptr).flags &= !flags.to_glib(); + (*ptr).flags &= !flags.into_glib(); } } @@ -1088,22 +1088,22 @@ unsafe fn create_probe_info<'a>( } else { let data = (*info).data as *mut ffi::GstMiniObject; (*info).data = ptr::null_mut(); - if (*data).type_ == Buffer::static_type().to_glib() { + if (*data).type_ == Buffer::static_type().into_glib() { data_type = Some(Buffer::static_type()); Some(PadProbeData::Buffer(from_glib_full( data as *const ffi::GstBuffer, ))) - } else if (*data).type_ == BufferList::static_type().to_glib() { + } else if (*data).type_ == BufferList::static_type().into_glib() { data_type = Some(BufferList::static_type()); Some(PadProbeData::BufferList(from_glib_full( data as *const ffi::GstBufferList, ))) - } else if (*data).type_ == Query::static_type().to_glib() { + } else if (*data).type_ == Query::static_type().into_glib() { data_type = Some(Query::static_type()); Some(PadProbeData::Query(QueryRef::from_mut_ptr( data as *mut ffi::GstQuery, ))) - } else if (*data).type_ == Event::static_type().to_glib() { + } else if (*data).type_ == Event::static_type().into_glib() { data_type = Some(Event::static_type()); Some(PadProbeData::Event(from_glib_full( data as *const ffi::GstEvent, @@ -1180,7 +1180,7 @@ unsafe fn update_probe_info( } let flow_ret: FlowReturn = probe_info.flow_res.into(); - (*info).ABI.abi.flow_ret = flow_ret.to_glib(); + (*info).ABI.abi.flow_ret = flow_ret.into_glib(); } unsafe extern "C" fn trampoline_pad_probe< @@ -1205,7 +1205,7 @@ where update_probe_info(ret, probe_info, data_type, info); - ret.to_glib() + ret.into_glib() } unsafe extern "C" fn trampoline_activate_function< @@ -1232,7 +1232,7 @@ where false } } - .to_glib() + .into_glib() } unsafe extern "C" fn trampoline_activatemode_function< @@ -1266,7 +1266,7 @@ where false } } - .to_glib() + .into_glib() } unsafe extern "C" fn trampoline_chain_function< @@ -1293,7 +1293,7 @@ where from_glib_full(buffer), ) .into(); - res.to_glib() + res.into_glib() } unsafe extern "C" fn trampoline_chain_list_function< @@ -1320,7 +1320,7 @@ where from_glib_full(list), ) .into(); - res.to_glib() + res.into_glib() } unsafe extern "C" fn trampoline_event_function< @@ -1343,7 +1343,7 @@ where .as_ref(), from_glib_full(event), ) - .to_glib() + .into_glib() } unsafe extern "C" fn trampoline_event_full_function< @@ -1370,7 +1370,7 @@ where from_glib_full(event), ) .into(); - res.to_glib() + res.into_glib() } unsafe extern "C" fn trampoline_getrange_function< @@ -1444,7 +1444,7 @@ where } match new_buffer.copy_into(passed_buffer, crate::BUFFER_COPY_METADATA, 0, None) { - Ok(_) => FlowReturn::Ok.to_glib(), + Ok(_) => FlowReturn::Ok.into_glib(), Err(_) => { gst_error!( crate::CAT_RUST, @@ -1452,19 +1452,19 @@ where "Failed to copy buffer metadata" ); - FlowReturn::Error.to_glib() + FlowReturn::Error.into_glib() } } } else { *buffer = new_buffer.into_ptr(); - FlowReturn::Ok.to_glib() + FlowReturn::Ok.into_glib() } } Ok(PadGetRangeSuccess::FilledBuffer) => { assert!(passed_buffer.is_some()); - FlowReturn::Ok.to_glib() + FlowReturn::Ok.into_glib() } - Err(ret) => FlowReturn::from_error(ret).to_glib(), + Err(ret) => FlowReturn::from_error(ret).into_glib(), } } @@ -1519,7 +1519,7 @@ where &from_glib_borrow(peer), ) .into(); - res.to_glib() + res.into_glib() } unsafe extern "C" fn trampoline_query_function< @@ -1542,7 +1542,7 @@ where .as_ref(), crate::QueryRef::from_mut_ptr(query), ) - .to_glib() + .into_glib() } unsafe extern "C" fn trampoline_unlink_function< diff --git a/gstreamer/src/pad_template.rs b/gstreamer/src/pad_template.rs index 795ffcb5d..d6d5baaa4 100644 --- a/gstreamer/src/pad_template.rs +++ b/gstreamer/src/pad_template.rs @@ -20,7 +20,7 @@ impl PadTemplate { Option::<_>::from_glib_none( ffi::gst_pad_template_new_from_static_pad_template_with_gtype( mut_override(pad_template.to_glib_none().0), - pad_type.to_glib(), + pad_type.into_glib(), ), ) .ok_or_else(|| glib::bool_error!("Failed to create PadTemplate")) diff --git a/gstreamer/src/param_spec.rs b/gstreamer/src/param_spec.rs index 996a41f4b..c61467b8e 100644 --- a/gstreamer/src/param_spec.rs +++ b/gstreamer/src/param_spec.rs @@ -41,7 +41,7 @@ impl GstParamSpecExt for glib::ParamSpec { nick.to_glib_none().0, blurb.to_glib_none().0, element_spec.to_glib_none().0, - flags.to_glib(), + flags.into_glib(), )) } } @@ -67,7 +67,7 @@ impl GstParamSpecExt for glib::ParamSpec { *max.denom(), *default.numer(), *default.denom(), - flags.to_glib(), + flags.into_glib(), )) } } diff --git a/gstreamer/src/pipeline.rs b/gstreamer/src/pipeline.rs index b6398a22e..fe15ae3ec 100644 --- a/gstreamer/src/pipeline.rs +++ b/gstreamer/src/pipeline.rs @@ -18,7 +18,7 @@ impl> GstPipelineExtManual for O { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); - (*ptr).flags |= flags.to_glib(); + (*ptr).flags |= flags.into_glib(); } } @@ -26,7 +26,7 @@ impl> GstPipelineExtManual for O { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); - (*ptr).flags &= !flags.to_glib(); + (*ptr).flags &= !flags.into_glib(); } } diff --git a/gstreamer/src/plugin_feature.rs b/gstreamer/src/plugin_feature.rs index f85a61f8b..4f2b93d22 100644 --- a/gstreamer/src/plugin_feature.rs +++ b/gstreamer/src/plugin_feature.rs @@ -4,7 +4,7 @@ use crate::PluginFeature; use crate::Rank; use glib::prelude::*; -use glib::translate::{from_glib, FromGlibPtrFull, ToGlib, ToGlibPtr}; +use glib::translate::{from_glib, FromGlibPtrFull, IntoGlib, ToGlibPtr}; pub trait PluginFeatureExtManual: Sized + 'static { fn rank(&self) -> Rank; @@ -22,7 +22,10 @@ impl> PluginFeatureExtManual for O { fn set_rank(&self, rank: Rank) { unsafe { - ffi::gst_plugin_feature_set_rank(self.as_ref().to_glib_none().0, rank.to_glib() as u32); + ffi::gst_plugin_feature_set_rank( + self.as_ref().to_glib_none().0, + rank.into_glib() as u32, + ); } } diff --git a/gstreamer/src/query.rs b/gstreamer/src/query.rs index 7eaacbc98..588f5b293 100644 --- a/gstreamer/src/query.rs +++ b/gstreamer/src/query.rs @@ -218,7 +218,7 @@ declare_concrete_query!(Position, T); impl Position { pub fn new(fmt: crate::Format) -> Self { assert_initialized_main_thread!(); - unsafe { Self(from_glib_full(ffi::gst_query_new_position(fmt.to_glib()))) } + unsafe { Self(from_glib_full(ffi::gst_query_new_position(fmt.into_glib()))) } } } @@ -250,7 +250,7 @@ impl Position { let pos = pos.into(); assert_eq!(pos.format(), self.format()); unsafe { - ffi::gst_query_set_position(self.0.as_mut_ptr(), pos.format().to_glib(), pos.value()); + ffi::gst_query_set_position(self.0.as_mut_ptr(), pos.format().into_glib(), pos.value()); } } } @@ -259,7 +259,7 @@ declare_concrete_query!(Duration, T); impl Duration { pub fn new(fmt: crate::Format) -> Self { assert_initialized_main_thread!(); - unsafe { Self(from_glib_full(ffi::gst_query_new_duration(fmt.to_glib()))) } + unsafe { Self(from_glib_full(ffi::gst_query_new_duration(fmt.into_glib()))) } } } @@ -291,7 +291,7 @@ impl Duration { let dur = dur.into(); assert_eq!(dur.format(), self.format()); unsafe { - ffi::gst_query_set_duration(self.0.as_mut_ptr(), dur.format().to_glib(), dur.value()); + ffi::gst_query_set_duration(self.0.as_mut_ptr(), dur.format().into_glib(), dur.value()); } } } @@ -338,9 +338,9 @@ impl Latency { unsafe { ffi::gst_query_set_latency( self.0.as_mut_ptr(), - live.to_glib(), - min.to_glib(), - max.to_glib(), + live.into_glib(), + min.into_glib(), + max.into_glib(), ); } } @@ -350,7 +350,7 @@ declare_concrete_query!(Seeking, T); impl Seeking { pub fn new(fmt: crate::Format) -> Self { assert_initialized_main_thread!(); - unsafe { Self(from_glib_full(ffi::gst_query_new_seeking(fmt.to_glib()))) } + unsafe { Self(from_glib_full(ffi::gst_query_new_seeking(fmt.into_glib()))) } } } @@ -404,8 +404,8 @@ impl Seeking { unsafe { ffi::gst_query_set_seeking( self.0.as_mut_ptr(), - start.format().to_glib(), - seekable.to_glib(), + start.format().into_glib(), + seekable.into_glib(), start.value(), end.value(), ); @@ -417,7 +417,7 @@ declare_concrete_query!(Segment, T); impl Segment { pub fn new(fmt: crate::Format) -> Self { assert_initialized_main_thread!(); - unsafe { Self(from_glib_full(ffi::gst_query_new_segment(fmt.to_glib()))) } + unsafe { Self(from_glib_full(ffi::gst_query_new_segment(fmt.into_glib()))) } } } @@ -471,7 +471,7 @@ impl Segment { ffi::gst_query_set_segment( self.0.as_mut_ptr(), rate, - start.format().to_glib(), + start.format().into_glib(), start.value(), stop.value(), ); @@ -486,9 +486,9 @@ impl Convert { let value = value.into(); unsafe { Self(from_glib_full(ffi::gst_query_new_convert( - value.format().to_glib(), + value.format().into_glib(), value.value(), - dest_fmt.to_glib(), + dest_fmt.into_glib(), ))) } } @@ -545,9 +545,9 @@ impl Convert { unsafe { ffi::gst_query_set_convert( self.0.as_mut_ptr(), - src.format().to_glib(), + src.format().into_glib(), src.value(), - dest.format().to_glib(), + dest.format().into_glib(), dest.value(), ); } @@ -590,7 +590,7 @@ impl Formats { impl Formats { pub fn set(&mut self, formats: &[crate::Format]) { unsafe { - let v: Vec<_> = formats.iter().map(|f| f.to_glib()).collect(); + let v: Vec<_> = formats.iter().map(|f| f.into_glib()).collect(); ffi::gst_query_set_formatsv(self.0.as_mut_ptr(), v.len() as i32, v.as_ptr() as *mut _); } } @@ -600,7 +600,11 @@ declare_concrete_query!(Buffering, T); impl Buffering { pub fn new(fmt: crate::Format) -> Self { assert_initialized_main_thread!(); - unsafe { Self(from_glib_full(ffi::gst_query_new_buffering(fmt.to_glib()))) } + unsafe { + Self(from_glib_full(ffi::gst_query_new_buffering( + fmt.into_glib(), + ))) + } } } @@ -721,7 +725,7 @@ impl Buffering { impl Buffering { pub fn set_percent(&mut self, busy: bool, percent: i32) { unsafe { - ffi::gst_query_set_buffering_percent(self.0.as_mut_ptr(), busy.to_glib(), percent); + ffi::gst_query_set_buffering_percent(self.0.as_mut_ptr(), busy.into_glib(), percent); } } @@ -740,7 +744,7 @@ impl Buffering { unsafe { ffi::gst_query_set_buffering_range( self.0.as_mut_ptr(), - start.format().to_glib(), + start.format().into_glib(), start.value(), stop.value(), estimated_total, @@ -759,7 +763,7 @@ impl Buffering { unsafe { ffi::gst_query_set_buffering_stats( self.0.as_mut_ptr(), - mode.to_glib(), + mode.into_glib(), avg_in, avg_out, buffering_left, @@ -849,7 +853,10 @@ impl Uri { let uri = uri.into(); unsafe { ffi::gst_query_set_uri_redirection(self.0.as_mut_ptr(), uri.to_glib_none().0); - ffi::gst_query_set_uri_redirection_permanent(self.0.as_mut_ptr(), permanent.to_glib()); + ffi::gst_query_set_uri_redirection_permanent( + self.0.as_mut_ptr(), + permanent.into_glib(), + ); } } } @@ -861,7 +868,7 @@ impl Allocation { unsafe { Self(from_glib_full(ffi::gst_query_new_allocation( caps.as_mut_ptr(), - need_pool.to_glib(), + need_pool.into_glib(), ))) } } @@ -946,7 +953,7 @@ impl Allocation { let mut idx = mem::MaybeUninit::uninit(); if ffi::gst_query_find_allocation_meta( self.0.as_ptr(), - U::meta_api().to_glib(), + U::meta_api().into_glib(), idx.as_mut_ptr(), ) != glib::ffi::GFALSE { @@ -1010,7 +1017,7 @@ impl Allocation { unsafe { ffi::gst_query_add_allocation_meta( self.0.as_mut_ptr(), - U::meta_api().to_glib(), + U::meta_api().into_glib(), if let Some(structure) = structure { structure.as_ptr() } else { @@ -1046,7 +1053,7 @@ impl Scheduling { unsafe { from_glib(ffi::gst_query_has_scheduling_mode( self.0.as_ptr(), - mode.to_glib(), + mode.into_glib(), )) } } @@ -1060,8 +1067,8 @@ impl Scheduling { unsafe { from_glib(ffi::gst_query_has_scheduling_mode_with_flags( self.0.as_ptr(), - mode.to_glib(), - flags.to_glib(), + mode.into_glib(), + flags.into_glib(), )) } } @@ -1110,7 +1117,7 @@ impl Scheduling { pub fn add_scheduling_modes(&mut self, modes: &[crate::PadMode]) { unsafe { for mode in modes { - ffi::gst_query_add_scheduling_mode(self.0.as_mut_ptr(), mode.to_glib()); + ffi::gst_query_add_scheduling_mode(self.0.as_mut_ptr(), mode.into_glib()); } } } @@ -1119,7 +1126,7 @@ impl Scheduling { unsafe { ffi::gst_query_set_scheduling( self.0.as_mut_ptr(), - flags.to_glib(), + flags.into_glib(), minsize, maxsize, align, @@ -1165,7 +1172,7 @@ impl AcceptCaps { impl AcceptCaps { pub fn set_result(&mut self, accepted: bool) { unsafe { - ffi::gst_query_set_accept_caps_result(self.0.as_mut_ptr(), accepted.to_glib()); + ffi::gst_query_set_accept_caps_result(self.0.as_mut_ptr(), accepted.into_glib()); } } } diff --git a/gstreamer/src/segment.rs b/gstreamer/src/segment.rs index 2c4761e68..97b9af7fe 100644 --- a/gstreamer/src/segment.rs +++ b/gstreamer/src/segment.rs @@ -19,12 +19,12 @@ pub struct FormattedSegment(ffi::GstSegment, PhantomData); impl Segment { pub fn reset_with_format(&mut self, format: Format) { unsafe { - ffi::gst_segment_init(self.to_glib_none_mut().0, format.to_glib()); + ffi::gst_segment_init(self.to_glib_none_mut().0, format.into_glib()); } } pub fn set_format(&mut self, format: Format) { - self.0.format = format.to_glib(); + self.0.format = format.into_glib(); } pub fn downcast(self) -> Result, Self> { @@ -63,7 +63,7 @@ impl FormattedSegment { assert_initialized_main_thread!(); let segment = unsafe { let mut segment = mem::MaybeUninit::zeroed(); - ffi::gst_segment_init(segment.as_mut_ptr(), T::default_format().to_glib()); + ffi::gst_segment_init(segment.as_mut_ptr(), T::default_format().into_glib()); segment.assume_init() }; FormattedSegment(segment, PhantomData) @@ -81,7 +81,7 @@ impl FormattedSegment { pub fn reset(&mut self) { unsafe { - ffi::gst_segment_init(&mut self.0, T::default_format().to_glib()); + ffi::gst_segment_init(&mut self.0, T::default_format().into_glib()); } } @@ -99,7 +99,7 @@ impl FormattedSegment { let mut clip_stop = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_segment_clip( &self.0, - start.format().to_glib(), + start.format().into_glib(), start.to_raw_value() as u64, stop.to_raw_value() as u64, clip_start.as_mut_ptr(), @@ -140,11 +140,11 @@ impl FormattedSegment { let ret = from_glib(ffi::gst_segment_do_seek( &mut self.0, rate, - self.format().to_glib(), - flags.to_glib(), - start_type.to_glib(), + self.format().into_glib(), + flags.into_glib(), + start_type.into_glib(), start.to_raw_value() as u64, - stop_type.to_glib(), + stop_type.into_glib(), stop.to_raw_value() as u64, update.as_mut_ptr(), )); @@ -159,7 +159,11 @@ 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.format().to_glib(), offset,), + ffi::gst_segment_offset_running_time( + &mut self.0, + self.format().into_glib(), + offset, + ), "Offset is not in the segment" ) } @@ -177,7 +181,7 @@ impl FormattedSegment { self.format(), ffi::gst_segment_position_from_running_time( &self.0, - self.format().to_glib(), + self.format().into_glib(), running_time.to_raw_value() as u64, ) as i64, ) @@ -195,7 +199,7 @@ impl FormattedSegment { let mut position = mem::MaybeUninit::uninit(); let ret = ffi::gst_segment_position_from_running_time_full( &self.0, - self.format().to_glib(), + self.format().into_glib(), running_time.to_raw_value() as u64, position.as_mut_ptr(), ); @@ -218,7 +222,7 @@ impl FormattedSegment { self.format(), ffi::gst_segment_position_from_stream_time( &self.0, - self.format().to_glib(), + self.format().into_glib(), stream_time.to_raw_value() as u64, ) as i64, ) @@ -236,7 +240,7 @@ impl FormattedSegment { let mut position = mem::MaybeUninit::uninit(); let ret = ffi::gst_segment_position_from_stream_time_full( &self.0, - self.format().to_glib(), + self.format().into_glib(), stream_time.to_raw_value() as u64, position.as_mut_ptr(), ); @@ -258,7 +262,7 @@ impl FormattedSegment { glib::result_from_gboolean!( ffi::gst_segment_set_running_time( &mut self.0, - self.format().to_glib(), + self.format().into_glib(), running_time.to_raw_value() as u64, ), "Running time is not in the segment" @@ -278,7 +282,7 @@ impl FormattedSegment { self.format(), ffi::gst_segment_to_running_time( &self.0, - self.format().to_glib(), + self.format().into_glib(), position.to_raw_value() as u64, ) as i64, ) @@ -296,7 +300,7 @@ impl FormattedSegment { let mut running_time = mem::MaybeUninit::uninit(); let ret = ffi::gst_segment_to_running_time_full( &self.0, - self.format().to_glib(), + self.format().into_glib(), position.to_raw_value() as u64, running_time.as_mut_ptr(), ); @@ -319,7 +323,7 @@ impl FormattedSegment { self.format(), ffi::gst_segment_to_stream_time( &self.0, - self.format().to_glib(), + self.format().into_glib(), position.to_raw_value() as u64, ) as i64, ) @@ -337,7 +341,7 @@ impl FormattedSegment { let mut stream_time = mem::MaybeUninit::uninit(); let ret = ffi::gst_segment_to_stream_time_full( &self.0, - self.format().to_glib(), + self.format().into_glib(), position.to_raw_value() as u64, stream_time.as_mut_ptr(), ); @@ -353,7 +357,7 @@ impl FormattedSegment { } pub fn set_flags(&mut self, flags: crate::SegmentFlags) { - self.0.flags = flags.to_glib(); + self.0.flags = flags.into_glib(); } pub fn rate(&self) -> f64 { diff --git a/gstreamer/src/stream.rs b/gstreamer/src/stream.rs index c3be94829..f99b8b66c 100644 --- a/gstreamer/src/stream.rs +++ b/gstreamer/src/stream.rs @@ -24,8 +24,8 @@ impl Stream { from_glib_full(ffi::gst_stream_new( stream_id.0, caps.0, - type_.to_glib(), - flags.to_glib(), + type_.into_glib(), + flags.into_glib(), )) } } else { @@ -34,8 +34,8 @@ impl Stream { from_glib_none(ffi::gst_stream_new( stream_id.0, caps.0, - type_.to_glib(), - flags.to_glib(), + type_.into_glib(), + flags.into_glib(), )) } } diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index 8d0c24782..d4e091c48 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -424,7 +424,7 @@ impl StructureRef { pub fn value_by_quark(&self, name: glib::Quark) -> Result<&SendValue, GetError> { unsafe { - let value = ffi::gst_structure_id_get_value(&self.0, name.to_glib()); + let value = ffi::gst_structure_id_get_value(&self.0, name.into_glib()); if value.is_null() { return Err(GetError::new_field_not_found(name.to_string())); @@ -454,7 +454,7 @@ impl StructureRef { pub fn set_value_by_quark(&mut self, name: glib::Quark, value: SendValue) { unsafe { let mut value = value.into_raw(); - ffi::gst_structure_id_take_value(&mut self.0, name.to_glib(), &mut value); + ffi::gst_structure_id_take_value(&mut self.0, name.into_glib(), &mut value); } } @@ -488,21 +488,21 @@ impl StructureRef { from_glib(ffi::gst_structure_has_field_typed( &self.0, field.to_glib_none().0, - type_.to_glib(), + type_.into_glib(), )) } } pub fn has_field_by_quark(&self, field: glib::Quark) -> bool { - unsafe { from_glib(ffi::gst_structure_id_has_field(&self.0, field.to_glib())) } + unsafe { from_glib(ffi::gst_structure_id_has_field(&self.0, field.into_glib())) } } pub fn has_field_with_type_by_quark(&self, field: glib::Quark, type_: glib::Type) -> bool { unsafe { from_glib(ffi::gst_structure_id_has_field_typed( &self.0, - field.to_glib(), - type_.to_glib(), + field.into_glib(), + type_.into_glib(), )) } } @@ -578,7 +578,7 @@ impl StructureRef { from_glib(ffi::gst_structure_fixate_field_boolean( &mut self.0, name.to_glib_none().0, - target.to_glib(), + target.into_glib(), )) } } diff --git a/gstreamer/src/subclass/bin.rs b/gstreamer/src/subclass/bin.rs index 89fcae19b..222fae696 100644 --- a/gstreamer/src/subclass/bin.rs +++ b/gstreamer/src/subclass/bin.rs @@ -129,7 +129,7 @@ unsafe extern "C" fn bin_add_element( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn bin_remove_element( @@ -158,7 +158,7 @@ unsafe extern "C" fn bin_remove_element( } } }) - .to_glib() + .into_glib() } unsafe extern "C" fn bin_handle_message( diff --git a/gstreamer/src/subclass/clock.rs b/gstreamer/src/subclass/clock.rs index 144ee44c2..0c110ca0d 100644 --- a/gstreamer/src/subclass/clock.rs +++ b/gstreamer/src/subclass/clock.rs @@ -93,8 +93,8 @@ impl ClockImplExt for T { if let Some(func) = (*parent_class).change_resolution { from_glib(func( clock.unsafe_cast_ref::().to_glib_none().0, - old_resolution.to_glib(), - new_resolution.to_glib(), + old_resolution.into_glib(), + new_resolution.into_glib(), )) } else { self.resolution(clock) @@ -261,7 +261,7 @@ unsafe extern "C" fn clock_change_resolution( from_glib(old_resolution), from_glib(new_resolution), ) - .to_glib() + .into_glib() } unsafe extern "C" fn clock_get_resolution( @@ -271,7 +271,7 @@ unsafe extern "C" fn clock_get_resolution( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - imp.resolution(wrap.unsafe_cast_ref()).to_glib() + imp.resolution(wrap.unsafe_cast_ref()).into_glib() } unsafe extern "C" fn clock_get_internal_time( @@ -281,7 +281,7 @@ unsafe extern "C" fn clock_get_internal_time( let imp = instance.impl_(); let wrap: Borrowed = from_glib_borrow(ptr); - imp.internal_time(wrap.unsafe_cast_ref()).to_glib() + imp.internal_time(wrap.unsafe_cast_ref()).into_glib() } unsafe extern "C" fn clock_wait( @@ -301,7 +301,7 @@ unsafe extern "C" fn clock_wait( *jitter = j; } - ClockReturn::from(res).to_glib() + ClockReturn::from(res).into_glib() } unsafe extern "C" fn clock_wait_async( @@ -316,7 +316,7 @@ unsafe extern "C" fn clock_wait_async( wrap.unsafe_cast_ref(), &from_glib_borrow(id as ffi::GstClockID), )) - .to_glib() + .into_glib() } unsafe extern "C" fn clock_unschedule( diff --git a/gstreamer/src/subclass/device.rs b/gstreamer/src/subclass/device.rs index e0fcc7bcf..c425da3ad 100644 --- a/gstreamer/src/subclass/device.rs +++ b/gstreamer/src/subclass/device.rs @@ -160,5 +160,5 @@ unsafe extern "C" fn device_reconfigure_element( false } } - .to_glib() + .into_glib() } diff --git a/gstreamer/src/subclass/device_provider.rs b/gstreamer/src/subclass/device_provider.rs index 82c825b7f..ce5a78152 100644 --- a/gstreamer/src/subclass/device_provider.rs +++ b/gstreamer/src/subclass/device_provider.rs @@ -149,7 +149,7 @@ unsafe extern "C" fn device_provider_start( false } } - .to_glib() + .into_glib() } unsafe extern "C" fn device_provider_stop(ptr: *mut ffi::GstDeviceProvider) { diff --git a/gstreamer/src/subclass/element.rs b/gstreamer/src/subclass/element.rs index 7c4ffea80..c5efbeafc 100644 --- a/gstreamer/src/subclass/element.rs +++ b/gstreamer/src/subclass/element.rs @@ -172,7 +172,7 @@ impl ElementImplExt for T { .expect("Missing parent function `change_state`"); StateChangeReturn::from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, - transition.to_glib(), + transition.into_glib(), )) .into_result() } @@ -427,7 +427,7 @@ unsafe extern "C" fn element_change_state( panic_to_error!(&wrap, &imp.panicked(), fallback, { imp.change_state(wrap.unsafe_cast_ref(), transition).into() }) - .to_glib() + .into_glib() } unsafe extern "C" fn element_request_new_pad( @@ -498,7 +498,7 @@ unsafe extern "C" fn element_send_event( panic_to_error!(&wrap, &imp.panicked(), false, { imp.send_event(wrap.unsafe_cast_ref(), from_glib_full(event)) }) - .to_glib() + .into_glib() } unsafe extern "C" fn element_query( @@ -513,7 +513,7 @@ unsafe extern "C" fn element_query( panic_to_error!(&wrap, &imp.panicked(), false, { imp.query(wrap.unsafe_cast_ref(), query) }) - .to_glib() + .into_glib() } unsafe extern "C" fn element_set_context( @@ -542,7 +542,7 @@ unsafe extern "C" fn element_set_clock( panic_to_error!(&wrap, &imp.panicked(), false, { imp.set_clock(wrap.unsafe_cast_ref(), clock.as_ref().as_ref()) }) - .to_glib() + .into_glib() } unsafe extern "C" fn element_provide_clock( @@ -569,7 +569,7 @@ unsafe extern "C" fn element_post_message( // Can't catch panics here as posting the error message would cause // this code to be called again recursively forever. imp.post_message(wrap.unsafe_cast_ref(), from_glib_full(msg)) - .to_glib() + .into_glib() } #[cfg(test)] diff --git a/gstreamer/src/subclass/plugin_1_14.rs b/gstreamer/src/subclass/plugin_1_14.rs index 2a6a32fd1..21b01e76d 100644 --- a/gstreamer/src/subclass/plugin_1_14.rs +++ b/gstreamer/src/subclass/plugin_1_14.rs @@ -20,7 +20,7 @@ macro_rules! plugin_define( $version:expr, $license:expr, $source:expr, $package:expr, $origin:expr, $release_datetime:expr) => { pub mod plugin_desc { - use $crate::glib::translate::{from_glib_borrow, ToGlib, from_glib}; + use $crate::glib::translate::{from_glib_borrow, IntoGlib, from_glib}; #[repr(transparent)] pub struct GstPluginDesc($crate::ffi::GstPluginDesc); diff --git a/gstreamer/src/subclass/uri_handler.rs b/gstreamer/src/subclass/uri_handler.rs index c4d0db526..bf3c37274 100644 --- a/gstreamer/src/subclass/uri_handler.rs +++ b/gstreamer/src/subclass/uri_handler.rs @@ -33,7 +33,7 @@ impl URIHandlerImplExt for T { let func = (*parent_iface) .get_protocols .expect("no parent \"protocols\" implementation"); - let ret = func(Self::ParentType::static_type().to_glib()); + let ret = func(Self::ParentType::static_type().into_glib()); FromGlibPtrContainer::from_glib_none(ret) } } @@ -109,7 +109,7 @@ unsafe impl IsImplementable for URIHandler { unsafe extern "C" fn uri_handler_get_type( _type_: glib::ffi::GType, ) -> ffi::GstURIType { - ::URI_TYPE.to_glib() + ::URI_TYPE.into_glib() } unsafe extern "C" fn uri_handler_get_protocols( @@ -144,10 +144,10 @@ unsafe extern "C" fn uri_handler_set_uri( &from_glib_borrow::<_, URIHandler>(uri_handler).unsafe_cast_ref(), glib::GString::from_glib_borrow(uri).as_str(), ) { - Ok(()) => true.to_glib(), + Ok(()) => true.into_glib(), Err(error) => { *err = error.into_raw(); - false.to_glib() + false.into_glib() } } } diff --git a/gstreamer/src/tag_setter.rs b/gstreamer/src/tag_setter.rs index 66afdc089..7de2bdb61 100644 --- a/gstreamer/src/tag_setter.rs +++ b/gstreamer/src/tag_setter.rs @@ -17,7 +17,7 @@ impl> TagSetterExtManual for O { ffi::gst_tag_setter_add_tag_value( self.as_ref().to_glib_none().0, - mode.to_glib(), + mode.into_glib(), T::tag_name().to_glib_none().0, v.to_glib_none().0, ); diff --git a/gstreamer/src/tags.rs b/gstreamer/src/tags.rs index 0ac1e82ed..2800a7b07 100644 --- a/gstreamer/src/tags.rs +++ b/gstreamer/src/tags.rs @@ -8,7 +8,7 @@ use std::mem; use once_cell::sync::Lazy; use glib::translate::{ - from_glib, from_glib_full, FromGlibPtrFull, ToGlib, ToGlibPtr, ToGlibPtrMut, + from_glib, from_glib_full, FromGlibPtrFull, IntoGlib, ToGlibPtr, ToGlibPtrMut, }; use glib::value::{FromValue, SendValue, ToSendValue, Value}; use glib::StaticType; @@ -399,7 +399,7 @@ impl TagListRef { ffi::gst_tag_list_add_value( self.as_mut_ptr(), - mode.to_glib(), + mode.into_glib(), tag_name.0, value.to_glib_none().0, ); @@ -514,7 +514,7 @@ impl TagListRef { } pub fn insert(&mut self, other: &TagListRef, mode: TagMergeMode) { - unsafe { ffi::gst_tag_list_insert(self.as_mut_ptr(), other.as_ptr(), mode.to_glib()) } + unsafe { ffi::gst_tag_list_insert(self.as_mut_ptr(), other.as_ptr(), mode.into_glib()) } } pub fn merge(&self, other: &TagListRef, mode: TagMergeMode) -> TagList { @@ -522,7 +522,7 @@ impl TagListRef { from_glib_full(ffi::gst_tag_list_merge( self.as_ptr(), other.as_ptr(), - mode.to_glib(), + mode.into_glib(), )) } } @@ -532,7 +532,7 @@ impl TagListRef { } pub fn set_scope(&mut self, scope: TagScope) { - unsafe { ffi::gst_tag_list_set_scope(self.as_mut_ptr(), scope.to_glib()) } + unsafe { ffi::gst_tag_list_set_scope(self.as_mut_ptr(), scope.into_glib()) } } } @@ -890,8 +890,8 @@ pub fn register CustomTag<'a>>() { unsafe { ffi::gst_tag_register( T::tag_name().to_glib_none().0, - T::FLAG.to_glib(), - T::TagType::static_type().to_glib(), + T::FLAG.into_glib(), + T::TagType::static_type().into_glib(), T::NICK.to_glib_none().0, T::DESCRIPTION.to_glib_none().0, Some(merge_func_trampoline::), diff --git a/gstreamer/src/toc.rs b/gstreamer/src/toc.rs index 42173cf35..3f1f982ab 100644 --- a/gstreamer/src/toc.rs +++ b/gstreamer/src/toc.rs @@ -5,7 +5,7 @@ use std::fmt; use std::mem; use glib::translate::{ - from_glib, from_glib_full, from_glib_none, FromGlibPtrContainer, ToGlib, ToGlibPtr, + from_glib, from_glib_full, from_glib_none, FromGlibPtrContainer, IntoGlib, ToGlibPtr, }; use crate::TagList; @@ -19,7 +19,7 @@ mini_object_wrapper!(Toc, TocRef, ffi::GstToc, || { ffi::gst_toc_get_type() }); impl Toc { pub fn new(scope: TocScope) -> Self { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_toc_new(scope.to_glib())) } + unsafe { from_glib_full(ffi::gst_toc_new(scope.into_glib())) } } } @@ -54,7 +54,7 @@ impl TocRef { pub fn merge_tags(&mut self, tag_list: &TagList, mode: TagMergeMode) { unsafe { - ffi::gst_toc_merge_tags(self.as_mut_ptr(), tag_list.as_mut_ptr(), mode.to_glib()); + ffi::gst_toc_merge_tags(self.as_mut_ptr(), tag_list.as_mut_ptr(), mode.into_glib()); } } @@ -90,7 +90,7 @@ impl TocEntry { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gst_toc_entry_new( - type_.to_glib(), + type_.into_glib(), uid.to_glib_none().0, )) } @@ -161,7 +161,11 @@ impl TocEntryRef { pub fn merge_tags(&mut self, tag_list: &TagList, mode: TagMergeMode) { unsafe { - ffi::gst_toc_entry_merge_tags(self.as_mut_ptr(), tag_list.as_mut_ptr(), mode.to_glib()); + ffi::gst_toc_entry_merge_tags( + self.as_mut_ptr(), + tag_list.as_mut_ptr(), + mode.into_glib(), + ); } } @@ -194,7 +198,7 @@ impl TocEntryRef { pub fn set_loop(&mut self, loop_type: TocLoopType, repeat_count: i32) { unsafe { - ffi::gst_toc_entry_set_loop(self.as_mut_ptr(), loop_type.to_glib(), repeat_count); + ffi::gst_toc_entry_set_loop(self.as_mut_ptr(), loop_type.into_glib(), repeat_count); } } } diff --git a/gstreamer/src/typefind.rs b/gstreamer/src/typefind.rs index 7336cf9bb..b37053d95 100644 --- a/gstreamer/src/typefind.rs +++ b/gstreamer/src/typefind.rs @@ -42,7 +42,7 @@ impl TypeFind { let res = ffi::gst_type_find_register( plugin.to_glib_none().0, name.to_glib_none().0, - rank.to_glib() as u32, + rank.into_glib() as u32, Some(type_find_trampoline::), extensions.to_glib_none().0, possible_caps.to_glib_none().0, @@ -69,7 +69,7 @@ impl TypeFind { unsafe { ffi::gst_type_find_suggest( &mut self.0, - probability.to_glib() as u32, + probability.into_glib() as u32, caps.to_glib_none().0, ); }