manual renames of to_glib into into_glib

This commit is contained in:
Bilal Elmoussaoui 2021-04-27 17:15:46 +02:00
parent 060a7df448
commit 890cd03632
111 changed files with 782 additions and 752 deletions

View file

@ -118,7 +118,7 @@ mod custom_meta {
// Need to initialize all our fields correctly here. // Need to initialize all our fields correctly here.
ptr::write(&mut meta.label, params.label); 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. // 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. // and do things conditional on that, or even just drop the meta.
super::CustomMeta::add(gst::BufferRef::from_mut_ptr(dest), meta.label.clone()); 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. // Register the meta itself with its functions.
@ -160,7 +160,7 @@ mod custom_meta {
static META_INFO: Lazy<MetaInfo> = Lazy::new(|| unsafe { static META_INFO: Lazy<MetaInfo> = Lazy::new(|| unsafe {
MetaInfo( MetaInfo(
ptr::NonNull::new(gst::ffi::gst_meta_register( 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 _, b"MyCustomMeta\0".as_ptr() as *const _,
mem::size_of::<CustomMeta>(), mem::size_of::<CustomMeta>(),
Some(custom_meta_init), Some(custom_meta_init),

View file

@ -90,11 +90,11 @@ fn main_loop() -> Result<(), Error> {
gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_ACCESS gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_ACCESS
.to_glib_none() .to_glib_none()
.0, .0,
<bool as StaticType>::static_type().to_glib() as *const u8, <bool as StaticType>::static_type().into_glib() as *const u8,
true.to_glib() as *const u8, true.into_glib() as *const u8,
gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_CONSTRUCT.as_ptr() as *const u8, gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_CONSTRUCT.as_ptr() as *const u8,
<bool as StaticType>::static_type().to_glib() as *const u8, <bool as StaticType>::static_type().into_glib() as *const u8,
true.to_glib() as *const u8, true.into_glib() as *const u8,
ptr::null_mut::<u8>(), ptr::null_mut::<u8>(),
); );
} }

View file

@ -180,7 +180,7 @@ unsafe extern "C" fn trampoline_new_preroll(
if callbacks.panicked.load(Ordering::Relaxed) { if callbacks.panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); 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 { 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 gst::FlowReturn::Error
}; };
ret.to_glib() ret.into_glib()
} }
unsafe extern "C" fn trampoline_new_sample( unsafe extern "C" fn trampoline_new_sample(
@ -213,7 +213,7 @@ unsafe extern "C" fn trampoline_new_sample(
if callbacks.panicked.load(Ordering::Relaxed) { if callbacks.panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); 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 { 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 gst::FlowReturn::Error
}; };
ret.to_glib() ret.into_glib()
} }
unsafe extern "C" fn destroy_callbacks(ptr: gpointer) { unsafe extern "C" fn destroy_callbacks(ptr: gpointer) {
@ -252,15 +252,18 @@ impl AppSink {
// This is not thread-safe before 1.16.3, see // This is not thread-safe before 1.16.3, see
// https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/merge_requests/570 // https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/merge_requests/570
if gst::version() < (1, 16, 3, 0) { if gst::version() < (1, 16, 3, 0) {
if !glib::gobject_ffi::g_object_get_qdata(sink as *mut _, SET_ONCE_QUARK.to_glib()) if !glib::gobject_ffi::g_object_get_qdata(
.is_null() sink as *mut _,
SET_ONCE_QUARK.into_glib(),
)
.is_null()
{ {
panic!("AppSink callbacks can only be set once"); panic!("AppSink callbacks can only be set once");
} }
glib::gobject_ffi::g_object_set_qdata( glib::gobject_ffi::g_object_set_qdata(
sink as *mut _, sink as *mut _,
SET_ONCE_QUARK.to_glib(), SET_ONCE_QUARK.into_glib(),
1 as *mut _, 1 as *mut _,
); );
} }
@ -326,7 +329,7 @@ unsafe extern "C" fn new_sample_trampoline<
) -> gst::ffi::GstFlowReturn { ) -> gst::ffi::GstFlowReturn {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
let ret: gst::FlowReturn = f(&from_glib_borrow(this)).into(); let ret: gst::FlowReturn = f(&from_glib_borrow(this)).into();
ret.to_glib() ret.into_glib()
} }
unsafe extern "C" fn new_preroll_trampoline< unsafe extern "C" fn new_preroll_trampoline<
@ -337,7 +340,7 @@ unsafe extern "C" fn new_preroll_trampoline<
) -> gst::ffi::GstFlowReturn { ) -> gst::ffi::GstFlowReturn {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
let ret: gst::FlowReturn = f(&from_glib_borrow(this)).into(); let ret: gst::FlowReturn = f(&from_glib_borrow(this)).into();
ret.to_glib() ret.into_glib()
} }
#[cfg(any(feature = "v1_10"))] #[cfg(any(feature = "v1_10"))]

View file

@ -180,7 +180,7 @@ unsafe extern "C" fn trampoline_seek_data(
if callbacks.panicked.load(Ordering::Relaxed) { if callbacks.panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc); let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); 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 { let ret = if let Some(ref seek_data) = callbacks.seek_data {
@ -199,7 +199,7 @@ unsafe extern "C" fn trampoline_seek_data(
false false
}; };
ret.to_glib() ret.into_glib()
} }
unsafe extern "C" fn destroy_callbacks(ptr: gpointer) { unsafe extern "C" fn destroy_callbacks(ptr: gpointer) {
@ -258,7 +258,7 @@ impl AppSrc {
// This is not thread-safe before 1.16.3, see // This is not thread-safe before 1.16.3, see
// https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/merge_requests/570 // https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/merge_requests/570
if gst::version() < (1, 16, 3, 0) { 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() .is_null()
{ {
panic!("AppSrc callbacks can only be set once"); panic!("AppSrc callbacks can only be set once");
@ -266,7 +266,7 @@ impl AppSrc {
glib::gobject_ffi::g_object_set_qdata( glib::gobject_ffi::g_object_set_qdata(
src as *mut _, src as *mut _,
SET_ONCE_QUARK.to_glib(), SET_ONCE_QUARK.into_glib(),
1 as *mut _, 1 as *mut _,
); );
} }
@ -282,7 +282,7 @@ impl AppSrc {
pub fn set_latency(&self, min: gst::ClockTime, max: gst::ClockTime) { pub fn set_latency(&self, min: gst::ClockTime, max: gst::ClockTime) {
unsafe { 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());
} }
} }

View file

@ -4,11 +4,11 @@ use crate::AudioChannelPosition;
use std::mem; use std::mem;
use glib::translate::{from_glib, ToGlib}; use glib::translate::{from_glib, IntoGlib};
impl AudioChannelPosition { impl AudioChannelPosition {
pub fn to_mask(self) -> u64 { pub fn to_mask(self) -> u64 {
let pos = self.to_glib(); let pos = self.into_glib();
if pos < 0 { if pos < 0 {
return 0; return 0;
} }
@ -31,7 +31,7 @@ impl AudioChannelPosition {
if i >= len as usize { if i >= len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } 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( let valid: bool = from_glib(ffi::gst_audio_channel_positions_to_mask(
positions_raw.as_ptr() as *mut _, positions_raw.as_ptr() as *mut _,
len as i32, len as i32,
force_order.to_glib(), force_order.into_glib(),
mask.as_mut_ptr(), mask.as_mut_ptr(),
)); ));
if valid { if valid {
@ -100,7 +100,7 @@ impl AudioChannelPosition {
if i >= len as usize { if i >= len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
positions[i].to_glib() positions[i].into_glib()
} }
}); });
@ -144,7 +144,7 @@ impl AudioChannelPosition {
if i >= len as usize { if i >= len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
positions[i].to_glib() positions[i].into_glib()
} }
}); });
@ -152,7 +152,7 @@ impl AudioChannelPosition {
from_glib(ffi::gst_audio_check_valid_channel_positions( from_glib(ffi::gst_audio_check_valid_channel_positions(
positions_raw.as_ptr() as *mut _, positions_raw.as_ptr() as *mut _,
len as i32, 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 { if i >= from_len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
from[i].to_glib() from[i].into_glib()
} }
}); });
@ -186,14 +186,14 @@ pub fn buffer_reorder_channels(
if i >= to_len as usize { if i >= to_len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
to[i].to_glib() to[i].into_glib()
} }
}); });
let valid: bool = unsafe { let valid: bool = unsafe {
from_glib(ffi::gst_audio_buffer_reorder_channels( from_glib(ffi::gst_audio_buffer_reorder_channels(
buffer.as_mut_ptr(), buffer.as_mut_ptr(),
format.to_glib(), format.into_glib(),
channels as i32, channels as i32,
from_raw.as_ptr() as *mut _, from_raw.as_ptr() as *mut _,
to_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 { if i >= from_len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
from[i].to_glib() from[i].into_glib()
} }
}); });
@ -235,7 +235,7 @@ pub fn reorder_channels(
if i >= to_len as usize { if i >= to_len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
to[i].to_glib() to[i].into_glib()
} }
}); });
@ -243,7 +243,7 @@ pub fn reorder_channels(
from_glib(ffi::gst_audio_reorder_channels( from_glib(ffi::gst_audio_reorder_channels(
data.as_mut_ptr() as *mut _, data.as_mut_ptr() as *mut _,
data.len(), data.len(),
format.to_glib(), format.into_glib(),
channels as i32, channels as i32,
from_raw.as_ptr() as *mut _, from_raw.as_ptr() as *mut _,
to_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 { if i >= from_len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
from[i].to_glib() from[i].into_glib()
} }
}); });
@ -283,7 +283,7 @@ pub fn channel_reorder_map(
if i >= to_len as usize { if i >= to_len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
to[i].to_glib() to[i].into_glib()
} }
}); });

View file

@ -159,7 +159,7 @@ impl<O: IsA<AudioDecoder>> AudioDecoderExtManual for O {
from_glib(_gst_audio_decoder_error( from_glib(_gst_audio_decoder_error(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
weight, weight,
T::domain().to_glib(), T::domain().into_glib(),
code.code(), code.code(),
message.to_glib_full(), message.to_glib_full(),
debug.to_glib_full(), debug.to_glib_full(),

View file

@ -3,7 +3,7 @@
use std::ffi::CStr; use std::ffi::CStr;
use std::str; use std::str;
use glib::translate::{from_glib, ToGlib}; use glib::translate::{from_glib, IntoGlib};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
@ -104,8 +104,8 @@ impl crate::AudioFormat {
unsafe { unsafe {
from_glib(ffi::gst_audio_format_build_integer( from_glib(ffi::gst_audio_format_build_integer(
sign.to_glib(), sign.into_glib(),
endianness.to_glib(), endianness.into_glib(),
width, width,
depth, depth,
)) ))
@ -118,7 +118,7 @@ impl crate::AudioFormat {
} }
unsafe { unsafe {
CStr::from_ptr( CStr::from_ptr(
ffi::gst_audio_format_to_string(self.to_glib()) ffi::gst_audio_format_to_string(self.into_glib())
.as_ref() .as_ref()
.expect("gst_audio_format_to_string returned NULL"), .expect("gst_audio_format_to_string returned NULL"),
) )

View file

@ -5,7 +5,7 @@ use std::ffi::CStr;
use std::fmt; use std::fmt;
use std::str; 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; use glib::StaticType;
#[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)] #[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)]
@ -28,11 +28,11 @@ impl FromGlib<i32> for AudioEndianness {
} }
} }
impl ToGlib for AudioEndianness { impl IntoGlib for AudioEndianness {
type GlibType = i32; type GlibType = i32;
fn to_glib(&self) -> i32 { fn into_glib(self) -> i32 {
match *self { match self {
AudioEndianness::LittleEndian => 1234, AudioEndianness::LittleEndian => 1234,
AudioEndianness::BigEndian => 4321, AudioEndianness::BigEndian => 4321,
_ => 0, _ => 0,
@ -47,7 +47,7 @@ impl AudioFormatInfo {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { 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()); assert!(!info.is_null());
AudioFormatInfo(&*info) AudioFormatInfo(&*info)
@ -116,7 +116,7 @@ impl AudioFormatInfo {
unsafe { unsafe {
(self.0.unpack_func.as_ref().unwrap())( (self.0.unpack_func.as_ref().unwrap())(
self.0, self.0,
flags.to_glib(), flags.into_glib(),
dest.as_mut_ptr() as *mut _, dest.as_mut_ptr() as *mut _,
src.as_ptr() as *const _, src.as_ptr() as *const _,
nsamples as i32, nsamples as i32,
@ -150,7 +150,7 @@ impl AudioFormatInfo {
unsafe { unsafe {
(self.0.pack_func.as_ref().unwrap())( (self.0.pack_func.as_ref().unwrap())(
self.0, self.0,
flags.to_glib(), flags.into_glib(),
src.as_ptr() as *const _, src.as_ptr() as *const _,
dest.as_mut_ptr() as *mut _, dest.as_mut_ptr() as *mut _,
nsamples as i32, nsamples as i32,

View file

@ -1,6 +1,8 @@
// Take a look at the license at the top of the repository in the LICENSE file. // 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 gst::prelude::*;
use std::fmt; use std::fmt;
@ -46,14 +48,14 @@ impl<'a> AudioInfoBuilder<'a> {
if i >= self.channels as usize { if i >= self.channels as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
p[i].to_glib() p[i].into_glib()
} }
}); });
let valid: bool = from_glib(ffi::gst_audio_check_valid_channel_positions( let valid: bool = from_glib(ffi::gst_audio_check_valid_channel_positions(
positions.as_ptr() as *mut _, positions.as_ptr() as *mut _,
self.channels as i32, self.channels as i32,
true.to_glib(), true.into_glib(),
)); ));
if !valid { if !valid {
return Err(glib::bool_error!("channel positions are invalid")); return Err(glib::bool_error!("channel positions are invalid"));
@ -71,7 +73,7 @@ impl<'a> AudioInfoBuilder<'a> {
ffi::gst_audio_info_set_format( ffi::gst_audio_info_set_format(
info.as_mut_ptr(), info.as_mut_ptr(),
self.format.to_glib(), self.format.into_glib(),
self.rate as i32, self.rate as i32,
self.channels as i32, self.channels as i32,
positions_ptr as *mut _, positions_ptr as *mut _,
@ -84,11 +86,11 @@ impl<'a> AudioInfoBuilder<'a> {
} }
if let Some(flags) = self.flags { if let Some(flags) = self.flags {
info.flags = flags.to_glib(); info.flags = flags.into_glib();
} }
if let Some(layout) = self.layout { 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])); 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(); let mut dest_val = mem::MaybeUninit::uninit();
if from_glib(ffi::gst_audio_info_convert( if from_glib(ffi::gst_audio_info_convert(
&self.0, &self.0,
src_val.format().to_glib(), src_val.format().into_glib(),
src_val.to_raw_value(), src_val.to_raw_value(),
U::default_format().to_glib(), U::default_format().into_glib(),
dest_val.as_mut_ptr(), dest_val.as_mut_ptr(),
)) { )) {
Some(U::from_raw(U::default_format(), dest_val.assume_init())) Some(U::from_raw(U::default_format(), dest_val.assume_init()))
@ -203,9 +205,9 @@ impl AudioInfo {
let mut dest_val = mem::MaybeUninit::uninit(); let mut dest_val = mem::MaybeUninit::uninit();
if from_glib(ffi::gst_audio_info_convert( if from_glib(ffi::gst_audio_info_convert(
&self.0, &self.0,
src_val.format().to_glib(), src_val.format().into_glib(),
src_val.to_raw_value(), src_val.to_raw_value(),
dest_fmt.to_glib(), dest_fmt.into_glib(),
dest_val.as_mut_ptr(), dest_val.as_mut_ptr(),
)) { )) {
Some(gst::GenericFormattedValue::new( Some(gst::GenericFormattedValue::new(

View file

@ -8,7 +8,7 @@ use std::ptr;
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
use std::slice; use std::slice;
use glib::translate::{from_glib, ToGlib}; use glib::translate::{from_glib, IntoGlib};
#[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
use glib::translate::{from_glib_none, ToGlibPtr}; use glib::translate::{from_glib_none, ToGlibPtr};
@ -33,7 +33,7 @@ impl AudioClippingMeta {
unsafe { unsafe {
let meta = ffi::gst_buffer_add_audio_clipping_meta( let meta = ffi::gst_buffer_add_audio_clipping_meta(
buffer.as_mut_ptr(), buffer.as_mut_ptr(),
start.format().to_glib(), start.format().into_glib(),
start.value() as u64, start.value() as u64,
end.value() as u64, end.value() as u64,
); );

View file

@ -18,7 +18,7 @@ impl AudioRingBufferSpec {
} }
pub fn set_type(&mut self, value: AudioRingBufferFormatType) { 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 { pub fn caps(&self) -> Caps {

View file

@ -20,8 +20,8 @@ impl AudioStreamAlign {
let mut out_sample_position = mem::MaybeUninit::uninit(); let mut out_sample_position = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_audio_stream_align_process( let ret = from_glib(ffi::gst_audio_stream_align_process(
self.to_glib_none_mut().0, self.to_glib_none_mut().0,
discont.to_glib(), discont.into_glib(),
timestamp.to_glib(), timestamp.into_glib(),
n_samples, n_samples,
out_timestamp.as_mut_ptr(), out_timestamp.as_mut_ptr(),
out_duration.as_mut_ptr(), out_duration.as_mut_ptr(),

View file

@ -87,14 +87,14 @@ mod tests {
#[cfg(feature = "v1_18")] #[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 */ /* audio_make_raw_caps() is a re-implementation so ensure it returns the same caps as the C API */
let c_caps = unsafe { let c_caps = unsafe {
let formats: Vec<ffi::GstAudioFormat> = let formats: Vec<ffi::GstAudioFormat> =
[crate::AudioFormat::S16be, crate::AudioFormat::S16le] [crate::AudioFormat::S16be, crate::AudioFormat::S16le]
.iter() .iter()
.map(|f| f.to_glib()) .map(|f| f.into_glib())
.collect(); .collect();
let caps = ffi::gst_audio_make_raw_caps( let caps = ffi::gst_audio_make_raw_caps(
formats.as_ptr(), formats.as_ptr(),

View file

@ -375,7 +375,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
.map(|f| { .map(|f| {
f( f(
element.unsafe_cast_ref::<AudioDecoder>().to_glib_none().0, element.unsafe_cast_ref::<AudioDecoder>().to_glib_none().0,
hard.to_glib(), hard.into_glib(),
) )
}) })
.unwrap_or(()) .unwrap_or(())
@ -574,7 +574,7 @@ unsafe extern "C" fn audio_decoder_open<T: AudioDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_decoder_close<T: AudioDecoderImpl>( unsafe extern "C" fn audio_decoder_close<T: AudioDecoderImpl>(
@ -593,7 +593,7 @@ unsafe extern "C" fn audio_decoder_close<T: AudioDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_decoder_start<T: AudioDecoderImpl>( unsafe extern "C" fn audio_decoder_start<T: AudioDecoderImpl>(
@ -612,7 +612,7 @@ unsafe extern "C" fn audio_decoder_start<T: AudioDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_decoder_stop<T: AudioDecoderImpl>( unsafe extern "C" fn audio_decoder_stop<T: AudioDecoderImpl>(
@ -631,7 +631,7 @@ unsafe extern "C" fn audio_decoder_stop<T: AudioDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_decoder_set_format<T: AudioDecoderImpl>( unsafe extern "C" fn audio_decoder_set_format<T: AudioDecoderImpl>(
@ -651,7 +651,7 @@ unsafe extern "C" fn audio_decoder_set_format<T: AudioDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_decoder_parse<T: AudioDecoderImpl>( unsafe extern "C" fn audio_decoder_parse<T: AudioDecoderImpl>(
@ -677,7 +677,7 @@ unsafe extern "C" fn audio_decoder_parse<T: AudioDecoderImpl>(
} }
.into() .into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_decoder_handle_frame<T: AudioDecoderImpl>( unsafe extern "C" fn audio_decoder_handle_frame<T: AudioDecoderImpl>(
@ -697,7 +697,7 @@ unsafe extern "C" fn audio_decoder_handle_frame<T: AudioDecoderImpl>(
) )
.into() .into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_decoder_pre_push<T: AudioDecoderImpl>( unsafe extern "C" fn audio_decoder_pre_push<T: AudioDecoderImpl>(
@ -722,7 +722,7 @@ unsafe extern "C" fn audio_decoder_pre_push<T: AudioDecoderImpl>(
} }
.into() .into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_decoder_flush<T: AudioDecoderImpl>( unsafe extern "C" fn audio_decoder_flush<T: AudioDecoderImpl>(
@ -754,7 +754,7 @@ unsafe extern "C" fn audio_decoder_negotiate<T: AudioDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_decoder_getcaps<T: AudioDecoderImpl>( unsafe extern "C" fn audio_decoder_getcaps<T: AudioDecoderImpl>(
@ -788,7 +788,7 @@ unsafe extern "C" fn audio_decoder_sink_event<T: AudioDecoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_decoder_sink_query<T: AudioDecoderImpl>( unsafe extern "C" fn audio_decoder_sink_query<T: AudioDecoderImpl>(
@ -802,7 +802,7 @@ unsafe extern "C" fn audio_decoder_sink_query<T: AudioDecoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) 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<T: AudioDecoderImpl>( unsafe extern "C" fn audio_decoder_src_event<T: AudioDecoderImpl>(
@ -816,7 +816,7 @@ unsafe extern "C" fn audio_decoder_src_event<T: AudioDecoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_decoder_src_query<T: AudioDecoderImpl>( unsafe extern "C" fn audio_decoder_src_query<T: AudioDecoderImpl>(
@ -830,7 +830,7 @@ unsafe extern "C" fn audio_decoder_src_query<T: AudioDecoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) 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<T: AudioDecoderImpl>( unsafe extern "C" fn audio_decoder_propose_allocation<T: AudioDecoderImpl>(
@ -851,7 +851,7 @@ unsafe extern "C" fn audio_decoder_propose_allocation<T: AudioDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_decoder_decide_allocation<T: AudioDecoderImpl>( unsafe extern "C" fn audio_decoder_decide_allocation<T: AudioDecoderImpl>(
@ -872,5 +872,5 @@ unsafe extern "C" fn audio_decoder_decide_allocation<T: AudioDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }

View file

@ -519,7 +519,7 @@ unsafe extern "C" fn audio_encoder_open<T: AudioEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_encoder_close<T: AudioEncoderImpl>( unsafe extern "C" fn audio_encoder_close<T: AudioEncoderImpl>(
@ -538,7 +538,7 @@ unsafe extern "C" fn audio_encoder_close<T: AudioEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_encoder_start<T: AudioEncoderImpl>( unsafe extern "C" fn audio_encoder_start<T: AudioEncoderImpl>(
@ -557,7 +557,7 @@ unsafe extern "C" fn audio_encoder_start<T: AudioEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_encoder_stop<T: AudioEncoderImpl>( unsafe extern "C" fn audio_encoder_stop<T: AudioEncoderImpl>(
@ -576,7 +576,7 @@ unsafe extern "C" fn audio_encoder_stop<T: AudioEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_encoder_set_format<T: AudioEncoderImpl>( unsafe extern "C" fn audio_encoder_set_format<T: AudioEncoderImpl>(
@ -596,7 +596,7 @@ unsafe extern "C" fn audio_encoder_set_format<T: AudioEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_encoder_handle_frame<T: AudioEncoderImpl>( unsafe extern "C" fn audio_encoder_handle_frame<T: AudioEncoderImpl>(
@ -616,7 +616,7 @@ unsafe extern "C" fn audio_encoder_handle_frame<T: AudioEncoderImpl>(
) )
.into() .into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_encoder_pre_push<T: AudioEncoderImpl>( unsafe extern "C" fn audio_encoder_pre_push<T: AudioEncoderImpl>(
@ -641,7 +641,7 @@ unsafe extern "C" fn audio_encoder_pre_push<T: AudioEncoderImpl>(
} }
.into() .into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_encoder_flush<T: AudioEncoderImpl>(ptr: *mut ffi::GstAudioEncoder) { unsafe extern "C" fn audio_encoder_flush<T: AudioEncoderImpl>(ptr: *mut ffi::GstAudioEncoder) {
@ -670,7 +670,7 @@ unsafe extern "C" fn audio_encoder_negotiate<T: AudioEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_encoder_getcaps<T: AudioEncoderImpl>( unsafe extern "C" fn audio_encoder_getcaps<T: AudioEncoderImpl>(
@ -704,7 +704,7 @@ unsafe extern "C" fn audio_encoder_sink_event<T: AudioEncoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_encoder_sink_query<T: AudioEncoderImpl>( unsafe extern "C" fn audio_encoder_sink_query<T: AudioEncoderImpl>(
@ -718,7 +718,7 @@ unsafe extern "C" fn audio_encoder_sink_query<T: AudioEncoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) 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<T: AudioEncoderImpl>( unsafe extern "C" fn audio_encoder_src_event<T: AudioEncoderImpl>(
@ -732,7 +732,7 @@ unsafe extern "C" fn audio_encoder_src_event<T: AudioEncoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_encoder_src_query<T: AudioEncoderImpl>( unsafe extern "C" fn audio_encoder_src_query<T: AudioEncoderImpl>(
@ -746,7 +746,7 @@ unsafe extern "C" fn audio_encoder_src_query<T: AudioEncoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) 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<T: AudioEncoderImpl>( unsafe extern "C" fn audio_encoder_propose_allocation<T: AudioEncoderImpl>(
@ -767,7 +767,7 @@ unsafe extern "C" fn audio_encoder_propose_allocation<T: AudioEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audio_encoder_decide_allocation<T: AudioEncoderImpl>( unsafe extern "C" fn audio_encoder_decide_allocation<T: AudioEncoderImpl>(
@ -788,5 +788,5 @@ unsafe extern "C" fn audio_encoder_decide_allocation<T: AudioEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }

View file

@ -217,7 +217,7 @@ unsafe extern "C" fn audiosink_close<T: AudioSinkImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audiosink_delay<T: AudioSinkImpl>(ptr: *mut ffi::GstAudioSink) -> u32 { unsafe extern "C" fn audiosink_delay<T: AudioSinkImpl>(ptr: *mut ffi::GstAudioSink) -> u32 {
@ -246,7 +246,7 @@ unsafe extern "C" fn audiosink_open<T: AudioSinkImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audiosink_prepare<T: AudioSinkImpl>( unsafe extern "C" fn audiosink_prepare<T: AudioSinkImpl>(
@ -268,7 +268,7 @@ unsafe extern "C" fn audiosink_prepare<T: AudioSinkImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audiosink_unprepare<T: AudioSinkImpl>( unsafe extern "C" fn audiosink_unprepare<T: AudioSinkImpl>(
@ -287,7 +287,7 @@ unsafe extern "C" fn audiosink_unprepare<T: AudioSinkImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audiosink_write<T: AudioSinkImpl>( unsafe extern "C" fn audiosink_write<T: AudioSinkImpl>(

View file

@ -233,7 +233,7 @@ unsafe extern "C" fn audiosrc_close<T: AudioSrcImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audiosrc_delay<T: AudioSrcImpl>(ptr: *mut ffi::GstAudioSrc) -> u32 { unsafe extern "C" fn audiosrc_delay<T: AudioSrcImpl>(ptr: *mut ffi::GstAudioSrc) -> u32 {
@ -262,7 +262,7 @@ unsafe extern "C" fn audiosrc_open<T: AudioSrcImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audiosrc_prepare<T: AudioSrcImpl>( unsafe extern "C" fn audiosrc_prepare<T: AudioSrcImpl>(
@ -284,7 +284,7 @@ unsafe extern "C" fn audiosrc_prepare<T: AudioSrcImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audiosrc_unprepare<T: AudioSrcImpl>( unsafe extern "C" fn audiosrc_unprepare<T: AudioSrcImpl>(
@ -303,7 +303,7 @@ unsafe extern "C" fn audiosrc_unprepare<T: AudioSrcImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn audiosrc_read<T: AudioSrcImpl>( unsafe extern "C" fn audiosrc_read<T: AudioSrcImpl>(
@ -321,7 +321,7 @@ unsafe extern "C" fn audiosrc_read<T: AudioSrcImpl>(
let (res, timestamp_res) = imp let (res, timestamp_res) = imp
.read(wrap.unsafe_cast_ref(), data_slice) .read(wrap.unsafe_cast_ref(), data_slice)
.unwrap_or((0, gst::CLOCK_TIME_NONE)); .unwrap_or((0, gst::CLOCK_TIME_NONE));
*timestamp = timestamp_res.to_glib(); *timestamp = timestamp_res.into_glib();
res res
}) })

View file

@ -188,9 +188,9 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
unsafe { unsafe {
ffi::gst_aggregator_selected_samples( ffi::gst_aggregator_selected_samples(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
pts.to_glib(), pts.into_glib(),
dts.to_glib(), dts.into_glib(),
duration.to_glib(), duration.into_glib(),
info.as_ref() info.as_ref()
.map(|s| s.as_ptr() as *mut _) .map(|s| s.as_ptr() as *mut _)
.unwrap_or(ptr::null_mut()), .unwrap_or(ptr::null_mut()),

View file

@ -52,7 +52,7 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
unsafe { unsafe {
ffi::gst_base_parse_set_duration( ffi::gst_base_parse_set_duration(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
duration.format().to_glib(), duration.format().into_glib(),
duration.value(), duration.value(),
interval as i32, interval as i32,
); );
@ -81,9 +81,9 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
let mut dest_val = mem::MaybeUninit::uninit(); let mut dest_val = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_base_parse_convert_default( let ret = from_glib(ffi::gst_base_parse_convert_default(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
src_val.format().to_glib(), src_val.format().into_glib(),
src_val.to_raw_value(), src_val.to_raw_value(),
U::default_format().to_glib(), U::default_format().into_glib(),
dest_val.as_mut_ptr(), dest_val.as_mut_ptr(),
)); ));
if ret { if ret {
@ -104,9 +104,9 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
let mut dest_val = mem::MaybeUninit::uninit(); let mut dest_val = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_base_parse_convert_default( let ret = from_glib(ffi::gst_base_parse_convert_default(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
src_val.format().to_glib(), src_val.format().into_glib(),
src_val.to_raw_value(), src_val.to_raw_value(),
dest_format.to_glib(), dest_format.into_glib(),
dest_val.as_mut_ptr(), dest_val.as_mut_ptr(),
)); ));
if ret { if ret {

View file

@ -25,11 +25,11 @@ pub enum Overhead {
} }
#[doc(hidden)] #[doc(hidden)]
impl ToGlib for Overhead { impl IntoGlib for Overhead {
type GlibType = i32; type GlibType = i32;
fn to_glib(&self) -> i32 { fn into_glib(self) -> i32 {
match *self { match self {
Overhead::None => 0, Overhead::None => 0,
Overhead::Frame => -1, Overhead::Frame => -1,
Overhead::Bytes(b) => i32::try_from(b).expect("overhead is higher than i32::MAX"), 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) { pub fn set_overhead(&mut self, overhead: Overhead) {
unsafe { unsafe {
(*self.to_glib_none().0).overhead = overhead.to_glib(); (*self.to_glib_none().0).overhead = overhead.into_glib();
} }
} }
} }

View file

@ -44,7 +44,7 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
let mut jitter = 0; let mut jitter = 0;
let ret: gst::FlowReturn = from_glib(ffi::gst_base_sink_wait( let ret: gst::FlowReturn = from_glib(ffi::gst_base_sink_wait(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
time.to_glib(), time.into_glib(),
&mut jitter, &mut jitter,
)); ));
(ret.into_result(), jitter) (ret.into_result(), jitter)
@ -71,7 +71,7 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
let mut jitter = 0; let mut jitter = 0;
let ret: gst::ClockReturn = from_glib(ffi::gst_base_sink_wait_clock( let ret: gst::ClockReturn = from_glib(ffi::gst_base_sink_wait_clock(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
time.to_glib(), time.into_glib(),
&mut jitter, &mut jitter,
)); ));
(ret.into_result(), jitter) (ret.into_result(), jitter)

View file

@ -50,7 +50,7 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
fn start_complete(&self, ret: Result<gst::FlowSuccess, gst::FlowError>) { fn start_complete(&self, ret: Result<gst::FlowSuccess, gst::FlowError>) {
let ret: gst::FlowReturn = ret.into(); let ret: gst::FlowReturn = ret.into();
unsafe { 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());
} }
} }

View file

@ -68,7 +68,7 @@ impl FlowCombiner {
let ret: gst::FlowReturn = unsafe { let ret: gst::FlowReturn = unsafe {
from_glib(ffi::gst_flow_combiner_update_flow( from_glib(ffi::gst_flow_combiner_update_flow(
self.to_glib_none().0, self.to_glib_none().0,
fret.to_glib(), fret.into_glib(),
)) ))
}; };
ret.into_result() ret.into_result()
@ -84,7 +84,7 @@ impl FlowCombiner {
from_glib(ffi::gst_flow_combiner_update_pad_flow( from_glib(ffi::gst_flow_combiner_update_pad_flow(
self.to_glib_none().0, self.to_glib_none().0,
pad.as_ref().to_glib_none().0, pad.as_ref().to_glib_none().0,
fret.to_glib(), fret.into_glib(),
)) ))
}; };
ret.into_result() ret.into_result()

View file

@ -486,8 +486,8 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
Some(f) => gst::result_from_gboolean!( Some(f) => gst::result_from_gboolean!(
f( f(
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0, aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
mode.to_glib(), mode.into_glib(),
active.to_glib() active.into_glib()
), ),
gst::CAT_RUST, gst::CAT_RUST,
"Parent function `src_activate` failed" "Parent function `src_activate` failed"
@ -509,7 +509,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.expect("Missing parent function `aggregate`"); .expect("Missing parent function `aggregate`");
gst::FlowReturn::from_glib(f( gst::FlowReturn::from_glib(f(
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0, aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
timeout.to_glib(), timeout.into_glib(),
)) ))
.into_result() .into_result()
} }
@ -748,7 +748,7 @@ unsafe extern "C" fn aggregator_flush<T: AggregatorImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.flush(wrap.unsafe_cast_ref()).into() imp.flush(wrap.unsafe_cast_ref()).into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn aggregator_clip<T: AggregatorImpl>( unsafe extern "C" fn aggregator_clip<T: AggregatorImpl>(
@ -783,7 +783,7 @@ unsafe extern "C" fn aggregator_finish_buffer<T: AggregatorImpl>(
imp.finish_buffer(wrap.unsafe_cast_ref(), from_glib_full(buffer)) imp.finish_buffer(wrap.unsafe_cast_ref(), from_glib_full(buffer))
.into() .into()
}) })
.to_glib() .into_glib()
} }
#[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg(any(feature = "v1_18", feature = "dox"))]
@ -800,7 +800,7 @@ unsafe extern "C" fn aggregator_finish_buffer_list<T: AggregatorImpl>(
imp.finish_buffer_list(wrap.unsafe_cast_ref(), from_glib_full(buffer_list)) imp.finish_buffer_list(wrap.unsafe_cast_ref(), from_glib_full(buffer_list))
.into() .into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn aggregator_sink_event<T: AggregatorImpl>( unsafe extern "C" fn aggregator_sink_event<T: AggregatorImpl>(
@ -819,7 +819,7 @@ unsafe extern "C" fn aggregator_sink_event<T: AggregatorImpl>(
from_glib_full(event), from_glib_full(event),
) )
}) })
.to_glib() .into_glib()
} }
#[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg(any(feature = "v1_18", feature = "dox"))]
@ -841,7 +841,7 @@ unsafe extern "C" fn aggregator_sink_event_pre_queue<T: AggregatorImpl>(
) )
.into() .into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn aggregator_sink_query<T: AggregatorImpl>( unsafe extern "C" fn aggregator_sink_query<T: AggregatorImpl>(
@ -860,7 +860,7 @@ unsafe extern "C" fn aggregator_sink_query<T: AggregatorImpl>(
gst::QueryRef::from_mut_ptr(query), gst::QueryRef::from_mut_ptr(query),
) )
}) })
.to_glib() .into_glib()
} }
#[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg(any(feature = "v1_18", feature = "dox"))]
@ -881,7 +881,7 @@ unsafe extern "C" fn aggregator_sink_query_pre_queue<T: AggregatorImpl>(
gst::QueryRef::from_mut_ptr(query), gst::QueryRef::from_mut_ptr(query),
) )
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn aggregator_src_event<T: AggregatorImpl>( unsafe extern "C" fn aggregator_src_event<T: AggregatorImpl>(
@ -895,7 +895,7 @@ unsafe extern "C" fn aggregator_src_event<T: AggregatorImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn aggregator_src_query<T: AggregatorImpl>( unsafe extern "C" fn aggregator_src_query<T: AggregatorImpl>(
@ -909,7 +909,7 @@ unsafe extern "C" fn aggregator_src_query<T: AggregatorImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn aggregator_src_activate<T: AggregatorImpl>( unsafe extern "C" fn aggregator_src_activate<T: AggregatorImpl>(
@ -930,7 +930,7 @@ unsafe extern "C" fn aggregator_src_activate<T: AggregatorImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn aggregator_aggregate<T: AggregatorImpl>( unsafe extern "C" fn aggregator_aggregate<T: AggregatorImpl>(
@ -945,7 +945,7 @@ unsafe extern "C" fn aggregator_aggregate<T: AggregatorImpl>(
imp.aggregate(wrap.unsafe_cast_ref(), from_glib(timeout)) imp.aggregate(wrap.unsafe_cast_ref(), from_glib(timeout))
.into() .into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn aggregator_start<T: AggregatorImpl>( unsafe extern "C" fn aggregator_start<T: AggregatorImpl>(
@ -964,7 +964,7 @@ unsafe extern "C" fn aggregator_start<T: AggregatorImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn aggregator_stop<T: AggregatorImpl>( unsafe extern "C" fn aggregator_stop<T: AggregatorImpl>(
@ -983,7 +983,7 @@ unsafe extern "C" fn aggregator_stop<T: AggregatorImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn aggregator_get_next_time<T: AggregatorImpl>( unsafe extern "C" fn aggregator_get_next_time<T: AggregatorImpl>(
@ -996,7 +996,7 @@ unsafe extern "C" fn aggregator_get_next_time<T: AggregatorImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), gst::CLOCK_TIME_NONE, { gst::panic_to_error!(&wrap, &imp.panicked(), gst::CLOCK_TIME_NONE, {
imp.next_time(wrap.unsafe_cast_ref()) imp.next_time(wrap.unsafe_cast_ref())
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn aggregator_create_new_pad<T: AggregatorImpl>( unsafe extern "C" fn aggregator_create_new_pad<T: AggregatorImpl>(
@ -1044,7 +1044,7 @@ unsafe extern "C" fn aggregator_update_src_caps<T: AggregatorImpl>(
Err(err) => err.into(), Err(err) => err.into(),
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn aggregator_fixate_src_caps<T: AggregatorImpl>( unsafe extern "C" fn aggregator_fixate_src_caps<T: AggregatorImpl>(
@ -1078,7 +1078,7 @@ unsafe extern "C" fn aggregator_negotiated_src_caps<T: AggregatorImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
#[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg(any(feature = "v1_18", feature = "dox"))]
@ -1093,7 +1093,7 @@ unsafe extern "C" fn aggregator_negotiate<T: AggregatorImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.negotiate(wrap.unsafe_cast_ref()) imp.negotiate(wrap.unsafe_cast_ref())
}) })
.to_glib() .into_glib()
} }
#[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg(any(feature = "v1_18", feature = "dox"))]

View file

@ -117,7 +117,7 @@ unsafe extern "C" fn aggregator_pad_flush<T: AggregatorPadImpl>(
let res: gst::FlowReturn = imp let res: gst::FlowReturn = imp
.flush(wrap.unsafe_cast_ref(), &from_glib_borrow(aggregator)) .flush(wrap.unsafe_cast_ref(), &from_glib_borrow(aggregator))
.into(); .into();
res.to_glib() res.into_glib()
} }
unsafe extern "C" fn aggregator_pad_skip_buffer<T: AggregatorPadImpl>( unsafe extern "C" fn aggregator_pad_skip_buffer<T: AggregatorPadImpl>(
@ -134,5 +134,5 @@ unsafe extern "C" fn aggregator_pad_skip_buffer<T: AggregatorPadImpl>(
&from_glib_borrow(aggregator), &from_glib_borrow(aggregator),
&from_glib_borrow(buffer), &from_glib_borrow(buffer),
) )
.to_glib() .into_glib()
} }

View file

@ -184,9 +184,9 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
let res = from_glib(f( let res = from_glib(f(
element.unsafe_cast_ref::<BaseParse>().to_glib_none().0, element.unsafe_cast_ref::<BaseParse>().to_glib_none().0,
src_val.format().to_glib(), src_val.format().into_glib(),
src_val.to_raw_value(), src_val.to_raw_value(),
dest_format.to_glib(), dest_format.into_glib(),
dest_val.as_mut_ptr(), dest_val.as_mut_ptr(),
)); ));
(res, dest_val) (res, dest_val)
@ -235,7 +235,7 @@ unsafe extern "C" fn base_parse_start<T: BaseParseImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_parse_stop<T: BaseParseImpl>( unsafe extern "C" fn base_parse_stop<T: BaseParseImpl>(
@ -254,7 +254,7 @@ unsafe extern "C" fn base_parse_stop<T: BaseParseImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_parse_set_sink_caps<T: BaseParseImpl>( unsafe extern "C" fn base_parse_set_sink_caps<T: BaseParseImpl>(
@ -275,7 +275,7 @@ unsafe extern "C" fn base_parse_set_sink_caps<T: BaseParseImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_parse_handle_frame<T: BaseParseImpl>( unsafe extern "C" fn base_parse_handle_frame<T: BaseParseImpl>(
@ -299,7 +299,7 @@ unsafe extern "C" fn base_parse_handle_frame<T: BaseParseImpl>(
} }
Err(flow) => gst::FlowReturn::from_error(flow), Err(flow) => gst::FlowReturn::from_error(flow),
} }
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_parse_convert<T: BaseParseImpl>( unsafe extern "C" fn base_parse_convert<T: BaseParseImpl>(
@ -325,5 +325,5 @@ unsafe extern "C" fn base_parse_convert<T: BaseParseImpl>(
} }
_ => false, _ => false,
} }
.to_glib() .into_glib()
} }

View file

@ -432,7 +432,7 @@ unsafe extern "C" fn base_sink_start<T: BaseSinkImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_sink_stop<T: BaseSinkImpl>( unsafe extern "C" fn base_sink_stop<T: BaseSinkImpl>(
@ -451,7 +451,7 @@ unsafe extern "C" fn base_sink_stop<T: BaseSinkImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_sink_render<T: BaseSinkImpl>( unsafe extern "C" fn base_sink_render<T: BaseSinkImpl>(
@ -466,7 +466,7 @@ unsafe extern "C" fn base_sink_render<T: BaseSinkImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.render(wrap.unsafe_cast_ref(), &buffer).into() imp.render(wrap.unsafe_cast_ref(), &buffer).into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_sink_prepare<T: BaseSinkImpl>( unsafe extern "C" fn base_sink_prepare<T: BaseSinkImpl>(
@ -481,7 +481,7 @@ unsafe extern "C" fn base_sink_prepare<T: BaseSinkImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.prepare(wrap.unsafe_cast_ref(), &buffer).into() imp.prepare(wrap.unsafe_cast_ref(), &buffer).into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_sink_render_list<T: BaseSinkImpl>( unsafe extern "C" fn base_sink_render_list<T: BaseSinkImpl>(
@ -496,7 +496,7 @@ unsafe extern "C" fn base_sink_render_list<T: BaseSinkImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.render_list(wrap.unsafe_cast_ref(), &list).into() imp.render_list(wrap.unsafe_cast_ref(), &list).into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_sink_prepare_list<T: BaseSinkImpl>( unsafe extern "C" fn base_sink_prepare_list<T: BaseSinkImpl>(
@ -511,7 +511,7 @@ unsafe extern "C" fn base_sink_prepare_list<T: BaseSinkImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.prepare_list(wrap.unsafe_cast_ref(), &list).into() imp.prepare_list(wrap.unsafe_cast_ref(), &list).into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_sink_query<T: BaseSinkImpl>( unsafe extern "C" fn base_sink_query<T: BaseSinkImpl>(
@ -526,7 +526,7 @@ unsafe extern "C" fn base_sink_query<T: BaseSinkImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
BaseSinkImpl::query(imp, wrap.unsafe_cast_ref(), query) BaseSinkImpl::query(imp, wrap.unsafe_cast_ref(), query)
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_sink_event<T: BaseSinkImpl>( unsafe extern "C" fn base_sink_event<T: BaseSinkImpl>(
@ -540,7 +540,7 @@ unsafe extern "C" fn base_sink_event<T: BaseSinkImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.event(wrap.unsafe_cast_ref(), from_glib_full(event_ptr)) imp.event(wrap.unsafe_cast_ref(), from_glib_full(event_ptr))
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_sink_get_caps<T: BaseSinkImpl>( unsafe extern "C" fn base_sink_get_caps<T: BaseSinkImpl>(
@ -577,7 +577,7 @@ unsafe extern "C" fn base_sink_set_caps<T: BaseSinkImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_sink_fixate<T: BaseSinkImpl>( unsafe extern "C" fn base_sink_fixate<T: BaseSinkImpl>(
@ -611,7 +611,7 @@ unsafe extern "C" fn base_sink_unlock<T: BaseSinkImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_sink_unlock_stop<T: BaseSinkImpl>( unsafe extern "C" fn base_sink_unlock_stop<T: BaseSinkImpl>(
@ -630,5 +630,5 @@ unsafe extern "C" fn base_sink_unlock_stop<T: BaseSinkImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }

View file

@ -616,7 +616,7 @@ unsafe extern "C" fn base_src_start<T: BaseSrcImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_src_stop<T: BaseSrcImpl>( unsafe extern "C" fn base_src_stop<T: BaseSrcImpl>(
@ -635,7 +635,7 @@ unsafe extern "C" fn base_src_stop<T: BaseSrcImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_src_is_seekable<T: BaseSrcImpl>( unsafe extern "C" fn base_src_is_seekable<T: BaseSrcImpl>(
@ -648,7 +648,7 @@ unsafe extern "C" fn base_src_is_seekable<T: BaseSrcImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.is_seekable(wrap.unsafe_cast_ref()) imp.is_seekable(wrap.unsafe_cast_ref())
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_src_get_size<T: BaseSrcImpl>( unsafe extern "C" fn base_src_get_size<T: BaseSrcImpl>(
@ -668,7 +668,7 @@ unsafe extern "C" fn base_src_get_size<T: BaseSrcImpl>(
None => false, None => false,
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_src_get_times<T: BaseSrcImpl>( unsafe extern "C" fn base_src_get_times<T: BaseSrcImpl>(
@ -687,8 +687,8 @@ unsafe extern "C" fn base_src_get_times<T: BaseSrcImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), (), { gst::panic_to_error!(&wrap, &imp.panicked(), (), {
let (start_, stop_) = imp.times(wrap.unsafe_cast_ref(), buffer); let (start_, stop_) = imp.times(wrap.unsafe_cast_ref(), buffer);
*start = start_.to_glib(); *start = start_.into_glib();
*stop = stop_.to_glib(); *stop = stop_.into_glib();
}); });
} }
@ -707,7 +707,7 @@ unsafe extern "C" fn base_src_fill<T: BaseSrcImpl>(
imp.fill(wrap.unsafe_cast_ref(), offset, length, buffer) imp.fill(wrap.unsafe_cast_ref(), offset, length, buffer)
.into() .into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_src_alloc<T: BaseSrcImpl>( unsafe extern "C" fn base_src_alloc<T: BaseSrcImpl>(
@ -732,7 +732,7 @@ unsafe extern "C" fn base_src_alloc<T: BaseSrcImpl>(
Err(err) => gst::FlowReturn::from(err), Err(err) => gst::FlowReturn::from(err),
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_src_create<T: BaseSrcImpl>( unsafe extern "C" fn base_src_create<T: BaseSrcImpl>(
@ -818,7 +818,7 @@ unsafe extern "C" fn base_src_create<T: BaseSrcImpl>(
Err(err) => gst::FlowReturn::from(err), Err(err) => gst::FlowReturn::from(err),
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_src_do_seek<T: BaseSrcImpl>( unsafe extern "C" fn base_src_do_seek<T: BaseSrcImpl>(
@ -836,7 +836,7 @@ unsafe extern "C" fn base_src_do_seek<T: BaseSrcImpl>(
res res
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_src_query<T: BaseSrcImpl>( unsafe extern "C" fn base_src_query<T: BaseSrcImpl>(
@ -851,7 +851,7 @@ unsafe extern "C" fn base_src_query<T: BaseSrcImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
BaseSrcImpl::query(imp, wrap.unsafe_cast_ref(), query) BaseSrcImpl::query(imp, wrap.unsafe_cast_ref(), query)
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_src_event<T: BaseSrcImpl>( unsafe extern "C" fn base_src_event<T: BaseSrcImpl>(
@ -865,7 +865,7 @@ unsafe extern "C" fn base_src_event<T: BaseSrcImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.event(wrap.unsafe_cast_ref(), &from_glib_borrow(event_ptr)) imp.event(wrap.unsafe_cast_ref(), &from_glib_borrow(event_ptr))
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_src_get_caps<T: BaseSrcImpl>( unsafe extern "C" fn base_src_get_caps<T: BaseSrcImpl>(
@ -900,7 +900,7 @@ unsafe extern "C" fn base_src_negotiate<T: BaseSrcImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_src_set_caps<T: BaseSrcImpl>( unsafe extern "C" fn base_src_set_caps<T: BaseSrcImpl>(
@ -921,7 +921,7 @@ unsafe extern "C" fn base_src_set_caps<T: BaseSrcImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_src_fixate<T: BaseSrcImpl>( unsafe extern "C" fn base_src_fixate<T: BaseSrcImpl>(
@ -955,7 +955,7 @@ unsafe extern "C" fn base_src_unlock<T: BaseSrcImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_src_unlock_stop<T: BaseSrcImpl>( unsafe extern "C" fn base_src_unlock_stop<T: BaseSrcImpl>(
@ -974,5 +974,5 @@ unsafe extern "C" fn base_src_unlock_stop<T: BaseSrcImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }

View file

@ -362,7 +362,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.map(|f| { .map(|f| {
from_glib_full(f( from_glib_full(f(
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0, element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
direction.to_glib(), direction.into_glib(),
caps.to_glib_none().0, caps.to_glib_none().0,
filter.to_glib_none().0, filter.to_glib_none().0,
)) ))
@ -384,7 +384,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
match (*parent_class).fixate_caps { match (*parent_class).fixate_caps {
Some(f) => from_glib_full(f( Some(f) => from_glib_full(f(
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0, element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
direction.to_glib(), direction.into_glib(),
caps.to_glib_none().0, caps.to_glib_none().0,
othercaps.into_ptr(), othercaps.into_ptr(),
)), )),
@ -433,7 +433,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.map(|f| { .map(|f| {
from_glib(f( from_glib(f(
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0, element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
direction.to_glib(), direction.into_glib(),
caps.to_glib_none().0, caps.to_glib_none().0,
)) ))
}) })
@ -455,7 +455,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
.map(|f| { .map(|f| {
from_glib(f( from_glib(f(
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0, element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
direction.to_glib(), direction.into_glib(),
query.as_mut_ptr(), query.as_mut_ptr(),
)) ))
}) })
@ -480,7 +480,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
let mut othersize = mem::MaybeUninit::uninit(); let mut othersize = mem::MaybeUninit::uninit();
let res: bool = from_glib(f( let res: bool = from_glib(f(
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0, element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
direction.to_glib(), direction.into_glib(),
caps.to_glib_none().0, caps.to_glib_none().0,
size, size,
othercaps.to_glib_none().0, othercaps.to_glib_none().0,
@ -764,7 +764,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
gst::FlowReturn::from_glib(f( gst::FlowReturn::from_glib(f(
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0, element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
is_discont.to_glib(), is_discont.into_glib(),
inbuf.into_ptr(), inbuf.into_ptr(),
)) ))
.into_result() .into_result()
@ -856,8 +856,8 @@ unsafe impl<T: BaseTransformImpl> IsSubclassable<T> for BaseTransform {
klass.submit_input_buffer = Some(base_transform_submit_input_buffer::<T>); klass.submit_input_buffer = Some(base_transform_submit_input_buffer::<T>);
klass.generate_output = Some(base_transform_generate_output::<T>); klass.generate_output = Some(base_transform_generate_output::<T>);
klass.passthrough_on_same_caps = T::PASSTHROUGH_ON_SAME_CAPS.to_glib(); klass.passthrough_on_same_caps = T::PASSTHROUGH_ON_SAME_CAPS.into_glib();
klass.transform_ip_on_passthrough = T::TRANSFORM_IP_ON_PASSTHROUGH.to_glib(); klass.transform_ip_on_passthrough = T::TRANSFORM_IP_ON_PASSTHROUGH.into_glib();
match T::MODE { match T::MODE {
BaseTransformMode::AlwaysInPlace => { BaseTransformMode::AlwaysInPlace => {
@ -909,7 +909,7 @@ unsafe extern "C" fn base_transform_start<T: BaseTransformImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_transform_stop<T: BaseTransformImpl>( unsafe extern "C" fn base_transform_stop<T: BaseTransformImpl>(
@ -928,7 +928,7 @@ unsafe extern "C" fn base_transform_stop<T: BaseTransformImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_transform_transform_caps<T: BaseTransformImpl>( unsafe extern "C" fn base_transform_transform_caps<T: BaseTransformImpl>(
@ -998,7 +998,7 @@ unsafe extern "C" fn base_transform_set_caps<T: BaseTransformImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_transform_accept_caps<T: BaseTransformImpl>( unsafe extern "C" fn base_transform_accept_caps<T: BaseTransformImpl>(
@ -1017,7 +1017,7 @@ unsafe extern "C" fn base_transform_accept_caps<T: BaseTransformImpl>(
&from_glib_borrow(caps), &from_glib_borrow(caps),
) )
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_transform_query<T: BaseTransformImpl>( unsafe extern "C" fn base_transform_query<T: BaseTransformImpl>(
@ -1037,7 +1037,7 @@ unsafe extern "C" fn base_transform_query<T: BaseTransformImpl>(
gst::QueryRef::from_mut_ptr(query), gst::QueryRef::from_mut_ptr(query),
) )
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_transform_transform_size<T: BaseTransformImpl>( unsafe extern "C" fn base_transform_transform_size<T: BaseTransformImpl>(
@ -1067,7 +1067,7 @@ unsafe extern "C" fn base_transform_transform_size<T: BaseTransformImpl>(
None => false, None => false,
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_transform_get_unit_size<T: BaseTransformImpl>( unsafe extern "C" fn base_transform_get_unit_size<T: BaseTransformImpl>(
@ -1088,7 +1088,7 @@ unsafe extern "C" fn base_transform_get_unit_size<T: BaseTransformImpl>(
None => false, None => false,
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_transform_prepare_output_buffer<T: BaseTransformImpl>( unsafe extern "C" fn base_transform_prepare_output_buffer<T: BaseTransformImpl>(
@ -1116,7 +1116,7 @@ unsafe extern "C" fn base_transform_prepare_output_buffer<T: BaseTransformImpl>(
Err(err) => err.into(), Err(err) => err.into(),
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_transform_sink_event<T: BaseTransformImpl>( unsafe extern "C" fn base_transform_sink_event<T: BaseTransformImpl>(
@ -1130,7 +1130,7 @@ unsafe extern "C" fn base_transform_sink_event<T: BaseTransformImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_transform_src_event<T: BaseTransformImpl>( unsafe extern "C" fn base_transform_src_event<T: BaseTransformImpl>(
@ -1144,7 +1144,7 @@ unsafe extern "C" fn base_transform_src_event<T: BaseTransformImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_transform_transform<T: BaseTransformImpl>( unsafe extern "C" fn base_transform_transform<T: BaseTransformImpl>(
@ -1164,7 +1164,7 @@ unsafe extern "C" fn base_transform_transform<T: BaseTransformImpl>(
) )
.into() .into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_transform_transform_ip<T: BaseTransformImpl>( unsafe extern "C" fn base_transform_transform_ip<T: BaseTransformImpl>(
@ -1187,7 +1187,7 @@ unsafe extern "C" fn base_transform_transform_ip<T: BaseTransformImpl>(
.into() .into()
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_transform_transform_meta<T: BaseTransformImpl>( unsafe extern "C" fn base_transform_transform_meta<T: BaseTransformImpl>(
@ -1210,7 +1210,7 @@ unsafe extern "C" fn base_transform_transform_meta<T: BaseTransformImpl>(
inbuf, inbuf,
) )
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_transform_copy_metadata<T: BaseTransformImpl>( unsafe extern "C" fn base_transform_copy_metadata<T: BaseTransformImpl>(
@ -1245,7 +1245,7 @@ unsafe extern "C" fn base_transform_copy_metadata<T: BaseTransformImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_transform_before_transform<T: BaseTransformImpl>( unsafe extern "C" fn base_transform_before_transform<T: BaseTransformImpl>(
@ -1278,7 +1278,7 @@ unsafe extern "C" fn base_transform_submit_input_buffer<T: BaseTransformImpl>(
) )
.into() .into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn base_transform_generate_output<T: BaseTransformImpl>( unsafe extern "C" fn base_transform_generate_output<T: BaseTransformImpl>(
@ -1302,5 +1302,5 @@ unsafe extern "C" fn base_transform_generate_output<T: BaseTransformImpl>(
Err(err) => err.into(), Err(err) => err.into(),
} }
}) })
.to_glib() .into_glib()
} }

View file

@ -134,7 +134,7 @@ unsafe extern "C" fn push_src_fill<T: PushSrcImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
PushSrcImpl::fill(imp, wrap.unsafe_cast_ref(), buffer).into() PushSrcImpl::fill(imp, wrap.unsafe_cast_ref(), buffer).into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn push_src_alloc<T: PushSrcImpl>( unsafe extern "C" fn push_src_alloc<T: PushSrcImpl>(
@ -157,7 +157,7 @@ unsafe extern "C" fn push_src_alloc<T: PushSrcImpl>(
Err(err) => gst::FlowReturn::from(err), Err(err) => gst::FlowReturn::from(err),
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn push_src_create<T: PushSrcImpl>( unsafe extern "C" fn push_src_create<T: PushSrcImpl>(
@ -180,5 +180,5 @@ unsafe extern "C" fn push_src_create<T: PushSrcImpl>(
Err(err) => gst::FlowReturn::from(err), Err(err) => gst::FlowReturn::from(err),
} }
}) })
.to_glib() .into_glib()
} }

View file

@ -93,7 +93,7 @@ impl Harness {
) { ) {
unsafe { unsafe {
let params = params.map(|p| p.as_ptr()).unwrap_or(ptr::null_mut()); 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( ffi::gst_harness_add_src(
self.0.as_ptr(), self.0.as_ptr(),
src_element_name.to_glib_none().0, 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( ffi::gst_harness_add_src_harness(
self.0.as_ptr(), self.0.as_ptr(),
src_harness.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( ffi::gst_harness_add_src_parse(
self.0.as_ptr(), self.0.as_ptr(),
launchline.to_glib_none().0, 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) { pub fn set_drop_buffers(&mut self, drop_buffers: bool) {
unsafe { 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) { pub fn set_forwarding(&mut self, forwarding: bool) {
unsafe { 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> { pub fn set_time(&mut self, time: gst::ClockTime) -> Result<(), glib::BoolError> {
unsafe { unsafe {
glib::result_from_gboolean!( 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", "Failed to set time",
) )
} }
@ -397,7 +397,7 @@ impl Harness {
pub fn set_upstream_latency(&mut self, latency: gst::ClockTime) { pub fn set_upstream_latency(&mut self, latency: gst::ClockTime) {
unsafe { 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());
} }
} }

View file

@ -23,6 +23,6 @@ impl GLDisplayEGL {
} }
pub unsafe fn from_native(display_type: GLDisplayType, display: uintptr_t) -> gpointer { 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)
} }
} }

View file

@ -18,14 +18,14 @@ impl GLContext {
from_glib_full(ffi::gst_gl_context_new_wrapped( from_glib_full(ffi::gst_gl_context_new_wrapped(
display.as_ref().to_glib_none().0, display.as_ref().to_glib_none().0,
handle, handle,
context_type.to_glib(), context_type.into_glib(),
available_apis.to_glib(), available_apis.into_glib(),
)) ))
} }
pub fn current_gl_context(context_type: GLPlatform) -> uintptr_t { pub fn current_gl_context(context_type: GLPlatform) -> uintptr_t {
skip_assert_initialized!(); 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( pub fn proc_address_with_platform(
@ -36,8 +36,8 @@ impl GLContext {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
ffi::gst_gl_context_get_proc_address_with_platform( ffi::gst_gl_context_get_proc_address_with_platform(
context_type.to_glib(), context_type.into_glib(),
gl_api.to_glib(), gl_api.into_glib(),
name.to_glib_none().0, name.to_glib_none().0,
) as uintptr_t ) as uintptr_t
} }

View file

@ -41,8 +41,8 @@ impl GLMemoryRef {
ffi::gst_gl_memory_copy_into( ffi::gst_gl_memory_copy_into(
mut_override(&self.0), mut_override(&self.0),
tex_id, tex_id,
target.to_glib(), target.into_glib(),
tex_format.to_glib(), tex_format.into_glib(),
width, width,
height, height,
), ),
@ -68,8 +68,8 @@ impl GLMemoryRef {
ffi::gst_gl_memory_copy_teximage( ffi::gst_gl_memory_copy_teximage(
mut_override(&self.0), mut_override(&self.0),
tex_id, tex_id,
out_target.to_glib(), out_target.into_glib(),
out_tex_format.to_glib(), out_tex_format.into_glib(),
out_width, out_width,
out_height, out_height,
), ),

View file

@ -137,7 +137,7 @@ unsafe extern "C" fn gl_set_caps<T: GLBaseFilterImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn gl_start<T: GLBaseFilterImpl>( unsafe extern "C" fn gl_start<T: GLBaseFilterImpl>(
@ -156,7 +156,7 @@ unsafe extern "C" fn gl_start<T: GLBaseFilterImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn gl_stop<T: GLBaseFilterImpl>(ptr: *mut GstGLBaseFilter) { unsafe extern "C" fn gl_stop<T: GLBaseFilterImpl>(ptr: *mut GstGLBaseFilter) {

View file

@ -217,7 +217,7 @@ impl<T: GLFilterImpl> GLFilterImplExt for T {
from_glib_full(f( from_glib_full(f(
filter.unsafe_cast_ref::<GLFilter>().to_glib_none().0, filter.unsafe_cast_ref::<GLFilter>().to_glib_none().0,
direction.to_glib(), direction.into_glib(),
caps.to_glib_none().0, caps.to_glib_none().0,
filter_caps.to_glib_none().0, filter_caps.to_glib_none().0,
)) ))
@ -276,7 +276,7 @@ unsafe extern "C" fn filter<T: GLFilterImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn filter_texture<T: GLFilterImpl>( unsafe extern "C" fn filter_texture<T: GLFilterImpl>(
@ -301,7 +301,7 @@ unsafe extern "C" fn filter_texture<T: GLFilterImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn init_fbo<T: GLFilterImpl>(ptr: *mut GstGLFilter) -> glib::ffi::gboolean { unsafe extern "C" fn init_fbo<T: GLFilterImpl>(ptr: *mut GstGLFilter) -> glib::ffi::gboolean {
@ -318,7 +318,7 @@ unsafe extern "C" fn init_fbo<T: GLFilterImpl>(ptr: *mut GstGLFilter) -> glib::f
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn set_caps<T: GLFilterImpl>( unsafe extern "C" fn set_caps<T: GLFilterImpl>(
@ -344,7 +344,7 @@ unsafe extern "C" fn set_caps<T: GLFilterImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn transform_internal_caps<T: GLFilterImpl>( unsafe extern "C" fn transform_internal_caps<T: GLFilterImpl>(

View file

@ -21,7 +21,7 @@ impl NetClientClock {
name.0, name.0,
remote_address.to_glib_none().0, remote_address.to_glib_none().0,
remote_port, remote_port,
base_time.to_glib(), base_time.into_glib(),
)) ))
.unsafe_cast() .unsafe_cast()
} }
@ -32,7 +32,7 @@ impl NetClientClock {
name.0, name.0,
remote_address.to_glib_none().0, remote_address.to_glib_none().0,
remote_port, remote_port,
base_time.to_glib(), base_time.into_glib(),
)) ))
.unsafe_cast() .unsafe_cast()
} }

View file

@ -21,7 +21,7 @@ impl NtpClock {
name.0, name.0,
remote_address.to_glib_none().0, remote_address.to_glib_none().0,
remote_port, remote_port,
base_time.to_glib(), base_time.into_glib(),
)) ))
.unsafe_cast() .unsafe_cast()
} }
@ -32,7 +32,7 @@ impl NtpClock {
name.0, name.0,
remote_address.to_glib_none().0, remote_address.to_glib_none().0,
remote_port, remote_port,
base_time.to_glib(), base_time.into_glib(),
)) ))
.unsafe_cast() .unsafe_cast()
} }

View file

@ -33,7 +33,7 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
unsafe { unsafe {
ffi::gst_encoding_profile_set_allow_dynamic_output( ffi::gst_encoding_profile_set_allow_dynamic_output(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
allow_dynamic_output.to_glib(), allow_dynamic_output.into_glib(),
); );
} }
} }
@ -52,7 +52,7 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
unsafe { unsafe {
ffi::gst_encoding_profile_set_enabled( ffi::gst_encoding_profile_set_enabled(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
enabled.to_glib(), enabled.into_glib(),
); );
} }
} }
@ -193,7 +193,7 @@ impl EncodingVideoProfile {
unsafe { unsafe {
ffi::gst_encoding_video_profile_set_variableframerate( ffi::gst_encoding_video_profile_set_variableframerate(
self.to_glib_none().0, self.to_glib_none().0,
variableframerate.to_glib(), variableframerate.into_glib(),
); );
} }
} }

View file

@ -72,9 +72,10 @@ unsafe extern "C" fn video_renderer_create_video_sink<T: PlayerVideoRendererImpl
let sink_ptr: *mut gst::ffi::GstElement = sink.to_glib_none().0; let sink_ptr: *mut gst::ffi::GstElement = sink.to_glib_none().0;
let old_sink_ptr = let old_sink_ptr = glib::gobject_ffi::g_object_get_qdata(
glib::gobject_ffi::g_object_get_qdata(video_renderer as *mut _, VIDEO_SINK_QUARK.to_glib()) video_renderer as *mut _,
as *mut gst::ffi::GstElement; VIDEO_SINK_QUARK.into_glib(),
) as *mut gst::ffi::GstElement;
if !old_sink_ptr.is_null() && old_sink_ptr != sink_ptr { if !old_sink_ptr.is_null() && old_sink_ptr != sink_ptr {
panic!("Video sink must not change"); panic!("Video sink must not change");
} }
@ -85,7 +86,7 @@ unsafe extern "C" fn video_renderer_create_video_sink<T: PlayerVideoRendererImpl
glib::gobject_ffi::g_object_set_qdata_full( glib::gobject_ffi::g_object_set_qdata_full(
video_renderer as *mut _, video_renderer as *mut _,
VIDEO_SINK_QUARK.to_glib(), VIDEO_SINK_QUARK.into_glib(),
glib::gobject_ffi::g_object_ref(sink_ptr as *mut _) as *mut _, glib::gobject_ffi::g_object_ref(sink_ptr as *mut _) as *mut _,
Some(unref), Some(unref),
); );

View file

@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::translate::{from_glib, from_glib_full, FromGlibPtrFull, ToGlib}; use glib::translate::{from_glib, from_glib_full, FromGlibPtrFull, IntoGlib};
use std::fmt; use std::fmt;
use std::marker::PhantomData; use std::marker::PhantomData;
use std::mem; use std::mem;
@ -88,7 +88,7 @@ impl<'a> RTPBuffer<'a, Writable> {
pub fn set_marker(&mut self, m: bool) { pub fn set_marker(&mut self, m: bool) {
unsafe { 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) { 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( pub fn add_extension_onebyte_header(

View file

@ -102,5 +102,5 @@ where
false false
} }
} }
.to_glib() .into_glib()
} }

View file

@ -13,7 +13,7 @@ unsafe extern "C" fn trampoline_watch<F: FnMut(&RTSPSessionPool) -> Continue + S
func: gpointer, func: gpointer,
) -> gboolean { ) -> gboolean {
let func: &RefCell<F> = &*(func as *const RefCell<F>); let func: &RefCell<F> = &*(func as *const RefCell<F>);
(&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< unsafe extern "C" fn destroy_closure_watch<
@ -53,7 +53,7 @@ impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExtManual for O {
into_raw_watch(func), into_raw_watch(func),
Some(destroy_closure_watch::<F>), Some(destroy_closure_watch::<F>),
); );
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 { if let Some(name) = name {
glib::ffi::g_source_set_name(source, name.to_glib_none().0); glib::ffi::g_source_set_name(source, name.to_glib_none().0);

View file

@ -9,7 +9,7 @@ gst::mini_object_wrapper!(RTSPThread, RTSPThreadRef, ffi::GstRTSPThread, || {
impl RTSPThread { impl RTSPThread {
pub fn new(type_: crate::RTSPThreadType) -> Option<Self> { pub fn new(type_: crate::RTSPThreadType) -> Option<Self> {
assert_initialized_main_thread!(); 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())) }
} }
} }

View file

@ -942,7 +942,7 @@ unsafe extern "C" fn client_params_set<T: RTSPClientImpl>(
let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr); let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr);
imp.params_set(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) imp.params_set(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx))
.to_glib() .into_glib()
} }
unsafe extern "C" fn client_params_get<T: RTSPClientImpl>( unsafe extern "C" fn client_params_get<T: RTSPClientImpl>(
@ -954,7 +954,7 @@ unsafe extern "C" fn client_params_get<T: RTSPClientImpl>(
let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr); let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr);
imp.params_get(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) imp.params_get(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx))
.to_glib() .into_glib()
} }
unsafe extern "C" fn client_make_path_from_uri<T: RTSPClientImpl>( unsafe extern "C" fn client_make_path_from_uri<T: RTSPClientImpl>(
@ -1159,7 +1159,7 @@ unsafe extern "C" fn client_pre_options_request<T: RTSPClientImpl>(
let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr); let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr);
imp.pre_options_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) imp.pre_options_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx))
.to_glib() .into_glib()
} }
unsafe extern "C" fn client_pre_describe_request<T: RTSPClientImpl>( unsafe extern "C" fn client_pre_describe_request<T: RTSPClientImpl>(
@ -1171,7 +1171,7 @@ unsafe extern "C" fn client_pre_describe_request<T: RTSPClientImpl>(
let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr); let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr);
imp.pre_describe_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) imp.pre_describe_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx))
.to_glib() .into_glib()
} }
unsafe extern "C" fn client_pre_setup_request<T: RTSPClientImpl>( unsafe extern "C" fn client_pre_setup_request<T: RTSPClientImpl>(
@ -1183,7 +1183,7 @@ unsafe extern "C" fn client_pre_setup_request<T: RTSPClientImpl>(
let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr); let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr);
imp.pre_setup_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) imp.pre_setup_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx))
.to_glib() .into_glib()
} }
unsafe extern "C" fn client_pre_play_request<T: RTSPClientImpl>( unsafe extern "C" fn client_pre_play_request<T: RTSPClientImpl>(
@ -1195,7 +1195,7 @@ unsafe extern "C" fn client_pre_play_request<T: RTSPClientImpl>(
let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr); let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr);
imp.pre_play_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) imp.pre_play_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx))
.to_glib() .into_glib()
} }
unsafe extern "C" fn client_pre_pause_request<T: RTSPClientImpl>( unsafe extern "C" fn client_pre_pause_request<T: RTSPClientImpl>(
@ -1207,7 +1207,7 @@ unsafe extern "C" fn client_pre_pause_request<T: RTSPClientImpl>(
let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr); let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr);
imp.pre_pause_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) imp.pre_pause_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx))
.to_glib() .into_glib()
} }
unsafe extern "C" fn client_pre_teardown_request<T: RTSPClientImpl>( unsafe extern "C" fn client_pre_teardown_request<T: RTSPClientImpl>(
@ -1219,7 +1219,7 @@ unsafe extern "C" fn client_pre_teardown_request<T: RTSPClientImpl>(
let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr); let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr);
imp.pre_teardown_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) 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<T: RTSPClientImpl>( unsafe extern "C" fn client_pre_set_parameter_request<T: RTSPClientImpl>(
@ -1231,7 +1231,7 @@ unsafe extern "C" fn client_pre_set_parameter_request<T: RTSPClientImpl>(
let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr); let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr);
imp.pre_set_parameter_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) 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<T: RTSPClientImpl>( unsafe extern "C" fn client_pre_get_parameter_request<T: RTSPClientImpl>(
@ -1243,7 +1243,7 @@ unsafe extern "C" fn client_pre_get_parameter_request<T: RTSPClientImpl>(
let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr); let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr);
imp.pre_get_parameter_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) 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<T: RTSPClientImpl>( unsafe extern "C" fn client_pre_announce_request<T: RTSPClientImpl>(
@ -1255,7 +1255,7 @@ unsafe extern "C" fn client_pre_announce_request<T: RTSPClientImpl>(
let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr); let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr);
imp.pre_announce_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) imp.pre_announce_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx))
.to_glib() .into_glib()
} }
unsafe extern "C" fn client_pre_record_request<T: RTSPClientImpl>( unsafe extern "C" fn client_pre_record_request<T: RTSPClientImpl>(
@ -1267,5 +1267,5 @@ unsafe extern "C" fn client_pre_record_request<T: RTSPClientImpl>(
let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr); let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr);
imp.pre_record_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx)) imp.pre_record_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx))
.to_glib() .into_glib()
} }

View file

@ -408,7 +408,7 @@ impl<T: RTSPMediaImpl> RTSPMediaImplExt for T {
if let Some(f) = (*parent_class).target_state { if let Some(f) = (*parent_class).target_state {
f( f(
media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0, media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0,
state.to_glib(), state.into_glib(),
); );
} }
} }
@ -421,7 +421,7 @@ impl<T: RTSPMediaImpl> RTSPMediaImplExt for T {
if let Some(f) = (*parent_class).new_state { if let Some(f) = (*parent_class).new_state {
f( f(
media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0, media.unsafe_cast_ref::<RTSPMedia>().to_glib_none().0,
state.to_glib(), state.into_glib(),
); );
} }
} }
@ -487,7 +487,7 @@ unsafe extern "C" fn media_handle_message<T: RTSPMediaImpl>(
let wrap: Borrowed<RTSPMedia> = from_glib_borrow(ptr); let wrap: Borrowed<RTSPMedia> = from_glib_borrow(ptr);
imp.handle_message(wrap.unsafe_cast_ref(), gst::MessageRef::from_ptr(message)) imp.handle_message(wrap.unsafe_cast_ref(), gst::MessageRef::from_ptr(message))
.to_glib() .into_glib()
} }
unsafe extern "C" fn media_prepare<T: RTSPMediaImpl>( unsafe extern "C" fn media_prepare<T: RTSPMediaImpl>(
@ -565,7 +565,7 @@ unsafe extern "C" fn media_query_position<T: RTSPMediaImpl>(
match imp.query_position(wrap.unsafe_cast_ref()) { match imp.query_position(wrap.unsafe_cast_ref()) {
Some(pos) => { Some(pos) => {
*position = pos.to_glib() as i64; *position = pos.into_glib() as i64;
glib::ffi::GTRUE glib::ffi::GTRUE
} }
None => glib::ffi::GFALSE, None => glib::ffi::GFALSE,
@ -582,7 +582,7 @@ unsafe extern "C" fn media_query_stop<T: RTSPMediaImpl>(
match imp.query_stop(wrap.unsafe_cast_ref()) { match imp.query_stop(wrap.unsafe_cast_ref()) {
Some(s) => { Some(s) => {
*stop = s.to_glib() as i64; *stop = s.into_glib() as i64;
glib::ffi::GTRUE glib::ffi::GTRUE
} }
None => glib::ffi::GFALSE, None => glib::ffi::GFALSE,

View file

@ -301,7 +301,7 @@ unsafe extern "C" fn factory_create_pipeline<T: RTSPMediaFactoryImpl>(
// FIXME We somehow need to ensure the pipeline actually stays alive... // FIXME We somehow need to ensure the pipeline actually stays alive...
glib::gobject_ffi::g_object_set_qdata_full( glib::gobject_ffi::g_object_set_qdata_full(
media as *mut _, media as *mut _,
PIPELINE_QUARK.to_glib(), PIPELINE_QUARK.into_glib(),
pipeline as *mut _, pipeline as *mut _,
Some(transmute::<_, unsafe extern "C" fn(glib::ffi::gpointer)>( Some(transmute::<_, unsafe extern "C" fn(glib::ffi::gpointer)>(
glib::gobject_ffi::g_object_unref as *const (), glib::gobject_ffi::g_object_unref as *const (),

View file

@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file. // 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 glib::ToSendValue;
use std::i32; use std::i32;
@ -18,7 +18,7 @@ pub fn convert_sample(
let ret = ffi::gst_video_convert_sample( let ret = ffi::gst_video_convert_sample(
sample.to_glib_none().0, sample.to_glib_none().0,
caps.to_glib_none().0, caps.to_glib_none().0,
timeout.to_glib(), timeout.into_glib(),
&mut error, &mut error,
); );
@ -93,7 +93,7 @@ unsafe fn convert_sample_async_unsafe<F>(
ffi::gst_video_convert_sample_async( ffi::gst_video_convert_sample_async(
sample.to_glib_none().0, sample.to_glib_none().0,
caps.to_glib_none().0, caps.to_glib_none().0,
timeout.to_glib(), timeout.into_glib(),
Some(convert_sample_async_trampoline::<F>), Some(convert_sample_async_trampoline::<F>),
Box::into_raw(user_data) as glib::ffi::gpointer, Box::into_raw(user_data) as glib::ffi::gpointer,
Some(convert_sample_async_free::<F>), Some(convert_sample_async_free::<F>),
@ -172,7 +172,7 @@ pub fn guess_framerate(duration: gst::ClockTime) -> Option<gst::Fraction> {
let mut dest_n = mem::MaybeUninit::uninit(); let mut dest_n = mem::MaybeUninit::uninit();
let mut dest_d = mem::MaybeUninit::uninit(); let mut dest_d = mem::MaybeUninit::uninit();
let res: bool = from_glib(ffi::gst_video_guess_framerate( let res: bool = from_glib(ffi::gst_video_guess_framerate(
duration.to_glib(), duration.into_glib(),
dest_n.as_mut_ptr(), dest_n.as_mut_ptr(),
dest_d.as_mut_ptr(), dest_d.as_mut_ptr(),
)); ));
@ -290,7 +290,7 @@ mod tests {
let formats: Vec<ffi::GstVideoFormat> = let formats: Vec<ffi::GstVideoFormat> =
[crate::VideoFormat::Nv12, crate::VideoFormat::Nv16] [crate::VideoFormat::Nv12, crate::VideoFormat::Nv16]
.iter() .iter()
.map(|f| f.to_glib()) .map(|f| f.into_glib())
.collect(); .collect();
let caps = ffi::gst_video_make_raw_caps(formats.as_ptr(), formats.len() as u32); let caps = ffi::gst_video_make_raw_caps(formats.as_ptr(), formats.len() as u32);
from_glib_full(caps) from_glib_full(caps)

View file

@ -339,7 +339,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
element.unsafe_cast_ref::<VideoDecoder>().to_glib_none().0, element.unsafe_cast_ref::<VideoDecoder>().to_glib_none().0,
frame.to_glib_none().0, frame.to_glib_none().0,
adapter.to_glib_none().0, adapter.to_glib_none().0,
at_eos.to_glib(), at_eos.into_glib(),
)) ))
}) })
.unwrap_or(gst::FlowReturn::Ok) .unwrap_or(gst::FlowReturn::Ok)
@ -577,7 +577,7 @@ unsafe extern "C" fn video_decoder_open<T: VideoDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_decoder_close<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_close<T: VideoDecoderImpl>(
@ -596,7 +596,7 @@ unsafe extern "C" fn video_decoder_close<T: VideoDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_decoder_start<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_start<T: VideoDecoderImpl>(
@ -615,7 +615,7 @@ unsafe extern "C" fn video_decoder_start<T: VideoDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_decoder_stop<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_stop<T: VideoDecoderImpl>(
@ -634,7 +634,7 @@ unsafe extern "C" fn video_decoder_stop<T: VideoDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_decoder_finish<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_finish<T: VideoDecoderImpl>(
@ -647,7 +647,7 @@ unsafe extern "C" fn video_decoder_finish<T: VideoDecoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.finish(wrap.unsafe_cast_ref()).into() imp.finish(wrap.unsafe_cast_ref()).into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_decoder_drain<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_drain<T: VideoDecoderImpl>(
@ -660,7 +660,7 @@ unsafe extern "C" fn video_decoder_drain<T: VideoDecoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.drain(wrap.unsafe_cast_ref()).into() imp.drain(wrap.unsafe_cast_ref()).into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_decoder_set_format<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_set_format<T: VideoDecoderImpl>(
@ -682,7 +682,7 @@ unsafe extern "C" fn video_decoder_set_format<T: VideoDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_decoder_parse<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_parse<T: VideoDecoderImpl>(
@ -703,7 +703,7 @@ unsafe extern "C" fn video_decoder_parse<T: VideoDecoderImpl>(
imp.parse(wrap.unsafe_cast_ref(), &wrap_frame, &wrap_adapter, at_eos) imp.parse(wrap.unsafe_cast_ref(), &wrap_frame, &wrap_adapter, at_eos)
.into() .into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_decoder_handle_frame<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_handle_frame<T: VideoDecoderImpl>(
@ -718,7 +718,7 @@ unsafe extern "C" fn video_decoder_handle_frame<T: VideoDecoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into() imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_decoder_flush<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_flush<T: VideoDecoderImpl>(
@ -731,7 +731,7 @@ unsafe extern "C" fn video_decoder_flush<T: VideoDecoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
VideoDecoderImpl::flush(imp, wrap.unsafe_cast_ref()) VideoDecoderImpl::flush(imp, wrap.unsafe_cast_ref())
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_decoder_negotiate<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_negotiate<T: VideoDecoderImpl>(
@ -750,7 +750,7 @@ unsafe extern "C" fn video_decoder_negotiate<T: VideoDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_decoder_getcaps<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_getcaps<T: VideoDecoderImpl>(
@ -784,7 +784,7 @@ unsafe extern "C" fn video_decoder_sink_event<T: VideoDecoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_decoder_sink_query<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_sink_query<T: VideoDecoderImpl>(
@ -798,7 +798,7 @@ unsafe extern "C" fn video_decoder_sink_query<T: VideoDecoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) 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<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_src_event<T: VideoDecoderImpl>(
@ -812,7 +812,7 @@ unsafe extern "C" fn video_decoder_src_event<T: VideoDecoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_decoder_src_query<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_src_query<T: VideoDecoderImpl>(
@ -826,7 +826,7 @@ unsafe extern "C" fn video_decoder_src_query<T: VideoDecoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) 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<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_propose_allocation<T: VideoDecoderImpl>(
@ -847,7 +847,7 @@ unsafe extern "C" fn video_decoder_propose_allocation<T: VideoDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_decoder_decide_allocation<T: VideoDecoderImpl>( unsafe extern "C" fn video_decoder_decide_allocation<T: VideoDecoderImpl>(
@ -868,5 +868,5 @@ unsafe extern "C" fn video_decoder_decide_allocation<T: VideoDecoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }

View file

@ -509,7 +509,7 @@ unsafe extern "C" fn video_encoder_open<T: VideoEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_encoder_close<T: VideoEncoderImpl>( unsafe extern "C" fn video_encoder_close<T: VideoEncoderImpl>(
@ -528,7 +528,7 @@ unsafe extern "C" fn video_encoder_close<T: VideoEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_encoder_start<T: VideoEncoderImpl>( unsafe extern "C" fn video_encoder_start<T: VideoEncoderImpl>(
@ -547,7 +547,7 @@ unsafe extern "C" fn video_encoder_start<T: VideoEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_encoder_stop<T: VideoEncoderImpl>( unsafe extern "C" fn video_encoder_stop<T: VideoEncoderImpl>(
@ -566,7 +566,7 @@ unsafe extern "C" fn video_encoder_stop<T: VideoEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_encoder_finish<T: VideoEncoderImpl>( unsafe extern "C" fn video_encoder_finish<T: VideoEncoderImpl>(
@ -579,7 +579,7 @@ unsafe extern "C" fn video_encoder_finish<T: VideoEncoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.finish(wrap.unsafe_cast_ref()).into() imp.finish(wrap.unsafe_cast_ref()).into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_encoder_set_format<T: VideoEncoderImpl>( unsafe extern "C" fn video_encoder_set_format<T: VideoEncoderImpl>(
@ -601,7 +601,7 @@ unsafe extern "C" fn video_encoder_set_format<T: VideoEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_encoder_handle_frame<T: VideoEncoderImpl>( unsafe extern "C" fn video_encoder_handle_frame<T: VideoEncoderImpl>(
@ -616,7 +616,7 @@ unsafe extern "C" fn video_encoder_handle_frame<T: VideoEncoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into() imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into()
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_encoder_flush<T: VideoEncoderImpl>( unsafe extern "C" fn video_encoder_flush<T: VideoEncoderImpl>(
@ -629,7 +629,7 @@ unsafe extern "C" fn video_encoder_flush<T: VideoEncoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
VideoEncoderImpl::flush(imp, wrap.unsafe_cast_ref()) VideoEncoderImpl::flush(imp, wrap.unsafe_cast_ref())
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_encoder_negotiate<T: VideoEncoderImpl>( unsafe extern "C" fn video_encoder_negotiate<T: VideoEncoderImpl>(
@ -648,7 +648,7 @@ unsafe extern "C" fn video_encoder_negotiate<T: VideoEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_encoder_getcaps<T: VideoEncoderImpl>( unsafe extern "C" fn video_encoder_getcaps<T: VideoEncoderImpl>(
@ -682,7 +682,7 @@ unsafe extern "C" fn video_encoder_sink_event<T: VideoEncoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_encoder_sink_query<T: VideoEncoderImpl>( unsafe extern "C" fn video_encoder_sink_query<T: VideoEncoderImpl>(
@ -696,7 +696,7 @@ unsafe extern "C" fn video_encoder_sink_query<T: VideoEncoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) 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<T: VideoEncoderImpl>( unsafe extern "C" fn video_encoder_src_event<T: VideoEncoderImpl>(
@ -710,7 +710,7 @@ unsafe extern "C" fn video_encoder_src_event<T: VideoEncoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_encoder_src_query<T: VideoEncoderImpl>( unsafe extern "C" fn video_encoder_src_query<T: VideoEncoderImpl>(
@ -724,7 +724,7 @@ unsafe extern "C" fn video_encoder_src_query<T: VideoEncoderImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) 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<T: VideoEncoderImpl>( unsafe extern "C" fn video_encoder_propose_allocation<T: VideoEncoderImpl>(
@ -745,7 +745,7 @@ unsafe extern "C" fn video_encoder_propose_allocation<T: VideoEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }
unsafe extern "C" fn video_encoder_decide_allocation<T: VideoEncoderImpl>( unsafe extern "C" fn video_encoder_decide_allocation<T: VideoEncoderImpl>(
@ -766,5 +766,5 @@ unsafe extern "C" fn video_encoder_decide_allocation<T: VideoEncoderImpl>(
} }
} }
}) })
.to_glib() .into_glib()
} }

View file

@ -74,5 +74,5 @@ unsafe extern "C" fn video_sink_show_frame<T: VideoSinkImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.show_frame(wrap.unsafe_cast_ref(), &buffer).into() imp.show_frame(wrap.unsafe_cast_ref(), &buffer).into()
}) })
.to_glib() .into_glib()
} }

View file

@ -92,7 +92,7 @@ impl<'a> VideoCodecFrame<'a> {
pub fn set_dts(&mut self, dts: gst::ClockTime) { pub fn set_dts(&mut self, dts: gst::ClockTime) {
unsafe { 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) { pub fn set_pts(&mut self, pts: gst::ClockTime) {
unsafe { 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) { pub fn set_duration(&mut self, duration: gst::ClockTime) {
unsafe { unsafe {
(*self.to_glib_none().0).duration = duration.to_glib(); (*self.to_glib_none().0).duration = duration.into_glib();
} }
} }

View file

@ -2,7 +2,7 @@
use std::mem; use std::mem;
use glib::translate::ToGlib; use glib::translate::IntoGlib;
impl crate::VideoColorMatrix { impl crate::VideoColorMatrix {
pub fn kr_kb(&self) -> Result<(f64, f64), glib::BoolError> { pub fn kr_kb(&self) -> Result<(f64, f64), glib::BoolError> {
@ -12,7 +12,7 @@ impl crate::VideoColorMatrix {
let mut kb = mem::MaybeUninit::uninit(); let mut kb = mem::MaybeUninit::uninit();
glib::result_from_gboolean!( glib::result_from_gboolean!(
ffi::gst_video_color_matrix_get_Kr_Kb( ffi::gst_video_color_matrix_get_Kr_Kb(
self.to_glib(), self.into_glib(),
kr.as_mut_ptr(), kr.as_mut_ptr(),
kb.as_mut_ptr(), kb.as_mut_ptr(),
), ),

View file

@ -173,8 +173,8 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
unsafe { unsafe {
ffi::gst_video_decoder_set_latency( ffi::gst_video_decoder_set_latency(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
min_latency.to_glib(), min_latency.into_glib(),
max_latency.to_glib(), max_latency.into_glib(),
); );
} }
} }
@ -246,7 +246,7 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
}; };
ffi::gst_video_decoder_set_output_state( ffi::gst_video_decoder_set_output_state(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
fmt.to_glib(), fmt.into_glib(),
width, width,
height, height,
reference, reference,
@ -277,8 +277,8 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
}; };
ffi::gst_video_decoder_set_interlaced_output_state( ffi::gst_video_decoder_set_interlaced_output_state(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
fmt.to_glib(), fmt.into_glib(),
mode.to_glib(), mode.into_glib(),
width, width,
height, height,
reference, reference,
@ -325,7 +325,7 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
from_glib(_gst_video_decoder_error( from_glib(_gst_video_decoder_error(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
weight, weight,
T::domain().to_glib(), T::domain().into_glib(),
code.code(), code.code(),
message.to_glib_full(), message.to_glib_full(),
debug.to_glib_full(), debug.to_glib_full(),

View file

@ -124,8 +124,8 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
unsafe { unsafe {
ffi::gst_video_encoder_set_latency( ffi::gst_video_encoder_set_latency(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
min_latency.to_glib(), min_latency.into_glib(),
max_latency.to_glib(), max_latency.into_glib(),
); );
} }
} }

View file

@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file. // 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 glib::ToSendValue;
use std::mem; use std::mem;
@ -41,7 +41,7 @@ macro_rules! event_builder_generic_impl {
unsafe { unsafe {
let event = $new_fn(&mut self); let event = $new_fn(&mut self);
if let Some(seqnum) = self.seqnum { 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 { 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| { event_builder_generic_impl!(|s: &mut Self| {
ffi::gst_video_event_new_downstream_force_key_unit( ffi::gst_video_event_new_downstream_force_key_unit(
s.timestamp.to_glib(), s.timestamp.into_glib(),
s.stream_time.to_glib(), s.stream_time.into_glib(),
s.running_time.to_glib(), s.running_time.into_glib(),
s.all_headers.to_glib(), s.all_headers.into_glib(),
s.count, s.count,
) )
}); });
@ -220,8 +220,8 @@ impl<'a> UpstreamForceKeyUnitEventBuilder<'a> {
event_builder_generic_impl!(|s: &mut Self| { event_builder_generic_impl!(|s: &mut Self| {
ffi::gst_video_event_new_upstream_force_key_unit( ffi::gst_video_event_new_upstream_force_key_unit(
s.running_time.to_glib(), s.running_time.into_glib(),
s.all_headers.to_glib(), s.all_headers.into_glib(),
s.count, s.count,
) )
}); });
@ -308,7 +308,7 @@ impl<'a> StillFrameEventBuilder<'a> {
} }
event_builder_generic_impl!(|s: &mut Self| ffi::gst_video_event_new_still_frame( event_builder_generic_impl!(|s: &mut Self| ffi::gst_video_event_new_still_frame(
s.in_still.to_glib() s.in_still.into_glib()
)); ));
} }

View file

@ -4,7 +4,7 @@ use once_cell::sync::Lazy;
use std::ffi::CStr; use std::ffi::CStr;
use std::str; use std::str;
use glib::translate::{from_glib, FromGlib, ToGlib}; use glib::translate::{from_glib, FromGlib, IntoGlib};
#[cfg(feature = "v1_18")] #[cfg(feature = "v1_18")]
pub static VIDEO_FORMATS_ALL: Lazy<Box<[crate::VideoFormat]>> = Lazy::new(|| unsafe { pub static VIDEO_FORMATS_ALL: Lazy<Box<[crate::VideoFormat]>> = Lazy::new(|| unsafe {
@ -269,11 +269,11 @@ impl FromGlib<i32> for VideoEndianness {
} }
} }
impl ToGlib for VideoEndianness { impl IntoGlib for VideoEndianness {
type GlibType = i32; type GlibType = i32;
fn to_glib(&self) -> i32 { fn into_glib(self) -> i32 {
match *self { match self {
VideoEndianness::LittleEndian => 1234, VideoEndianness::LittleEndian => 1234,
VideoEndianness::BigEndian => 4321, VideoEndianness::BigEndian => 4321,
_ => 0, _ => 0,
@ -297,7 +297,7 @@ impl crate::VideoFormat {
from_glib(ffi::gst_video_format_from_masks( from_glib(ffi::gst_video_format_from_masks(
depth as i32, depth as i32,
bpp as i32, bpp as i32,
endianness.to_glib(), endianness.into_glib(),
red_mask, red_mask,
blue_mask, blue_mask,
green_mask, green_mask,
@ -312,7 +312,7 @@ impl crate::VideoFormat {
} }
unsafe { unsafe {
CStr::from_ptr( CStr::from_ptr(
ffi::gst_video_format_to_string(self.to_glib()) ffi::gst_video_format_to_string(self.into_glib())
.as_ref() .as_ref()
.expect("gst_video_format_to_string returned NULL"), .expect("gst_video_format_to_string returned NULL"),
) )

View file

@ -5,7 +5,7 @@ use std::ffi::CStr;
use std::fmt; use std::fmt;
use std::str; use std::str;
use glib::translate::{from_glib, ToGlib}; use glib::translate::{from_glib, IntoGlib};
pub struct VideoFormatInfo(&'static ffi::GstVideoFormatInfo); pub struct VideoFormatInfo(&'static ffi::GstVideoFormatInfo);
@ -14,7 +14,7 @@ impl VideoFormatInfo {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { 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()); assert!(!info.is_null());
VideoFormatInfo(&*info) VideoFormatInfo(&*info)
@ -201,7 +201,7 @@ impl VideoFormatInfo {
(self.0.unpack_func.as_ref().unwrap())( (self.0.unpack_func.as_ref().unwrap())(
self.0, self.0,
flags.to_glib(), flags.into_glib(),
dest.as_mut_ptr() as *mut _, dest.as_mut_ptr() as *mut _,
src_ptr.as_ptr() as *const _, src_ptr.as_ptr() as *const _,
stride.as_ptr() as *const i32, stride.as_ptr() as *const i32,
@ -277,12 +277,12 @@ impl VideoFormatInfo {
(self.0.pack_func.as_ref().unwrap())( (self.0.pack_func.as_ref().unwrap())(
self.0, self.0,
flags.to_glib(), flags.into_glib(),
src.as_ptr() as *mut _, src.as_ptr() as *mut _,
src_stride, src_stride,
dest_ptr.as_mut_ptr() as *mut _, dest_ptr.as_mut_ptr() as *mut _,
dest_stride.as_ptr() as *const i32, dest_stride.as_ptr() as *const i32,
chroma_site.to_glib(), chroma_site.into_glib(),
y, y,
width, width,
); );

View file

@ -1,7 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::translate::{ 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, ToGlibPtrMut,
}; };
use gst::prelude::*; use gst::prelude::*;
@ -23,11 +23,11 @@ pub enum VideoColorRange {
} }
#[doc(hidden)] #[doc(hidden)]
impl ToGlib for VideoColorRange { impl IntoGlib for VideoColorRange {
type GlibType = ffi::GstVideoColorRange; type GlibType = ffi::GstVideoColorRange;
fn to_glib(&self) -> ffi::GstVideoColorRange { fn into_glib(self) -> ffi::GstVideoColorRange {
match *self { match self {
VideoColorRange::Unknown => ffi::GST_VIDEO_COLOR_RANGE_UNKNOWN, VideoColorRange::Unknown => ffi::GST_VIDEO_COLOR_RANGE_UNKNOWN,
VideoColorRange::Range0255 => ffi::GST_VIDEO_COLOR_RANGE_0_255, VideoColorRange::Range0255 => ffi::GST_VIDEO_COLOR_RANGE_0_255,
VideoColorRange::Range16235 => ffi::GST_VIDEO_COLOR_RANGE_16_235, 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 { impl glib::value::ToValue for VideoColorRange {
fn to_value(&self) -> glib::Value { fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<VideoColorRange>(); let mut value = glib::Value::for_value_type::<VideoColorRange>();
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 value
} }
@ -92,10 +92,10 @@ impl VideoColorimetry {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let colorimetry = ffi::GstVideoColorimetry { let colorimetry = ffi::GstVideoColorimetry {
range: range.to_glib(), range: range.into_glib(),
matrix: matrix.to_glib(), matrix: matrix.into_glib(),
transfer: transfer.to_glib(), transfer: transfer.into_glib(),
primaries: primaries.to_glib(), primaries: primaries.into_glib(),
}; };
VideoColorimetry(colorimetry) VideoColorimetry(colorimetry)
@ -179,9 +179,9 @@ impl crate::VideoChromaSite {
unsafe { unsafe {
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(all(feature = "v1_20", not(feature = "dox")))] { 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 { } 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<crate::VideoMultiviewFramePacking> for crate::VideoMultiviewMode { impl From<crate::VideoMultiviewFramePacking> for crate::VideoMultiviewMode {
fn from(v: crate::VideoMultiviewFramePacking) -> Self { fn from(v: crate::VideoMultiviewFramePacking) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { from_glib(v.to_glib()) } unsafe { from_glib(v.into_glib()) }
} }
} }
@ -233,7 +233,7 @@ impl std::convert::TryFrom<crate::VideoMultiviewMode> for crate::VideoMultiviewF
) -> Result<crate::VideoMultiviewFramePacking, glib::BoolError> { ) -> Result<crate::VideoMultiviewFramePacking, glib::BoolError> {
skip_assert_initialized!(); 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 { if let crate::VideoMultiviewFramePacking::__Unknown(_) = v2 {
Err(glib::bool_error!("Invalid frame packing mode")) 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 { from_glib(if let Some(interlace_mode) = self.interlace_mode {
ffi::gst_video_info_set_interlaced_format( ffi::gst_video_info_set_interlaced_format(
info.as_mut_ptr(), info.as_mut_ptr(),
self.format.to_glib(), self.format.into_glib(),
interlace_mode.to_glib(), interlace_mode.into_glib(),
self.width, self.width,
self.height, self.height,
) )
} else { } else {
ffi::gst_video_info_set_format( ffi::gst_video_info_set_format(
info.as_mut_ptr(), info.as_mut_ptr(),
self.format.to_glib(), self.format.into_glib(),
self.width, self.width,
self.height, self.height,
) )
@ -324,7 +324,7 @@ impl<'a> VideoInfoBuilder<'a> {
let res: bool = { let res: bool = {
let res = from_glib(ffi::gst_video_info_set_format( let res = from_glib(ffi::gst_video_info_set_format(
info.as_mut_ptr(), info.as_mut_ptr(),
self.format.to_glib(), self.format.into_glib(),
self.width, self.width,
self.height, self.height,
)); ));
@ -332,7 +332,7 @@ impl<'a> VideoInfoBuilder<'a> {
if res { if res {
if let Some(interlace_mode) = self.interlace_mode { if let Some(interlace_mode) = self.interlace_mode {
let info = info.as_mut_ptr(); 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) { let res = if gst::version() < (1, 11, 1, 0) {
ffi::gst_video_info_set_format( ffi::gst_video_info_set_format(
info.as_mut_ptr(), info.as_mut_ptr(),
self.format.to_glib(), self.format.into_glib(),
self.width, self.width,
self.height, self.height,
); );
@ -354,7 +354,7 @@ impl<'a> VideoInfoBuilder<'a> {
} else { } else {
from_glib(ffi::gst_video_info_set_format( from_glib(ffi::gst_video_info_set_format(
info.as_mut_ptr(), info.as_mut_ptr(),
self.format.to_glib(), self.format.into_glib(),
self.width, self.width,
self.height, self.height,
)) ))
@ -363,7 +363,7 @@ impl<'a> VideoInfoBuilder<'a> {
if res { if res {
if let Some(interlace_mode) = self.interlace_mode { if let Some(interlace_mode) = self.interlace_mode {
let info = info.as_mut_ptr(); 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 { if let Some(flags) = self.flags {
info.flags = flags.to_glib(); info.flags = flags.into_glib();
} }
if let Some(size) = self.size { if let Some(size) = self.size {
@ -395,7 +395,7 @@ impl<'a> VideoInfoBuilder<'a> {
} }
if let Some(chroma_site) = self.chroma_site { 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 { if let Some(colorimetry) = self.colorimetry {
@ -432,18 +432,18 @@ impl<'a> VideoInfoBuilder<'a> {
if let Some(multiview_mode) = self.multiview_mode { if let Some(multiview_mode) = self.multiview_mode {
let ptr = &mut info.ABI._gst_reserved as *mut _ as *mut i32; 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 { if let Some(multiview_flags) = self.multiview_flags {
let ptr = &mut info.ABI._gst_reserved as *mut _ as *mut u32; 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"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
if let Some(field_order) = self.field_order { if let Some(field_order) = self.field_order {
let ptr = &mut info.ABI._gst_reserved as *mut _ as *mut i32; 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)) Ok(VideoInfo(info))
@ -756,9 +756,9 @@ impl VideoInfo {
let mut dest_val = mem::MaybeUninit::uninit(); let mut dest_val = mem::MaybeUninit::uninit();
if from_glib(ffi::gst_video_info_convert( if from_glib(ffi::gst_video_info_convert(
&self.0 as *const _ as *mut _, &self.0 as *const _ as *mut _,
src_val.format().to_glib(), src_val.format().into_glib(),
src_val.to_raw_value(), src_val.to_raw_value(),
U::default_format().to_glib(), U::default_format().into_glib(),
dest_val.as_mut_ptr(), dest_val.as_mut_ptr(),
)) { )) {
Some(U::from_raw(U::default_format(), dest_val.assume_init())) Some(U::from_raw(U::default_format(), dest_val.assume_init()))
@ -780,9 +780,9 @@ impl VideoInfo {
let mut dest_val = mem::MaybeUninit::uninit(); let mut dest_val = mem::MaybeUninit::uninit();
if from_glib(ffi::gst_video_info_convert( if from_glib(ffi::gst_video_info_convert(
&self.0 as *const _ as *mut _, &self.0 as *const _ as *mut _,
src_val.format().to_glib(), src_val.format().into_glib(),
src_val.to_raw_value(), src_val.to_raw_value(),
dest_fmt.to_glib(), dest_fmt.into_glib(),
dest_val.as_mut_ptr(), dest_val.as_mut_ptr(),
)) { )) {
Some(gst::GenericFormattedValue::new( Some(gst::GenericFormattedValue::new(
@ -968,7 +968,7 @@ impl crate::VideoFieldOrder {
} }
unsafe { unsafe {
CStr::from_ptr( 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() .as_ref()
.expect("gst_video_field_order_to_string returned NULL"), .expect("gst_video_field_order_to_string returned NULL"),
) )

View file

@ -3,7 +3,7 @@
use std::fmt; use std::fmt;
use std::ptr; 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::*; use gst::prelude::*;
#[repr(transparent)] #[repr(transparent)]
@ -43,8 +43,8 @@ impl VideoMeta {
unsafe { unsafe {
let meta = ffi::gst_buffer_add_video_meta( let meta = ffi::gst_buffer_add_video_meta(
buffer.as_mut_ptr(), buffer.as_mut_ptr(),
flags.to_glib(), flags.into_glib(),
format.to_glib(), format.into_glib(),
width, width,
height, height,
); );
@ -93,8 +93,8 @@ impl VideoMeta {
unsafe { unsafe {
let meta = ffi::gst_buffer_add_video_meta_full( let meta = ffi::gst_buffer_add_video_meta_full(
buffer.as_mut_ptr(), buffer.as_mut_ptr(),
flags.to_glib(), flags.into_glib(),
format.to_glib(), format.into_glib(),
width, width,
height, height,
n_planes, n_planes,
@ -559,7 +559,7 @@ impl VideoCaptionMeta {
unsafe { unsafe {
let meta = ffi::gst_buffer_add_video_caption_meta( let meta = ffi::gst_buffer_add_video_caption_meta(
buffer.as_mut_ptr(), buffer.as_mut_ptr(),
caption_type.to_glib(), caption_type.into_glib(),
data.as_ptr(), data.as_ptr(),
data.len(), data.len(),
); );
@ -629,8 +629,8 @@ impl VideoAFDMeta {
let meta = ffi::gst_buffer_add_video_afd_meta( let meta = ffi::gst_buffer_add_video_afd_meta(
buffer.as_mut_ptr(), buffer.as_mut_ptr(),
field, field,
spec.to_glib(), spec.into_glib(),
afd.to_glib(), afd.into_glib(),
); );
Self::from_mut_ptr(buffer, meta) Self::from_mut_ptr(buffer, meta)
@ -700,7 +700,7 @@ impl VideoBarMeta {
let meta = ffi::gst_buffer_add_video_bar_meta( let meta = ffi::gst_buffer_add_video_bar_meta(
buffer.as_mut_ptr(), buffer.as_mut_ptr(),
field, field,
is_letterbox.to_glib(), is_letterbox.into_glib(),
bar_data1, bar_data1,
bar_data2, bar_data2,
); );

View file

@ -3,7 +3,7 @@
use std::fmt; use std::fmt;
use std::mem; 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!( gst::mini_object_wrapper!(
VideoOverlayRectangle, VideoOverlayRectangle,
@ -46,7 +46,7 @@ impl VideoOverlayRectangle {
render_y, render_y,
render_width, render_width,
render_height, render_height,
flags.to_glib(), flags.into_glib(),
)) ))
} }
} }
@ -119,7 +119,7 @@ impl VideoOverlayRectangleRef {
unsafe { unsafe {
from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_unscaled_raw( from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_unscaled_raw(
self.as_mut_ptr(), self.as_mut_ptr(),
flags.to_glib(), flags.into_glib(),
)) ))
} }
} }
@ -128,7 +128,7 @@ impl VideoOverlayRectangleRef {
unsafe { unsafe {
from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_unscaled_ayuv( from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_unscaled_ayuv(
self.as_mut_ptr(), self.as_mut_ptr(),
flags.to_glib(), flags.into_glib(),
)) ))
} }
} }
@ -137,7 +137,7 @@ impl VideoOverlayRectangleRef {
unsafe { unsafe {
from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_unscaled_argb( from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_unscaled_argb(
self.as_mut_ptr(), self.as_mut_ptr(),
flags.to_glib(), flags.into_glib(),
)) ))
} }
} }
@ -146,7 +146,7 @@ impl VideoOverlayRectangleRef {
unsafe { unsafe {
from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_raw( from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_raw(
self.as_mut_ptr(), self.as_mut_ptr(),
flags.to_glib(), flags.into_glib(),
)) ))
} }
} }
@ -155,7 +155,7 @@ impl VideoOverlayRectangleRef {
unsafe { unsafe {
from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_ayuv( from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_ayuv(
self.as_mut_ptr(), self.as_mut_ptr(),
flags.to_glib(), flags.into_glib(),
)) ))
} }
} }
@ -164,7 +164,7 @@ impl VideoOverlayRectangleRef {
unsafe { unsafe {
from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_argb( from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_argb(
self.as_mut_ptr(), self.as_mut_ptr(),
flags.to_glib(), flags.into_glib(),
)) ))
} }
} }

View file

@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file. // 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)] #[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub struct VideoRectangle { pub struct VideoRectangle {
@ -42,7 +42,7 @@ pub fn center_video_rectangle(
h: dst.h, h: dst.h,
}; };
unsafe { 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) VideoRectangle::new(result.x, result.y, result.w, result.h)
} }

View file

@ -49,7 +49,7 @@ impl VideoTimeCode {
*fps.numer() as u32, *fps.numer() as u32,
*fps.denom() as u32, *fps.denom() as u32,
latest_daily_jam.to_glib_none().0, latest_daily_jam.to_glib_none().0,
flags.to_glib(), flags.into_glib(),
hours, hours,
minutes, minutes,
seconds, seconds,
@ -78,7 +78,7 @@ impl VideoTimeCode {
*fps.numer() as u32, *fps.numer() as u32,
*fps.denom() as u32, *fps.denom() as u32,
dt.to_glib_none().0, dt.to_glib_none().0,
flags.to_glib(), flags.into_glib(),
field_count, field_count,
); );
@ -100,7 +100,7 @@ impl VideoTimeCode {
} }
pub fn set_flags(&mut self, flags: VideoTimeCodeFlags) { 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) { pub fn set_hours(&mut self, hours: u32) {

View file

@ -11,7 +11,7 @@ impl WebRTCSessionDescription {
unsafe { unsafe {
let mut sdp = mem::ManuallyDrop::new(sdp); let mut sdp = mem::ManuallyDrop::new(sdp);
from_glib_full(ffi::gst_webrtc_session_description_new( from_glib_full(ffi::gst_webrtc_session_description_new(
type_.to_glib(), type_.into_glib(),
sdp.to_glib_none_mut().0, sdp.to_glib_none_mut().0,
)) ))
} }

View file

@ -33,7 +33,7 @@ impl AllocationParams {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let allocationparams = unsafe { let allocationparams = unsafe {
ffi::GstAllocationParams { ffi::GstAllocationParams {
flags: flags.to_glib(), flags: flags.into_glib(),
align, align,
prefix, prefix,
padding, padding,

View file

@ -116,7 +116,7 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
unsafe { unsafe {
from_glib_full(ffi::gst_bin_iterate_all_by_interface( from_glib_full(ffi::gst_bin_iterate_all_by_interface(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
iface.to_glib(), iface.into_glib(),
)) ))
} }
} }
@ -177,7 +177,7 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock);
(*ptr).flags |= flags.to_glib(); (*ptr).flags |= flags.into_glib();
} }
} }
@ -185,7 +185,7 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock);
(*ptr).flags &= !flags.to_glib(); (*ptr).flags &= !flags.into_glib();
} }
} }
@ -216,7 +216,7 @@ where
false false
} }
} }
.to_glib() .into_glib()
} }
#[cfg(test)] #[cfg(test)]

View file

@ -17,7 +17,7 @@ use crate::ClockTime;
use crate::Memory; use crate::Memory;
use crate::MemoryRef; 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 Readable {}
pub enum Writable {} pub enum Writable {}
@ -218,7 +218,7 @@ impl BufferRef {
unsafe { unsafe {
Option::<_>::from_glib_full(ffi::gst_buffer_copy_region( Option::<_>::from_glib_full(ffi::gst_buffer_copy_region(
self.as_mut_ptr(), self.as_mut_ptr(),
flags.to_glib(), flags.into_glib(),
offset, offset,
size_real, size_real,
)) ))
@ -239,7 +239,7 @@ impl BufferRef {
ffi::gst_buffer_copy_into( ffi::gst_buffer_copy_into(
dest.as_mut_ptr(), dest.as_mut_ptr(),
self.as_mut_ptr(), self.as_mut_ptr(),
flags.to_glib(), flags.into_glib(),
offset, offset,
size_real, size_real,
), ),
@ -344,7 +344,7 @@ impl BufferRef {
} }
pub fn set_pts(&mut self, pts: ClockTime) { 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 { pub fn dts(&self) -> ClockTime {
@ -352,7 +352,7 @@ impl BufferRef {
} }
pub fn set_dts(&mut self, dts: ClockTime) { 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 { pub fn dts_or_pts(&self) -> ClockTime {
@ -369,7 +369,7 @@ impl BufferRef {
} }
pub fn set_duration(&mut self, duration: ClockTime) { 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 { pub fn flags(&self) -> BufferFlags {
@ -386,7 +386,7 @@ impl BufferRef {
pub fn meta<T: MetaAPI>(&self) -> Option<MetaRef<T>> { pub fn meta<T: MetaAPI>(&self) -> Option<MetaRef<T>> {
unsafe { 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() { if meta.is_null() {
None None
} else { } else {
@ -397,7 +397,7 @@ impl BufferRef {
pub fn meta_mut<T: MetaAPI>(&mut self) -> Option<MetaRefMut<T, crate::meta::Standalone>> { pub fn meta_mut<T: MetaAPI>(&mut self) -> Option<MetaRefMut<T, crate::meta::Standalone>> {
unsafe { 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() { if meta.is_null() {
None None
} else { } else {
@ -423,7 +423,7 @@ impl BufferRef {
let func = user_data as *const _ as usize as *mut F; let func = user_data as *const _ as usize as *mut F;
let res = (*func)(Meta::from_ptr(BufferRef::from_ptr(buffer), *meta)); let res = (*func)(Meta::from_ptr(BufferRef::from_ptr(buffer), *meta));
res.to_glib() res.into_glib()
} }
unsafe { unsafe {
@ -456,9 +456,9 @@ impl BufferRef {
match res { match res {
Ok(false) | Err(false) => { Ok(false) | Err(false) => {
*meta = ptr::null_mut(); *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(),
} }
} }

View file

@ -6,7 +6,9 @@ use crate::BufferPool;
use crate::Structure; use crate::Structure;
use glib::prelude::*; 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::mem;
use std::ops; use std::ops;
@ -188,7 +190,7 @@ impl BufferPoolAcquireParams {
format: ffi::GST_FORMAT_UNDEFINED, format: ffi::GST_FORMAT_UNDEFINED,
start: -1, start: -1,
stop: -1, stop: -1,
flags: flags.to_glib(), flags: flags.into_glib(),
_gst_reserved: [ptr::null_mut(); 4], _gst_reserved: [ptr::null_mut(); 4],
}) })
} }
@ -201,10 +203,10 @@ impl BufferPoolAcquireParams {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
BufferPoolAcquireParams(ffi::GstBufferPoolAcquireParams { BufferPoolAcquireParams(ffi::GstBufferPoolAcquireParams {
format: start.format().to_glib(), format: start.format().into_glib(),
start: start.to_raw_value(), start: start.to_raw_value(),
stop: stop.to_raw_value(), stop: stop.to_raw_value(),
flags: flags.to_glib(), flags: flags.into_glib(),
_gst_reserved: [ptr::null_mut(); 4], _gst_reserved: [ptr::null_mut(); 4],
}) })
} }

View file

@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file. // 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::fmt;
use std::ptr; use std::ptr;
@ -105,7 +105,7 @@ impl BufferListRef {
let func = user_data as *const _ as usize as *mut F; let func = user_data as *const _ as usize as *mut F;
let res = (*func)(BufferRef::from_ptr(*buffer), idx); let res = (*func)(BufferRef::from_ptr(*buffer), idx);
res.to_glib() res.into_glib()
} }
unsafe { unsafe {
@ -136,7 +136,7 @@ impl BufferListRef {
match res { match res {
Ok(None) | Err(None) => { Ok(None) | Err(None) => {
*buffer = ptr::null_mut(); *buffer = ptr::null_mut();
res.is_ok().to_glib() res.is_ok().into_glib()
} }
Ok(Some(b)) => { Ok(Some(b)) => {
*buffer = b.into_ptr(); *buffer = b.into_ptr();

View file

@ -24,7 +24,7 @@ unsafe extern "C" fn trampoline_watch<F: FnMut(&Bus, &Message) -> Continue + 'st
func: gpointer, func: gpointer,
) -> gboolean { ) -> gboolean {
let func: &RefCell<F> = &*(func as *const RefCell<F>); let func: &RefCell<F> = &*(func as *const RefCell<F>);
(&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<F: FnMut(&Bus, &Message) -> Continue + 'static>( unsafe extern "C" fn destroy_closure_watch<F: FnMut(&Bus, &Message) -> Continue + 'static>(
@ -47,7 +47,7 @@ unsafe extern "C" fn trampoline_sync<
func: gpointer, func: gpointer,
) -> ffi::GstBusSyncReply { ) -> ffi::GstBusSyncReply {
let f: &F = &*(func as *const F); 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 { if res == ffi::GST_BUS_DROP {
ffi::gst_mini_object_unref(msg as *mut _); ffi::gst_mini_object_unref(msg as *mut _);
@ -74,7 +74,7 @@ fn into_raw_sync<F: Fn(&Bus, &Message) -> BusSyncReply + Send + Sync + 'static>(
impl Bus { impl Bus {
pub fn add_signal_watch_full(&self, priority: Priority) { pub fn add_signal_watch_full(&self, priority: Priority) {
unsafe { 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), into_raw_watch(func),
Some(destroy_closure_watch::<F>), Some(destroy_closure_watch::<F>),
); );
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 { if let Some(name) = name {
glib::ffi::g_source_set_name(source, name.to_glib_none().0); 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 // This is not thread-safe before 1.16.3, see
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/merge_requests/416 // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/merge_requests/416
if crate::version() < (1, 16, 3, 0) { 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() .is_null()
{ {
panic!("Bus sync handler can only be set once"); panic!("Bus sync handler can only be set once");
@ -170,7 +170,7 @@ impl Bus {
glib::gobject_ffi::g_object_set_qdata( glib::gobject_ffi::g_object_set_qdata(
bus as *mut _, bus as *mut _,
SET_ONCE_QUARK.to_glib(), SET_ONCE_QUARK.into_glib(),
1 as *mut _, 1 as *mut _,
); );
} }

View file

@ -9,7 +9,7 @@ use std::str;
use crate::CapsIntersectMode; 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; use glib::value::ToSendValue;
mini_object_wrapper!(Caps, CapsRef, ffi::GstCaps, || { ffi::gst_caps_get_type() }); 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( from_glib_full(ffi::gst_caps_intersect_full(
self.as_mut_ptr(), self.as_mut_ptr(),
other.as_mut_ptr(), other.as_mut_ptr(),
mode.to_glib(), mode.into_glib(),
)) ))
} }
} }

View file

@ -321,7 +321,7 @@ impl CapsFeaturesRef {
unsafe { unsafe {
from_glib(ffi::gst_caps_features_contains_id( from_glib(ffi::gst_caps_features_contains_id(
self.as_ptr(), 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) { 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) { 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 { pub fn iter(&self) -> Iter {

View file

@ -302,11 +302,11 @@ impl AtomicClockReturn {
} }
pub fn store(&self, val: ClockReturn) { 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 { 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( pub fn compare_exchange(
@ -317,8 +317,8 @@ impl AtomicClockReturn {
unsafe { unsafe {
self.0 self.0
.compare_exchange( .compare_exchange(
current.to_glib(), current.into_glib(),
new.to_glib(), new.into_glib(),
atomic::Ordering::SeqCst, atomic::Ordering::SeqCst,
atomic::Ordering::SeqCst, atomic::Ordering::SeqCst,
) )
@ -343,11 +343,11 @@ impl Clock {
unsafe { unsafe {
from_glib(ffi::gst_clock_adjust_with_calibration( from_glib(ffi::gst_clock_adjust_with_calibration(
ptr::null_mut(), ptr::null_mut(),
internal_target.to_glib(), internal_target.into_glib(),
cinternal.to_glib(), cinternal.into_glib(),
cexternal.to_glib(), cexternal.into_glib(),
cnum.to_glib(), cnum.into_glib(),
cdenom.to_glib(), cdenom.into_glib(),
)) ))
} }
} }
@ -363,11 +363,11 @@ impl Clock {
unsafe { unsafe {
from_glib(ffi::gst_clock_unadjust_with_calibration( from_glib(ffi::gst_clock_unadjust_with_calibration(
ptr::null_mut(), ptr::null_mut(),
external_target.to_glib(), external_target.into_glib(),
cinternal.to_glib(), cinternal.into_glib(),
cexternal.to_glib(), cexternal.into_glib(),
cnum.to_glib(), cnum.into_glib(),
cdenom.to_glib(), cdenom.into_glib(),
)) ))
} }
} }
@ -407,8 +407,8 @@ impl<O: IsA<Clock>> ClockExtManual for O {
unsafe { unsafe {
PeriodicClockId(from_glib_full(ffi::gst_clock_new_periodic_id( PeriodicClockId(from_glib_full(ffi::gst_clock_new_periodic_id(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
start_time.to_glib(), start_time.into_glib(),
interval.to_glib(), interval.into_glib(),
))) )))
} }
} }
@ -424,8 +424,8 @@ impl<O: IsA<Clock>> ClockExtManual for O {
let res: bool = from_glib(ffi::gst_clock_periodic_id_reinit( let res: bool = from_glib(ffi::gst_clock_periodic_id_reinit(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
id.to_glib_none().0, id.to_glib_none().0,
start_time.to_glib(), start_time.into_glib(),
interval.to_glib(), interval.into_glib(),
)); ));
if res { if res {
Ok(()) Ok(())
@ -441,7 +441,7 @@ impl<O: IsA<Clock>> ClockExtManual for O {
unsafe { unsafe {
SingleShotClockId(from_glib_full(ffi::gst_clock_new_single_shot_id( SingleShotClockId(from_glib_full(ffi::gst_clock_new_single_shot_id(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
time.to_glib(), time.into_glib(),
))) )))
} }
} }
@ -455,7 +455,7 @@ impl<O: IsA<Clock>> ClockExtManual for O {
let res: bool = from_glib(ffi::gst_clock_single_shot_id_reinit( let res: bool = from_glib(ffi::gst_clock_single_shot_id_reinit(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
id.to_glib_none().0, id.to_glib_none().0,
time.to_glib(), time.into_glib(),
)); ));
if res { if res {
Ok(()) Ok(())
@ -469,7 +469,7 @@ impl<O: IsA<Clock>> ClockExtManual for O {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock);
(*ptr).flags |= flags.to_glib(); (*ptr).flags |= flags.into_glib();
} }
} }
@ -477,7 +477,7 @@ impl<O: IsA<Clock>> ClockExtManual for O {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock);
(*ptr).flags &= !flags.to_glib(); (*ptr).flags &= !flags.into_glib();
} }
} }

View file

@ -283,10 +283,10 @@ impl fmt::Display for ClockTime {
} }
#[doc(hidden)] #[doc(hidden)]
impl ToGlib for ClockTime { impl IntoGlib for ClockTime {
type GlibType = ffi::GstClockTime; type GlibType = ffi::GstClockTime;
fn to_glib(&self) -> ffi::GstClockTime { fn into_glib(self) -> ffi::GstClockTime {
match self.0 { match self.0 {
None => ffi::GST_CLOCK_TIME_NONE, None => ffi::GST_CLOCK_TIME_NONE,
Some(v) => v, Some(v) => v,
@ -325,7 +325,9 @@ unsafe impl<'a> glib::value::FromValue<'a> for ClockTime {
impl glib::value::ToValue for ClockTime { impl glib::value::ToValue for ClockTime {
fn to_value(&self) -> glib::Value { fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<ClockTime>(); let mut value = glib::Value::for_value_type::<ClockTime>();
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 value
} }

View file

@ -3,7 +3,7 @@
use std::ffi::CStr; use std::ffi::CStr;
use std::fmt; 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; use crate::StructureRef;
@ -17,7 +17,7 @@ impl Context {
unsafe { unsafe {
from_glib_full(ffi::gst_context_new( from_glib_full(ffi::gst_context_new(
context_type.to_glib_none().0, context_type.to_glib_none().0,
persistent.to_glib(), persistent.into_glib(),
)) ))
} }
} }

View file

@ -26,8 +26,8 @@ impl<O: IsA<ControlBinding>> ControlBindingExtManual for O {
glib::result_from_gboolean!( glib::result_from_gboolean!(
ffi::gst_control_binding_get_g_value_array( ffi::gst_control_binding_get_g_value_array(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
timestamp.to_glib(), timestamp.into_glib(),
interval.to_glib(), interval.into_glib(),
n_values, n_values,
values.as_mut_ptr() as *mut glib::gobject_ffi::GValue, values.as_mut_ptr() as *mut glib::gobject_ffi::GValue,
), ),

View file

@ -26,8 +26,8 @@ impl<O: IsA<ControlSource>> ControlSourceExtManual for O {
glib::result_from_gboolean!( glib::result_from_gboolean!(
ffi::gst_control_source_get_value_array( ffi::gst_control_source_get_value_array(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
timestamp.to_glib(), timestamp.into_glib(),
interval.to_glib(), interval.into_glib(),
n_values, n_values,
values.to_glib_none().0, values.to_glib_none().0,
), ),

View file

@ -2,7 +2,7 @@
use std::convert::{TryFrom, TryInto}; use std::convert::{TryFrom, TryInto};
use glib::translate::{FromGlib, ToGlib}; use glib::translate::{FromGlib, IntoGlib};
use glib::value::{ToValue, ToValueOptional}; use glib::value::{ToValue, ToValueOptional};
use glib::StaticType; use glib::StaticType;
@ -60,7 +60,7 @@ impl<'a> Serialize for Date {
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
DateTimeVariants::YMD( DateTimeVariants::YMD(
self.0.year() as i32, self.0.year() as i32,
self.0.month().to_glib() as i32, self.0.month().into_glib() as i32,
self.0.day() as i32, self.0.day() as i32,
) )
.serialize(serializer) .serialize(serializer)

View file

@ -30,10 +30,10 @@ impl Default for DeviceMonitor {
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
pub struct DeviceMonitorFilterId(NonZeroU32); pub struct DeviceMonitorFilterId(NonZeroU32);
impl ToGlib for DeviceMonitorFilterId { impl IntoGlib for DeviceMonitorFilterId {
type GlibType = libc::c_uint; type GlibType = libc::c_uint;
fn to_glib(&self) -> libc::c_uint { fn into_glib(self) -> libc::c_uint {
self.0.get() self.0.get()
} }
} }
@ -86,7 +86,7 @@ impl<O: IsA<DeviceMonitor>> DeviceMonitorExtManual for O {
glib::result_from_gboolean!( glib::result_from_gboolean!(
ffi::gst_device_monitor_remove_filter( ffi::gst_device_monitor_remove_filter(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
filter_id.to_glib() filter_id.into_glib()
), ),
"Failed to remove the filter" "Failed to remove the filter"
) )

View file

@ -22,8 +22,8 @@ impl DeviceProvider {
ffi::gst_device_provider_register( ffi::gst_device_provider_register(
plugin.to_glib_none().0, plugin.to_glib_none().0,
name.to_glib_none().0, name.to_glib_none().0,
rank.to_glib() as u32, rank.into_glib() as u32,
type_.to_glib() type_.into_glib()
), ),
"Failed to register device provider factory" "Failed to register device provider factory"
) )

View file

@ -78,8 +78,8 @@ impl Element {
ffi::gst_element_register( ffi::gst_element_register(
plugin.to_glib_none().0, plugin.to_glib_none().0,
name.to_glib_none().0, name.to_glib_none().0,
rank.to_glib() as u32, rank.into_glib() as u32,
type_.to_glib() type_.into_glib()
), ),
"Failed to register element factory" "Failed to register element factory"
) )
@ -97,10 +97,10 @@ pub enum ElementMessageType {
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
pub struct NotifyWatchId(NonZeroU64); pub struct NotifyWatchId(NonZeroU64);
impl ToGlib for NotifyWatchId { impl IntoGlib for NotifyWatchId {
type GlibType = libc::c_ulong; 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 self.0.get() as libc::c_ulong
} }
} }
@ -278,7 +278,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
let ret: StateChangeReturn = unsafe { let ret: StateChangeReturn = unsafe {
from_glib(ffi::gst_element_change_state( from_glib(ffi::gst_element_change_state(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
transition.to_glib(), transition.into_glib(),
)) ))
}; };
ret.into_result() ret.into_result()
@ -291,7 +291,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
let ret: StateChangeReturn = unsafe { let ret: StateChangeReturn = unsafe {
from_glib(ffi::gst_element_continue_state( from_glib(ffi::gst_element_continue_state(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
ret.to_glib(), ret.into_glib(),
)) ))
}; };
ret.into_result() ret.into_result()
@ -308,7 +308,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
state.as_mut_ptr(), state.as_mut_ptr(),
pending.as_mut_ptr(), pending.as_mut_ptr(),
timeout.to_glib(), timeout.into_glib(),
)); ));
( (
ret.into_result(), ret.into_result(),
@ -322,7 +322,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
let ret: StateChangeReturn = unsafe { let ret: StateChangeReturn = unsafe {
from_glib(ffi::gst_element_set_state( from_glib(ffi::gst_element_set_state(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
state.to_glib(), state.into_glib(),
)) ))
}; };
ret.into_result() ret.into_result()
@ -362,7 +362,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock);
(*ptr).flags |= flags.to_glib(); (*ptr).flags |= flags.into_glib();
} }
} }
@ -370,7 +370,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock);
(*ptr).flags &= !flags.to_glib(); (*ptr).flags &= !flags.into_glib();
} }
} }
@ -402,7 +402,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
ffi::gst_element_message_full( ffi::gst_element_message_full(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
type_, type_,
T::domain().to_glib(), T::domain().into_glib(),
code.code(), code.code(),
message.to_glib_full(), message.to_glib_full(),
debug.to_glib_full(), debug.to_glib_full(),
@ -436,7 +436,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
ffi::gst_element_message_full_with_details( ffi::gst_element_message_full_with_details(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
type_, type_,
T::domain().to_glib(), T::domain().into_glib(),
code.code(), code.code(),
message.to_glib_full(), message.to_glib_full(),
debug.to_glib_full(), debug.to_glib_full(),
@ -472,7 +472,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
ffi::gst_element_message_full( ffi::gst_element_message_full(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
ffi::GST_MESSAGE_ERROR, ffi::GST_MESSAGE_ERROR,
error_domain.to_glib(), error_domain.into_glib(),
error_code, error_code,
message.to_glib_full(), message.to_glib_full(),
debug.to_glib_full(), debug.to_glib_full(),
@ -567,7 +567,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
from_glib(ffi::gst_element_add_property_deep_notify_watch( from_glib(ffi::gst_element_add_property_deep_notify_watch(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
property_name.0, property_name.0,
include_value.to_glib(), include_value.into_glib(),
)) ))
} }
} }
@ -584,7 +584,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
from_glib(ffi::gst_element_add_property_notify_watch( from_glib(ffi::gst_element_add_property_notify_watch(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
property_name.0, property_name.0,
include_value.to_glib(), include_value.into_glib(),
)) ))
} }
} }
@ -595,7 +595,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
unsafe { unsafe {
ffi::gst_element_remove_property_notify_watch( ffi::gst_element_remove_property_notify_watch(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
watch_id.to_glib(), watch_id.into_glib(),
); );
} }
} }
@ -609,9 +609,9 @@ impl<O: IsA<Element>> ElementExtManual for O {
let mut dest_val = mem::MaybeUninit::uninit(); let mut dest_val = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_element_query_convert( let ret = from_glib(ffi::gst_element_query_convert(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
src_val.format().to_glib(), src_val.format().into_glib(),
src_val.to_raw_value(), src_val.to_raw_value(),
U::default_format().to_glib(), U::default_format().into_glib(),
dest_val.as_mut_ptr(), dest_val.as_mut_ptr(),
)); ));
if ret { if ret {
@ -632,9 +632,9 @@ impl<O: IsA<Element>> ElementExtManual for O {
let mut dest_val = mem::MaybeUninit::uninit(); let mut dest_val = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_element_query_convert( let ret = from_glib(ffi::gst_element_query_convert(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
src_val.format().to_glib(), src_val.format().into_glib(),
src_val.value(), src_val.value(),
dest_format.to_glib(), dest_format.into_glib(),
dest_val.as_mut_ptr(), dest_val.as_mut_ptr(),
)); ));
if ret { if ret {
@ -653,7 +653,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
let mut duration = mem::MaybeUninit::uninit(); let mut duration = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_element_query_duration( let ret = from_glib(ffi::gst_element_query_duration(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
T::default_format().to_glib(), T::default_format().into_glib(),
duration.as_mut_ptr(), duration.as_mut_ptr(),
)); ));
if ret { if ret {
@ -669,7 +669,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
let mut duration = mem::MaybeUninit::uninit(); let mut duration = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_element_query_duration( let ret = from_glib(ffi::gst_element_query_duration(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
format.to_glib(), format.into_glib(),
duration.as_mut_ptr(), duration.as_mut_ptr(),
)); ));
if ret { if ret {
@ -685,7 +685,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
let mut cur = mem::MaybeUninit::uninit(); let mut cur = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_element_query_position( let ret = from_glib(ffi::gst_element_query_position(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
T::default_format().to_glib(), T::default_format().into_glib(),
cur.as_mut_ptr(), cur.as_mut_ptr(),
)); ));
if ret { if ret {
@ -701,7 +701,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
let mut cur = mem::MaybeUninit::uninit(); let mut cur = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_element_query_position( let ret = from_glib(ffi::gst_element_query_position(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
format.to_glib(), format.into_glib(),
cur.as_mut_ptr(), cur.as_mut_ptr(),
)); ));
if ret { if ret {
@ -731,11 +731,11 @@ impl<O: IsA<Element>> ElementExtManual for O {
ffi::gst_element_seek( ffi::gst_element_seek(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
rate, rate,
start.format().to_glib(), start.format().into_glib(),
flags.to_glib(), flags.into_glib(),
start_type.to_glib(), start_type.into_glib(),
start.value(), start.value(),
stop_type.to_glib(), stop_type.into_glib(),
stop.value(), stop.value(),
), ),
"Failed to seek", "Failed to seek",
@ -753,8 +753,8 @@ impl<O: IsA<Element>> ElementExtManual for O {
glib::result_from_gboolean!( glib::result_from_gboolean!(
ffi::gst_element_seek_simple( ffi::gst_element_seek_simple(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
seek_pos.format().to_glib(), seek_pos.format().into_glib(),
seek_flags.to_glib(), seek_flags.into_glib(),
seek_pos.value(), seek_pos.value(),
), ),
"Failed to seek", "Failed to seek",

View file

@ -36,10 +36,10 @@ bitflags! {
} }
#[doc(hidden)] #[doc(hidden)]
impl ToGlib for ElementFactoryListType { impl IntoGlib for ElementFactoryListType {
type GlibType = ffi::GstElementFactoryListType; type GlibType = ffi::GstElementFactoryListType;
fn to_glib(&self) -> ffi::GstElementFactoryListType { fn into_glib(self) -> ffi::GstElementFactoryListType {
self.bits() self.bits()
} }
} }

View file

@ -347,7 +347,7 @@ impl From<Result<ClockSuccess, ClockError>> for ClockReturn {
impl PartialEq for crate::TypeFindProbability { impl PartialEq for crate::TypeFindProbability {
fn eq(&self, other: &crate::TypeFindProbability) -> bool { 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 { impl PartialOrd for crate::TypeFindProbability {
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> { fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
(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 { impl Ord for crate::TypeFindProbability {
fn cmp(&self, other: &Self) -> cmp::Ordering { 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<u32> for crate::TypeFindProbability {
type Output = crate::TypeFindProbability; type Output = crate::TypeFindProbability;
fn add(self, rhs: u32) -> 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) } unsafe { from_glib(res as i32) }
} }
} }
impl ops::AddAssign<u32> for crate::TypeFindProbability { impl ops::AddAssign<u32> for crate::TypeFindProbability {
fn add_assign(&mut self, rhs: u32) { 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) }; *self = unsafe { from_glib(res as i32) };
} }
} }
@ -385,21 +385,21 @@ impl ops::Sub<u32> for crate::TypeFindProbability {
type Output = crate::TypeFindProbability; type Output = crate::TypeFindProbability;
fn sub(self, rhs: u32) -> 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) } unsafe { from_glib(res as i32) }
} }
} }
impl ops::SubAssign<u32> for crate::TypeFindProbability { impl ops::SubAssign<u32> for crate::TypeFindProbability {
fn sub_assign(&mut self, rhs: u32) { 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) }; *self = unsafe { from_glib(res as i32) };
} }
} }
impl PartialEq for crate::Rank { impl PartialEq for crate::Rank {
fn eq(&self, other: &crate::Rank) -> bool { 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 { impl PartialOrd for crate::Rank {
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> { fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
(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 { impl Ord for crate::Rank {
fn cmp(&self, other: &Self) -> cmp::Ordering { 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<u32> for crate::Rank {
type Output = crate::Rank; type Output = crate::Rank;
fn add(self, rhs: u32) -> 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) } unsafe { from_glib(res as i32) }
} }
} }
impl ops::AddAssign<u32> for crate::Rank { impl ops::AddAssign<u32> for crate::Rank {
fn add_assign(&mut self, rhs: u32) { 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) }; *self = unsafe { from_glib(res as i32) };
} }
} }
@ -437,14 +437,14 @@ impl ops::Sub<u32> for crate::Rank {
type Output = crate::Rank; type Output = crate::Rank;
fn sub(self, rhs: u32) -> 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) } unsafe { from_glib(res as i32) }
} }
} }
impl ops::SubAssign<u32> for crate::Rank { impl ops::SubAssign<u32> for crate::Rank {
fn sub_assign(&mut self, rhs: u32) { 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) }; *self = unsafe { from_glib(res as i32) };
} }
} }
@ -504,11 +504,11 @@ pub enum MessageType {
} }
#[doc(hidden)] #[doc(hidden)]
impl ToGlib for MessageType { impl IntoGlib for MessageType {
type GlibType = ffi::GstMessageType; type GlibType = ffi::GstMessageType;
fn to_glib(&self) -> ffi::GstMessageType { fn into_glib(self) -> ffi::GstMessageType {
match *self { match self {
MessageType::Unknown => ffi::GST_MESSAGE_UNKNOWN, MessageType::Unknown => ffi::GST_MESSAGE_UNKNOWN,
MessageType::Eos => ffi::GST_MESSAGE_EOS, MessageType::Eos => ffi::GST_MESSAGE_EOS,
MessageType::Error => ffi::GST_MESSAGE_ERROR, MessageType::Error => ffi::GST_MESSAGE_ERROR,
@ -626,7 +626,7 @@ impl ToValue for MessageType {
fn to_value(&self) -> Value { fn to_value(&self) -> Value {
let mut value = glib::Value::for_value_type::<MessageType>(); let mut value = glib::Value::for_value_type::<MessageType>();
unsafe { 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 value
} }
@ -638,8 +638,8 @@ impl ToValue for MessageType {
impl State { impl State {
pub fn next(self, pending: Self) -> Self { pub fn next(self, pending: Self) -> Self {
let current = self.to_glib(); let current = self.into_glib();
let pending = pending.to_glib(); let pending = pending.into_glib();
let sign = (pending - current).signum(); let sign = (pending - current).signum();
@ -650,8 +650,8 @@ impl State {
impl StateChange { impl StateChange {
pub fn new(current: State, next: State) -> Self { pub fn new(current: State, next: State) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
let current = current.to_glib(); let current = current.into_glib();
let next = next.to_glib(); let next = next.into_glib();
unsafe { from_glib((current << 3) | next) } unsafe { from_glib((current << 3) | next) }
} }
@ -694,7 +694,7 @@ impl StateChange {
use std::ffi::CStr; use std::ffi::CStr;
unsafe { unsafe {
CStr::from_ptr( CStr::from_ptr(
ffi::gst_state_change_get_name(self.to_glib()) ffi::gst_state_change_get_name(self.into_glib())
.as_ref() .as_ref()
.expect("gst_state_change_get_name returned NULL"), .expect("gst_state_change_get_name returned NULL"),
) )

View file

@ -11,7 +11,7 @@ use std::num::NonZeroU32;
use std::ops::Deref; use std::ops::Deref;
use std::ptr; 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; use glib::value::ToSendValue;
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
@ -36,10 +36,10 @@ impl Seqnum {
} }
} }
impl ToGlib for Seqnum { impl IntoGlib for Seqnum {
type GlibType = u32; type GlibType = u32;
fn to_glib(&self) -> u32 { fn into_glib(self) -> u32 {
self.0.get() self.0.get()
} }
} }
@ -77,23 +77,23 @@ impl GroupId {
impl EventType { impl EventType {
pub fn is_upstream(self) -> bool { 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 { 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 { 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 { 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 { 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; return None;
} }
let v1 = self.to_glib() as u32; let v1 = self.into_glib() as u32;
let v2 = other.to_glib() as u32; let v2 = other.into_glib() as u32;
let stream_start = ffi::GST_EVENT_STREAM_START as u32; let stream_start = ffi::GST_EVENT_STREAM_START as u32;
let segment = ffi::GST_EVENT_SEGMENT 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> { pub struct StreamStartBuilder<'a> {
@ -1320,7 +1320,7 @@ impl<'a> StreamStartBuilder<'a> {
event_builder_generic_impl!(|s: &Self| { event_builder_generic_impl!(|s: &Self| {
let ev = ffi::gst_event_new_stream_start(s.stream_id.to_glib_none().0); let ev = ffi::gst_event_new_stream_start(s.stream_id.to_glib_none().0);
if let Some(flags) = s.flags { 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 { if let Some(group_id) = s.group_id {
ffi::gst_event_set_group_id(ev, group_id.0.get()); 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( 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.minsize.value(),
s.maxsize.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( event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_toc(
s.toc.to_glib_none().0, 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( 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() s.position.value()
)); ));
} }
@ -1589,8 +1589,8 @@ impl<'a> GapBuilder<'a> {
} }
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_gap( event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_gap(
s.timestamp.to_glib(), s.timestamp.into_glib(),
s.duration.to_glib() s.duration.into_glib()
)); ));
} }
@ -1615,10 +1615,10 @@ impl<'a> QosBuilder<'a> {
} }
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_qos( event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_qos(
s.type_.to_glib(), s.type_.into_glib(),
s.proportion, s.proportion,
s.diff, 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( let ev = ffi::gst_event_new_seek(
s.rate, s.rate,
s.start.format().to_glib(), s.start.format().into_glib(),
s.flags.to_glib(), s.flags.into_glib(),
s.start_type.to_glib(), s.start_type.into_glib(),
s.start.value(), s.start.value(),
s.stop_type.to_glib(), s.stop_type.into_glib(),
s.stop.value(), s.stop.value(),
); );
#[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg(any(feature = "v1_16", feature = "dox"))]
if let Some(trickmode_interval) = s.trickmode_interval { 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 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> { pub struct StepBuilder<'a> {
@ -1737,11 +1737,11 @@ impl<'a> StepBuilder<'a> {
} }
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_step( 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.amount.value() as u64,
s.rate, s.rate,
s.flush.to_glib(), s.flush.into_glib(),
s.intermediate.to_glib(), s.intermediate.into_glib(),
)); ));
} }

View file

@ -38,9 +38,9 @@ pub fn parse_bin_from_description_full(
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let ret = ffi::gst_parse_bin_from_description_full( let ret = ffi::gst_parse_bin_from_description_full(
bin_description.to_glib_none().0, bin_description.to_glib_none().0,
ghost_unlinked_pads.to_glib(), ghost_unlinked_pads.into_glib(),
context.to_glib_none_mut().0, context.to_glib_none_mut().0,
flags.to_glib(), flags.into_glib(),
&mut error, &mut error,
); );
if error.is_null() { if error.is_null() {
@ -81,7 +81,7 @@ pub fn parse_launch_full(
let ret = ffi::gst_parse_launch_full( let ret = ffi::gst_parse_launch_full(
pipeline_description.to_glib_none().0, pipeline_description.to_glib_none().0,
context.to_glib_none_mut().0, context.to_glib_none_mut().0,
flags.to_glib(), flags.into_glib(),
&mut error, &mut error,
); );
if error.is_null() { if error.is_null() {
@ -103,7 +103,7 @@ pub fn parse_launchv_full(
let ret = ffi::gst_parse_launchv_full( let ret = ffi::gst_parse_launchv_full(
argv.to_glib_none().0, argv.to_glib_none().0,
context.to_glib_none_mut().0, context.to_glib_none_mut().0,
flags.to_glib(), flags.into_glib(),
&mut error, &mut error,
); );
if error.is_null() { if error.is_null() {
@ -173,7 +173,7 @@ pub fn type_is_plugin_api(type_: glib::types::Type) -> Option<crate::PluginAPIFl
let mut flags = mem::MaybeUninit::uninit(); let mut flags = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_type_is_plugin_api( let ret = from_glib(ffi::gst_type_is_plugin_api(
type_.to_glib(), type_.into_glib(),
flags.as_mut_ptr(), flags.as_mut_ptr(),
)); ));
let flags = flags.assume_init(); let flags = flags.assume_init();

View file

@ -27,8 +27,8 @@ impl GhostPad {
ffi::gst_ghost_pad_activate_mode_default( ffi::gst_ghost_pad_activate_mode_default(
pad.to_glib_none().0 as *mut ffi::GstPad, pad.to_glib_none().0 as *mut ffi::GstPad,
parent.map(|p| p.as_ref()).to_glib_none().0, parent.map(|p| p.as_ref()).to_glib_none().0,
mode.to_glib(), mode.into_glib(),
active.to_glib(), active.into_glib(),
), ),
"Failed to invoke the default activate mode function of the ghost pad" "Failed to invoke the default activate mode function of the ghost pad"
) )
@ -47,8 +47,8 @@ impl GhostPad {
ffi::gst_ghost_pad_internal_activate_mode_default( ffi::gst_ghost_pad_internal_activate_mode_default(
pad.to_glib_none().0 as *mut ffi::GstPad, pad.to_glib_none().0 as *mut ffi::GstPad,
parent.map(|p| p.as_ref()).to_glib_none().0, parent.map(|p| p.as_ref()).to_glib_none().0,
mode.to_glib(), mode.into_glib(),
active.to_glib(), active.into_glib(),
), ),
concat!( concat!(
"Failed to invoke the default activate mode function of a proxy pad ", "Failed to invoke the default activate mode function of a proxy pad ",

View file

@ -174,7 +174,7 @@ where
unsafe { unsafe {
let it = ffi::gst_iterator_new( let it = ffi::gst_iterator_new(
mem::size_of::<RsIterator<T, I>>() as u32, mem::size_of::<RsIterator<T, I>>() as u32,
T::static_type().to_glib(), T::static_type().into_glib(),
ptr::null_mut(), ptr::null_mut(),
&DUMMY_COOKIE as *const _ as *mut _, &DUMMY_COOKIE as *const _ as *mut _,
Some(rs_iterator_copy::<T, I>), Some(rs_iterator_copy::<T, I>),
@ -572,7 +572,7 @@ impl<T: StaticType> glib::translate::FromGlibPtrNone<*const ffi::GstIterator> fo
#[inline] #[inline]
unsafe fn from_glib_none(ptr: *const ffi::GstIterator) -> Self { unsafe fn from_glib_none(ptr: *const ffi::GstIterator) -> Self {
assert_ne!( 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 glib::ffi::GFALSE
); );
from_glib_full(ffi::gst_iterator_copy(ptr)) from_glib_full(ffi::gst_iterator_copy(ptr))
@ -584,7 +584,7 @@ impl<T: StaticType> glib::translate::FromGlibPtrNone<*mut ffi::GstIterator> for
#[inline] #[inline]
unsafe fn from_glib_none(ptr: *mut ffi::GstIterator) -> Self { unsafe fn from_glib_none(ptr: *mut ffi::GstIterator) -> Self {
assert_ne!( 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 glib::ffi::GFALSE
); );
from_glib_full(ffi::gst_iterator_copy(ptr)) from_glib_full(ffi::gst_iterator_copy(ptr))
@ -597,7 +597,7 @@ impl<T: StaticType> glib::translate::FromGlibPtrBorrow<*mut ffi::GstIterator> fo
unsafe fn from_glib_borrow(ptr: *mut ffi::GstIterator) -> Borrowed<Self> { unsafe fn from_glib_borrow(ptr: *mut ffi::GstIterator) -> Borrowed<Self> {
assert!(!ptr.is_null()); assert!(!ptr.is_null());
assert_ne!( 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 glib::ffi::GFALSE
); );
Borrowed::new(Self { Borrowed::new(Self {
@ -613,7 +613,7 @@ impl<T: StaticType> glib::translate::FromGlibPtrFull<*mut ffi::GstIterator> for
unsafe fn from_glib_full(ptr: *mut ffi::GstIterator) -> Self { unsafe fn from_glib_full(ptr: *mut ffi::GstIterator) -> Self {
assert!(!ptr.is_null()); assert!(!ptr.is_null());
assert_ne!( 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 glib::ffi::GFALSE
); );
Self { Self {

View file

@ -59,7 +59,7 @@ impl DebugCategory {
unsafe { unsafe {
let ptr = _gst_debug_category_new( let ptr = _gst_debug_category_new(
name.to_glib_none().0, name.to_glib_none().0,
color.to_glib(), color.into_glib(),
description.to_glib_none().0, description.to_glib_none().0,
); );
// Can be NULL if the debug system is compiled out // Can be NULL if the debug system is compiled out
@ -93,7 +93,7 @@ impl DebugCategory {
pub fn set_threshold(self, threshold: crate::DebugLevel) { pub fn set_threshold(self, threshold: crate::DebugLevel) {
if let Some(cat) = self.0 { 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 { unsafe {
if level.to_glib() as i32 > cat.as_ref().threshold { if level.into_glib() as i32 > cat.as_ref().threshold {
return; return;
} }
} }
@ -165,7 +165,7 @@ impl DebugCategory {
unsafe { unsafe {
ffi::gst_debug_log( ffi::gst_debug_log(
cat.as_ptr(), cat.as_ptr(),
level.to_glib(), level.into_glib(),
file.to_glib_none().0, file.to_glib_none().0,
module.to_glib_none().0, module.to_glib_none().0,
line as i32, line as i32,

View file

@ -17,7 +17,9 @@ use std::ops::Deref;
use std::ptr; use std::ptr;
use glib::prelude::*; 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, || { mini_object_wrapper!(Message, MessageRef, ffi::GstMessage, || {
ffi::gst_message_get_type() 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 { if let Some((mode, avg_in, avg_out, buffering_left)) = s.stats {
ffi::gst_message_set_buffering_stats( ffi::gst_message_set_buffering_stats(
msg, msg,
mode.to_glib(), mode.into_glib(),
avg_in, avg_in,
avg_out, avg_out,
buffering_left, buffering_left,
@ -1960,9 +1962,9 @@ impl<'a> StateChangedBuilder<'a> {
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_state_changed( message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_state_changed(
src, src,
s.old.to_glib(), s.old.into_glib(),
s.new.to_glib(), s.new.into_glib(),
s.pending.to_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( message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_step_done(
src, src,
s.amount.format().to_glib(), s.amount.format().into_glib(),
s.amount.value() as u64, s.amount.value() as u64,
s.rate, s.rate,
s.flush.to_glib(), s.flush.into_glib(),
s.intermediate.to_glib(), s.intermediate.into_glib(),
s.duration.value() as u64, 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( message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_clock_provide(
src, src,
s.clock.to_glib_none().0, 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( message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_structure_change(
src, src,
s.type_.to_glib(), s.type_.into_glib(),
s.owner.to_glib_none().0, 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| { message_builder_generic_impl!(|s: &mut Self, src| {
let msg = 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 { if let Some(status_object) = s.status_object {
ffi::gst_message_set_stream_status_object( ffi::gst_message_set_stream_status_object(
msg, msg,
@ -2208,7 +2210,7 @@ impl<'a> SegmentStartBuilder<'a> {
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_segment_start( message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_segment_start(
src, src,
s.position.format().to_glib(), s.position.format().into_glib(),
s.position.value(), 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( message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_segment_done(
src, src,
s.position.format().to_glib(), s.position.format().into_glib(),
s.position.value(), 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( message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_async_done(
src, 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( message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_request_state(
src, 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( message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_step_start(
src, src,
s.active.to_glib(), s.active.into_glib(),
s.amount.format().to_glib(), s.amount.format().into_glib(),
s.amount.value() as u64, s.amount.value() as u64,
s.rate, s.rate,
s.flush.to_glib(), s.flush.into_glib(),
s.intermediate.to_glib(), s.intermediate.into_glib(),
)); ));
} }
@ -2410,11 +2412,11 @@ impl<'a> QosBuilder<'a> {
message_builder_generic_impl!(|s: &mut Self, src| { message_builder_generic_impl!(|s: &mut Self, src| {
let msg = ffi::gst_message_new_qos( let msg = ffi::gst_message_new_qos(
src, src,
s.live.to_glib(), s.live.into_glib(),
s.running_time.to_glib(), s.running_time.into_glib(),
s.stream_time.to_glib(), s.stream_time.into_glib(),
s.timestamp.to_glib(), s.timestamp.into_glib(),
s.duration.to_glib(), s.duration.into_glib(),
); );
if let Some((jitter, proportion, quality)) = s.values { if let Some((jitter, proportion, quality)) = s.values {
ffi::gst_message_set_qos_values(msg, jitter, proportion, quality); 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 { if let Some((processed, dropped)) = s.stats {
ffi::gst_message_set_qos_stats( ffi::gst_message_set_qos_stats(
msg, msg,
processed.format().to_glib(), processed.format().into_glib(),
processed.value() as u64, processed.value() as u64,
dropped.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( message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_progress(
src, src,
s.type_.to_glib(), s.type_.into_glib(),
s.code.to_glib_none().0, s.code.to_glib_none().0,
s.text.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( message_builder_generic_impl!(|s: &Self, src| ffi::gst_message_new_toc(
src, src,
s.toc.to_glib_none().0, 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( message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_reset_time(
src, src,
s.running_time.to_glib() s.running_time.into_glib()
)); ));
} }

View file

@ -18,7 +18,7 @@ use crate::ClockTime;
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] #[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}; use glib::translate::{from_glib, from_glib_none, FromGlib, ToGlibPtr};
pub unsafe trait MetaAPI: Sync + Send + Sized { pub unsafe trait MetaAPI: Sync + Send + Sized {
@ -362,8 +362,8 @@ impl ReferenceTimestampMeta {
let meta = ffi::gst_buffer_add_reference_timestamp_meta( let meta = ffi::gst_buffer_add_reference_timestamp_meta(
buffer.as_mut_ptr(), buffer.as_mut_ptr(),
reference.to_glib_none().0, reference.to_glib_none().0,
timestamp.to_glib(), timestamp.into_glib(),
duration.to_glib(), duration.into_glib(),
); );
Self::from_mut_ptr(buffer, meta) Self::from_mut_ptr(buffer, meta)

View file

@ -78,7 +78,7 @@ impl<O: IsA<crate::Object>> GstObjectExtManual for O {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock);
(*ptr).flags |= flags.to_glib(); (*ptr).flags |= flags.into_glib();
} }
} }
@ -86,7 +86,7 @@ impl<O: IsA<crate::Object>> GstObjectExtManual for O {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock);
(*ptr).flags &= !flags.to_glib(); (*ptr).flags &= !flags.into_glib();
} }
} }
@ -111,8 +111,8 @@ impl<O: IsA<crate::Object>> GstObjectExtManual for O {
ffi::gst_object_get_g_value_array( ffi::gst_object_get_g_value_array(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
property_name.to_glib_none().0, property_name.to_glib_none().0,
timestamp.to_glib(), timestamp.into_glib(),
interval.to_glib(), interval.into_glib(),
n_values, n_values,
values.as_mut_ptr() as *mut glib::gobject_ffi::GValue, values.as_mut_ptr() as *mut glib::gobject_ffi::GValue,
), ),

View file

@ -31,16 +31,16 @@ use std::ptr;
use glib::ffi::gpointer; use glib::ffi::gpointer;
use glib::prelude::*; use glib::prelude::*;
use glib::translate::{ 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)] #[derive(Debug, PartialEq, Eq)]
pub struct PadProbeId(NonZeroU64); pub struct PadProbeId(NonZeroU64);
impl ToGlib for PadProbeId { impl IntoGlib for PadProbeId {
type GlibType = libc::c_ulong; 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 self.0.get() as libc::c_ulong
} }
} }
@ -283,7 +283,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
let func_box: Box<F> = Box::new(func); let func_box: Box<F> = Box::new(func);
let id = ffi::gst_pad_add_probe( let id = ffi::gst_pad_add_probe(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
mask.to_glib(), mask.into_glib(),
Some(trampoline_pad_probe::<Self, F>), Some(trampoline_pad_probe::<Self, F>),
Box::into_raw(func_box) as gpointer, Box::into_raw(func_box) as gpointer,
Some(destroy_closure::<F>), Some(destroy_closure::<F>),
@ -299,7 +299,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
fn remove_probe(&self, id: PadProbeId) { fn remove_probe(&self, id: PadProbeId) {
unsafe { 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<O: IsA<Pad>> PadExtManual for O {
from_glib(ffi::gst_pad_link_full( from_glib(ffi::gst_pad_link_full(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
sinkpad.as_ref().to_glib_none().0, sinkpad.as_ref().to_glib_none().0,
flags.to_glib(), flags.into_glib(),
)) ))
}; };
ret.into_result() ret.into_result()
@ -765,9 +765,9 @@ impl<O: IsA<Pad>> PadExtManual for O {
let mut dest_val = mem::MaybeUninit::uninit(); let mut dest_val = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_pad_peer_query_convert( let ret = from_glib(ffi::gst_pad_peer_query_convert(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
src_val.format().to_glib(), src_val.format().into_glib(),
src_val.to_raw_value(), src_val.to_raw_value(),
U::default_format().to_glib(), U::default_format().into_glib(),
dest_val.as_mut_ptr(), dest_val.as_mut_ptr(),
)); ));
if ret { if ret {
@ -788,9 +788,9 @@ impl<O: IsA<Pad>> PadExtManual for O {
let mut dest_val = mem::MaybeUninit::uninit(); let mut dest_val = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_pad_peer_query_convert( let ret = from_glib(ffi::gst_pad_peer_query_convert(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
src_val.format().to_glib(), src_val.format().into_glib(),
src_val.to_raw_value(), src_val.to_raw_value(),
dest_format.to_glib(), dest_format.into_glib(),
dest_val.as_mut_ptr(), dest_val.as_mut_ptr(),
)); ));
if ret { if ret {
@ -809,7 +809,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
let mut duration = mem::MaybeUninit::uninit(); let mut duration = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_pad_peer_query_duration( let ret = from_glib(ffi::gst_pad_peer_query_duration(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
T::default_format().to_glib(), T::default_format().into_glib(),
duration.as_mut_ptr(), duration.as_mut_ptr(),
)); ));
if ret { if ret {
@ -825,7 +825,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
let mut duration = mem::MaybeUninit::uninit(); let mut duration = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_pad_peer_query_duration( let ret = from_glib(ffi::gst_pad_peer_query_duration(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
format.to_glib(), format.into_glib(),
duration.as_mut_ptr(), duration.as_mut_ptr(),
)); ));
if ret { if ret {
@ -841,7 +841,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
let mut cur = mem::MaybeUninit::uninit(); let mut cur = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_pad_peer_query_position( let ret = from_glib(ffi::gst_pad_peer_query_position(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
T::default_format().to_glib(), T::default_format().into_glib(),
cur.as_mut_ptr(), cur.as_mut_ptr(),
)); ));
if ret { if ret {
@ -857,7 +857,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
let mut cur = mem::MaybeUninit::uninit(); let mut cur = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_pad_peer_query_position( let ret = from_glib(ffi::gst_pad_peer_query_position(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
format.to_glib(), format.into_glib(),
cur.as_mut_ptr(), cur.as_mut_ptr(),
)); ));
if ret { if ret {
@ -878,9 +878,9 @@ impl<O: IsA<Pad>> PadExtManual for O {
let mut dest_val = mem::MaybeUninit::uninit(); let mut dest_val = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_pad_query_convert( let ret = from_glib(ffi::gst_pad_query_convert(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
src_val.format().to_glib(), src_val.format().into_glib(),
src_val.to_raw_value(), src_val.to_raw_value(),
U::default_format().to_glib(), U::default_format().into_glib(),
dest_val.as_mut_ptr(), dest_val.as_mut_ptr(),
)); ));
if ret { if ret {
@ -902,9 +902,9 @@ impl<O: IsA<Pad>> PadExtManual for O {
let mut dest_val = mem::MaybeUninit::uninit(); let mut dest_val = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_pad_query_convert( let ret = from_glib(ffi::gst_pad_query_convert(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
src_val.format().to_glib(), src_val.format().into_glib(),
src_val.value(), src_val.value(),
dest_format.to_glib(), dest_format.into_glib(),
dest_val.as_mut_ptr(), dest_val.as_mut_ptr(),
)); ));
if ret { if ret {
@ -923,7 +923,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
let mut duration = mem::MaybeUninit::uninit(); let mut duration = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_pad_query_duration( let ret = from_glib(ffi::gst_pad_query_duration(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
T::default_format().to_glib(), T::default_format().into_glib(),
duration.as_mut_ptr(), duration.as_mut_ptr(),
)); ));
if ret { if ret {
@ -939,7 +939,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
let mut duration = mem::MaybeUninit::uninit(); let mut duration = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_pad_query_duration( let ret = from_glib(ffi::gst_pad_query_duration(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
format.to_glib(), format.into_glib(),
duration.as_mut_ptr(), duration.as_mut_ptr(),
)); ));
if ret { if ret {
@ -955,7 +955,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
let mut cur = mem::MaybeUninit::uninit(); let mut cur = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_pad_query_position( let ret = from_glib(ffi::gst_pad_query_position(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
T::default_format().to_glib(), T::default_format().into_glib(),
cur.as_mut_ptr(), cur.as_mut_ptr(),
)); ));
if ret { if ret {
@ -971,7 +971,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
let mut cur = mem::MaybeUninit::uninit(); let mut cur = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_pad_query_position( let ret = from_glib(ffi::gst_pad_query_position(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
format.to_glib(), format.into_glib(),
cur.as_mut_ptr(), cur.as_mut_ptr(),
)); ));
if ret { if ret {
@ -1052,7 +1052,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock);
(*ptr).flags |= flags.to_glib(); (*ptr).flags |= flags.into_glib();
} }
} }
@ -1060,7 +1060,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); 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 { } else {
let data = (*info).data as *mut ffi::GstMiniObject; let data = (*info).data as *mut ffi::GstMiniObject;
(*info).data = ptr::null_mut(); (*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()); data_type = Some(Buffer::static_type());
Some(PadProbeData::Buffer(from_glib_full( Some(PadProbeData::Buffer(from_glib_full(
data as *const ffi::GstBuffer, 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()); data_type = Some(BufferList::static_type());
Some(PadProbeData::BufferList(from_glib_full( Some(PadProbeData::BufferList(from_glib_full(
data as *const ffi::GstBufferList, 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()); data_type = Some(Query::static_type());
Some(PadProbeData::Query(QueryRef::from_mut_ptr( Some(PadProbeData::Query(QueryRef::from_mut_ptr(
data as *mut ffi::GstQuery, 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()); data_type = Some(Event::static_type());
Some(PadProbeData::Event(from_glib_full( Some(PadProbeData::Event(from_glib_full(
data as *const ffi::GstEvent, data as *const ffi::GstEvent,
@ -1180,7 +1180,7 @@ unsafe fn update_probe_info(
} }
let flow_ret: FlowReturn = probe_info.flow_res.into(); 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< unsafe extern "C" fn trampoline_pad_probe<
@ -1205,7 +1205,7 @@ where
update_probe_info(ret, probe_info, data_type, info); update_probe_info(ret, probe_info, data_type, info);
ret.to_glib() ret.into_glib()
} }
unsafe extern "C" fn trampoline_activate_function< unsafe extern "C" fn trampoline_activate_function<
@ -1232,7 +1232,7 @@ where
false false
} }
} }
.to_glib() .into_glib()
} }
unsafe extern "C" fn trampoline_activatemode_function< unsafe extern "C" fn trampoline_activatemode_function<
@ -1266,7 +1266,7 @@ where
false false
} }
} }
.to_glib() .into_glib()
} }
unsafe extern "C" fn trampoline_chain_function< unsafe extern "C" fn trampoline_chain_function<
@ -1293,7 +1293,7 @@ where
from_glib_full(buffer), from_glib_full(buffer),
) )
.into(); .into();
res.to_glib() res.into_glib()
} }
unsafe extern "C" fn trampoline_chain_list_function< unsafe extern "C" fn trampoline_chain_list_function<
@ -1320,7 +1320,7 @@ where
from_glib_full(list), from_glib_full(list),
) )
.into(); .into();
res.to_glib() res.into_glib()
} }
unsafe extern "C" fn trampoline_event_function< unsafe extern "C" fn trampoline_event_function<
@ -1343,7 +1343,7 @@ where
.as_ref(), .as_ref(),
from_glib_full(event), from_glib_full(event),
) )
.to_glib() .into_glib()
} }
unsafe extern "C" fn trampoline_event_full_function< unsafe extern "C" fn trampoline_event_full_function<
@ -1370,7 +1370,7 @@ where
from_glib_full(event), from_glib_full(event),
) )
.into(); .into();
res.to_glib() res.into_glib()
} }
unsafe extern "C" fn trampoline_getrange_function< 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) { match new_buffer.copy_into(passed_buffer, crate::BUFFER_COPY_METADATA, 0, None) {
Ok(_) => FlowReturn::Ok.to_glib(), Ok(_) => FlowReturn::Ok.into_glib(),
Err(_) => { Err(_) => {
gst_error!( gst_error!(
crate::CAT_RUST, crate::CAT_RUST,
@ -1452,19 +1452,19 @@ where
"Failed to copy buffer metadata" "Failed to copy buffer metadata"
); );
FlowReturn::Error.to_glib() FlowReturn::Error.into_glib()
} }
} }
} else { } else {
*buffer = new_buffer.into_ptr(); *buffer = new_buffer.into_ptr();
FlowReturn::Ok.to_glib() FlowReturn::Ok.into_glib()
} }
} }
Ok(PadGetRangeSuccess::FilledBuffer) => { Ok(PadGetRangeSuccess::FilledBuffer) => {
assert!(passed_buffer.is_some()); 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), &from_glib_borrow(peer),
) )
.into(); .into();
res.to_glib() res.into_glib()
} }
unsafe extern "C" fn trampoline_query_function< unsafe extern "C" fn trampoline_query_function<
@ -1542,7 +1542,7 @@ where
.as_ref(), .as_ref(),
crate::QueryRef::from_mut_ptr(query), crate::QueryRef::from_mut_ptr(query),
) )
.to_glib() .into_glib()
} }
unsafe extern "C" fn trampoline_unlink_function< unsafe extern "C" fn trampoline_unlink_function<

View file

@ -20,7 +20,7 @@ impl PadTemplate {
Option::<_>::from_glib_none( Option::<_>::from_glib_none(
ffi::gst_pad_template_new_from_static_pad_template_with_gtype( ffi::gst_pad_template_new_from_static_pad_template_with_gtype(
mut_override(pad_template.to_glib_none().0), 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")) .ok_or_else(|| glib::bool_error!("Failed to create PadTemplate"))

View file

@ -41,7 +41,7 @@ impl GstParamSpecExt for glib::ParamSpec {
nick.to_glib_none().0, nick.to_glib_none().0,
blurb.to_glib_none().0, blurb.to_glib_none().0,
element_spec.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(), *max.denom(),
*default.numer(), *default.numer(),
*default.denom(), *default.denom(),
flags.to_glib(), flags.into_glib(),
)) ))
} }
} }

View file

@ -18,7 +18,7 @@ impl<O: IsA<crate::Pipeline>> GstPipelineExtManual for O {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock);
(*ptr).flags |= flags.to_glib(); (*ptr).flags |= flags.into_glib();
} }
} }
@ -26,7 +26,7 @@ impl<O: IsA<crate::Pipeline>> GstPipelineExtManual for O {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock);
(*ptr).flags &= !flags.to_glib(); (*ptr).flags &= !flags.into_glib();
} }
} }

View file

@ -4,7 +4,7 @@ use crate::PluginFeature;
use crate::Rank; use crate::Rank;
use glib::prelude::*; use glib::prelude::*;
use glib::translate::{from_glib, FromGlibPtrFull, ToGlib, ToGlibPtr}; use glib::translate::{from_glib, FromGlibPtrFull, IntoGlib, ToGlibPtr};
pub trait PluginFeatureExtManual: Sized + 'static { pub trait PluginFeatureExtManual: Sized + 'static {
fn rank(&self) -> Rank; fn rank(&self) -> Rank;
@ -22,7 +22,10 @@ impl<O: IsA<PluginFeature>> PluginFeatureExtManual for O {
fn set_rank(&self, rank: Rank) { fn set_rank(&self, rank: Rank) {
unsafe { 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,
);
} }
} }

View file

@ -218,7 +218,7 @@ declare_concrete_query!(Position, T);
impl Position<Query> { impl Position<Query> {
pub fn new(fmt: crate::Format) -> Self { pub fn new(fmt: crate::Format) -> Self {
assert_initialized_main_thread!(); 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<T: AsMutPtr> Position<T> {
let pos = pos.into(); let pos = pos.into();
assert_eq!(pos.format(), self.format()); assert_eq!(pos.format(), self.format());
unsafe { 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<Query> { impl Duration<Query> {
pub fn new(fmt: crate::Format) -> Self { pub fn new(fmt: crate::Format) -> Self {
assert_initialized_main_thread!(); 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<T: AsMutPtr> Duration<T> {
let dur = dur.into(); let dur = dur.into();
assert_eq!(dur.format(), self.format()); assert_eq!(dur.format(), self.format());
unsafe { 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<T: AsMutPtr> Latency<T> {
unsafe { unsafe {
ffi::gst_query_set_latency( ffi::gst_query_set_latency(
self.0.as_mut_ptr(), self.0.as_mut_ptr(),
live.to_glib(), live.into_glib(),
min.to_glib(), min.into_glib(),
max.to_glib(), max.into_glib(),
); );
} }
} }
@ -350,7 +350,7 @@ declare_concrete_query!(Seeking, T);
impl Seeking<Query> { impl Seeking<Query> {
pub fn new(fmt: crate::Format) -> Self { pub fn new(fmt: crate::Format) -> Self {
assert_initialized_main_thread!(); 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<T: AsMutPtr> Seeking<T> {
unsafe { unsafe {
ffi::gst_query_set_seeking( ffi::gst_query_set_seeking(
self.0.as_mut_ptr(), self.0.as_mut_ptr(),
start.format().to_glib(), start.format().into_glib(),
seekable.to_glib(), seekable.into_glib(),
start.value(), start.value(),
end.value(), end.value(),
); );
@ -417,7 +417,7 @@ declare_concrete_query!(Segment, T);
impl Segment<Query> { impl Segment<Query> {
pub fn new(fmt: crate::Format) -> Self { pub fn new(fmt: crate::Format) -> Self {
assert_initialized_main_thread!(); 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<T: AsMutPtr> Segment<T> {
ffi::gst_query_set_segment( ffi::gst_query_set_segment(
self.0.as_mut_ptr(), self.0.as_mut_ptr(),
rate, rate,
start.format().to_glib(), start.format().into_glib(),
start.value(), start.value(),
stop.value(), stop.value(),
); );
@ -486,9 +486,9 @@ impl Convert<Query> {
let value = value.into(); let value = value.into();
unsafe { unsafe {
Self(from_glib_full(ffi::gst_query_new_convert( Self(from_glib_full(ffi::gst_query_new_convert(
value.format().to_glib(), value.format().into_glib(),
value.value(), value.value(),
dest_fmt.to_glib(), dest_fmt.into_glib(),
))) )))
} }
} }
@ -545,9 +545,9 @@ impl<T: AsMutPtr> Convert<T> {
unsafe { unsafe {
ffi::gst_query_set_convert( ffi::gst_query_set_convert(
self.0.as_mut_ptr(), self.0.as_mut_ptr(),
src.format().to_glib(), src.format().into_glib(),
src.value(), src.value(),
dest.format().to_glib(), dest.format().into_glib(),
dest.value(), dest.value(),
); );
} }
@ -590,7 +590,7 @@ impl<T: AsPtr> Formats<T> {
impl<T: AsMutPtr> Formats<T> { impl<T: AsMutPtr> Formats<T> {
pub fn set(&mut self, formats: &[crate::Format]) { pub fn set(&mut self, formats: &[crate::Format]) {
unsafe { 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 _); 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<Query> { impl Buffering<Query> {
pub fn new(fmt: crate::Format) -> Self { pub fn new(fmt: crate::Format) -> Self {
assert_initialized_main_thread!(); 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<T: AsPtr> Buffering<T> {
impl<T: AsMutPtr> Buffering<T> { impl<T: AsMutPtr> Buffering<T> {
pub fn set_percent(&mut self, busy: bool, percent: i32) { pub fn set_percent(&mut self, busy: bool, percent: i32) {
unsafe { 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<T: AsMutPtr> Buffering<T> {
unsafe { unsafe {
ffi::gst_query_set_buffering_range( ffi::gst_query_set_buffering_range(
self.0.as_mut_ptr(), self.0.as_mut_ptr(),
start.format().to_glib(), start.format().into_glib(),
start.value(), start.value(),
stop.value(), stop.value(),
estimated_total, estimated_total,
@ -759,7 +763,7 @@ impl<T: AsMutPtr> Buffering<T> {
unsafe { unsafe {
ffi::gst_query_set_buffering_stats( ffi::gst_query_set_buffering_stats(
self.0.as_mut_ptr(), self.0.as_mut_ptr(),
mode.to_glib(), mode.into_glib(),
avg_in, avg_in,
avg_out, avg_out,
buffering_left, buffering_left,
@ -849,7 +853,10 @@ impl<T: AsMutPtr> Uri<T> {
let uri = uri.into(); let uri = uri.into();
unsafe { unsafe {
ffi::gst_query_set_uri_redirection(self.0.as_mut_ptr(), uri.to_glib_none().0); 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<Query> {
unsafe { unsafe {
Self(from_glib_full(ffi::gst_query_new_allocation( Self(from_glib_full(ffi::gst_query_new_allocation(
caps.as_mut_ptr(), caps.as_mut_ptr(),
need_pool.to_glib(), need_pool.into_glib(),
))) )))
} }
} }
@ -946,7 +953,7 @@ impl<T: AsPtr> Allocation<T> {
let mut idx = mem::MaybeUninit::uninit(); let mut idx = mem::MaybeUninit::uninit();
if ffi::gst_query_find_allocation_meta( if ffi::gst_query_find_allocation_meta(
self.0.as_ptr(), self.0.as_ptr(),
U::meta_api().to_glib(), U::meta_api().into_glib(),
idx.as_mut_ptr(), idx.as_mut_ptr(),
) != glib::ffi::GFALSE ) != glib::ffi::GFALSE
{ {
@ -1010,7 +1017,7 @@ impl<T: AsMutPtr> Allocation<T> {
unsafe { unsafe {
ffi::gst_query_add_allocation_meta( ffi::gst_query_add_allocation_meta(
self.0.as_mut_ptr(), self.0.as_mut_ptr(),
U::meta_api().to_glib(), U::meta_api().into_glib(),
if let Some(structure) = structure { if let Some(structure) = structure {
structure.as_ptr() structure.as_ptr()
} else { } else {
@ -1046,7 +1053,7 @@ impl<T: AsPtr> Scheduling<T> {
unsafe { unsafe {
from_glib(ffi::gst_query_has_scheduling_mode( from_glib(ffi::gst_query_has_scheduling_mode(
self.0.as_ptr(), self.0.as_ptr(),
mode.to_glib(), mode.into_glib(),
)) ))
} }
} }
@ -1060,8 +1067,8 @@ impl<T: AsPtr> Scheduling<T> {
unsafe { unsafe {
from_glib(ffi::gst_query_has_scheduling_mode_with_flags( from_glib(ffi::gst_query_has_scheduling_mode_with_flags(
self.0.as_ptr(), self.0.as_ptr(),
mode.to_glib(), mode.into_glib(),
flags.to_glib(), flags.into_glib(),
)) ))
} }
} }
@ -1110,7 +1117,7 @@ impl<T: AsMutPtr> Scheduling<T> {
pub fn add_scheduling_modes(&mut self, modes: &[crate::PadMode]) { pub fn add_scheduling_modes(&mut self, modes: &[crate::PadMode]) {
unsafe { unsafe {
for mode in modes { 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<T: AsMutPtr> Scheduling<T> {
unsafe { unsafe {
ffi::gst_query_set_scheduling( ffi::gst_query_set_scheduling(
self.0.as_mut_ptr(), self.0.as_mut_ptr(),
flags.to_glib(), flags.into_glib(),
minsize, minsize,
maxsize, maxsize,
align, align,
@ -1165,7 +1172,7 @@ impl<T: AsPtr> AcceptCaps<T> {
impl<T: AsMutPtr> AcceptCaps<T> { impl<T: AsMutPtr> AcceptCaps<T> {
pub fn set_result(&mut self, accepted: bool) { pub fn set_result(&mut self, accepted: bool) {
unsafe { 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());
} }
} }
} }

View file

@ -19,12 +19,12 @@ pub struct FormattedSegment<T: FormattedValue>(ffi::GstSegment, PhantomData<T>);
impl Segment { impl Segment {
pub fn reset_with_format(&mut self, format: Format) { pub fn reset_with_format(&mut self, format: Format) {
unsafe { 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) { pub fn set_format(&mut self, format: Format) {
self.0.format = format.to_glib(); self.0.format = format.into_glib();
} }
pub fn downcast<T: FormattedValue>(self) -> Result<FormattedSegment<T>, Self> { pub fn downcast<T: FormattedValue>(self) -> Result<FormattedSegment<T>, Self> {
@ -63,7 +63,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let segment = unsafe { let segment = unsafe {
let mut segment = mem::MaybeUninit::zeroed(); 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() segment.assume_init()
}; };
FormattedSegment(segment, PhantomData) FormattedSegment(segment, PhantomData)
@ -81,7 +81,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
pub fn reset(&mut self) { pub fn reset(&mut self) {
unsafe { 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<T: FormattedValue> FormattedSegment<T> {
let mut clip_stop = mem::MaybeUninit::uninit(); let mut clip_stop = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_segment_clip( let ret = from_glib(ffi::gst_segment_clip(
&self.0, &self.0,
start.format().to_glib(), start.format().into_glib(),
start.to_raw_value() as u64, start.to_raw_value() as u64,
stop.to_raw_value() as u64, stop.to_raw_value() as u64,
clip_start.as_mut_ptr(), clip_start.as_mut_ptr(),
@ -140,11 +140,11 @@ impl<T: FormattedValue> FormattedSegment<T> {
let ret = from_glib(ffi::gst_segment_do_seek( let ret = from_glib(ffi::gst_segment_do_seek(
&mut self.0, &mut self.0,
rate, rate,
self.format().to_glib(), self.format().into_glib(),
flags.to_glib(), flags.into_glib(),
start_type.to_glib(), start_type.into_glib(),
start.to_raw_value() as u64, start.to_raw_value() as u64,
stop_type.to_glib(), stop_type.into_glib(),
stop.to_raw_value() as u64, stop.to_raw_value() as u64,
update.as_mut_ptr(), update.as_mut_ptr(),
)); ));
@ -159,7 +159,11 @@ impl<T: FormattedValue> FormattedSegment<T> {
pub fn offset_running_time(&mut self, offset: i64) -> Result<(), glib::BoolError> { pub fn offset_running_time(&mut self, offset: i64) -> Result<(), glib::BoolError> {
unsafe { unsafe {
glib::result_from_gboolean!( 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" "Offset is not in the segment"
) )
} }
@ -177,7 +181,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
self.format(), self.format(),
ffi::gst_segment_position_from_running_time( ffi::gst_segment_position_from_running_time(
&self.0, &self.0,
self.format().to_glib(), self.format().into_glib(),
running_time.to_raw_value() as u64, running_time.to_raw_value() as u64,
) as i64, ) as i64,
) )
@ -195,7 +199,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
let mut position = mem::MaybeUninit::uninit(); let mut position = mem::MaybeUninit::uninit();
let ret = ffi::gst_segment_position_from_running_time_full( let ret = ffi::gst_segment_position_from_running_time_full(
&self.0, &self.0,
self.format().to_glib(), self.format().into_glib(),
running_time.to_raw_value() as u64, running_time.to_raw_value() as u64,
position.as_mut_ptr(), position.as_mut_ptr(),
); );
@ -218,7 +222,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
self.format(), self.format(),
ffi::gst_segment_position_from_stream_time( ffi::gst_segment_position_from_stream_time(
&self.0, &self.0,
self.format().to_glib(), self.format().into_glib(),
stream_time.to_raw_value() as u64, stream_time.to_raw_value() as u64,
) as i64, ) as i64,
) )
@ -236,7 +240,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
let mut position = mem::MaybeUninit::uninit(); let mut position = mem::MaybeUninit::uninit();
let ret = ffi::gst_segment_position_from_stream_time_full( let ret = ffi::gst_segment_position_from_stream_time_full(
&self.0, &self.0,
self.format().to_glib(), self.format().into_glib(),
stream_time.to_raw_value() as u64, stream_time.to_raw_value() as u64,
position.as_mut_ptr(), position.as_mut_ptr(),
); );
@ -258,7 +262,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
glib::result_from_gboolean!( glib::result_from_gboolean!(
ffi::gst_segment_set_running_time( ffi::gst_segment_set_running_time(
&mut self.0, &mut self.0,
self.format().to_glib(), self.format().into_glib(),
running_time.to_raw_value() as u64, running_time.to_raw_value() as u64,
), ),
"Running time is not in the segment" "Running time is not in the segment"
@ -278,7 +282,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
self.format(), self.format(),
ffi::gst_segment_to_running_time( ffi::gst_segment_to_running_time(
&self.0, &self.0,
self.format().to_glib(), self.format().into_glib(),
position.to_raw_value() as u64, position.to_raw_value() as u64,
) as i64, ) as i64,
) )
@ -296,7 +300,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
let mut running_time = mem::MaybeUninit::uninit(); let mut running_time = mem::MaybeUninit::uninit();
let ret = ffi::gst_segment_to_running_time_full( let ret = ffi::gst_segment_to_running_time_full(
&self.0, &self.0,
self.format().to_glib(), self.format().into_glib(),
position.to_raw_value() as u64, position.to_raw_value() as u64,
running_time.as_mut_ptr(), running_time.as_mut_ptr(),
); );
@ -319,7 +323,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
self.format(), self.format(),
ffi::gst_segment_to_stream_time( ffi::gst_segment_to_stream_time(
&self.0, &self.0,
self.format().to_glib(), self.format().into_glib(),
position.to_raw_value() as u64, position.to_raw_value() as u64,
) as i64, ) as i64,
) )
@ -337,7 +341,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
let mut stream_time = mem::MaybeUninit::uninit(); let mut stream_time = mem::MaybeUninit::uninit();
let ret = ffi::gst_segment_to_stream_time_full( let ret = ffi::gst_segment_to_stream_time_full(
&self.0, &self.0,
self.format().to_glib(), self.format().into_glib(),
position.to_raw_value() as u64, position.to_raw_value() as u64,
stream_time.as_mut_ptr(), stream_time.as_mut_ptr(),
); );
@ -353,7 +357,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
} }
pub fn set_flags(&mut self, flags: crate::SegmentFlags) { 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 { pub fn rate(&self) -> f64 {

View file

@ -24,8 +24,8 @@ impl Stream {
from_glib_full(ffi::gst_stream_new( from_glib_full(ffi::gst_stream_new(
stream_id.0, stream_id.0,
caps.0, caps.0,
type_.to_glib(), type_.into_glib(),
flags.to_glib(), flags.into_glib(),
)) ))
} }
} else { } else {
@ -34,8 +34,8 @@ impl Stream {
from_glib_none(ffi::gst_stream_new( from_glib_none(ffi::gst_stream_new(
stream_id.0, stream_id.0,
caps.0, caps.0,
type_.to_glib(), type_.into_glib(),
flags.to_glib(), flags.into_glib(),
)) ))
} }
} }

View file

@ -424,7 +424,7 @@ impl StructureRef {
pub fn value_by_quark(&self, name: glib::Quark) -> Result<&SendValue, GetError> { pub fn value_by_quark(&self, name: glib::Quark) -> Result<&SendValue, GetError> {
unsafe { 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() { if value.is_null() {
return Err(GetError::new_field_not_found(name.to_string())); 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) { pub fn set_value_by_quark(&mut self, name: glib::Quark, value: SendValue) {
unsafe { unsafe {
let mut value = value.into_raw(); 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( from_glib(ffi::gst_structure_has_field_typed(
&self.0, &self.0,
field.to_glib_none().0, field.to_glib_none().0,
type_.to_glib(), type_.into_glib(),
)) ))
} }
} }
pub fn has_field_by_quark(&self, field: glib::Quark) -> bool { 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 { pub fn has_field_with_type_by_quark(&self, field: glib::Quark, type_: glib::Type) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_structure_id_has_field_typed( from_glib(ffi::gst_structure_id_has_field_typed(
&self.0, &self.0,
field.to_glib(), field.into_glib(),
type_.to_glib(), type_.into_glib(),
)) ))
} }
} }
@ -578,7 +578,7 @@ impl StructureRef {
from_glib(ffi::gst_structure_fixate_field_boolean( from_glib(ffi::gst_structure_fixate_field_boolean(
&mut self.0, &mut self.0,
name.to_glib_none().0, name.to_glib_none().0,
target.to_glib(), target.into_glib(),
)) ))
} }
} }

Some files were not shown because too many files have changed in this diff Show more