rename ToGlib into IntoGlib

This commit is contained in:
Bilal Elmoussaoui 2021-04-27 17:21:54 +02:00
parent 75959e8c63
commit 78d9fb521d
5 changed files with 35 additions and 35 deletions

View file

@ -38,11 +38,11 @@ unsafe impl glib::SendUnique for RTPJitterBuffer {
}
}
impl ToGlib for RTPJitterBufferMode {
impl IntoGlib for RTPJitterBufferMode {
type GlibType = ffi::RTPJitterBufferMode;
fn to_glib(&self) -> ffi::RTPJitterBufferMode {
match *self {
fn into_glib(self) -> ffi::RTPJitterBufferMode {
match self {
RTPJitterBufferMode::None => ffi::RTP_JITTER_BUFFER_MODE_NONE,
RTPJitterBufferMode::Slave => ffi::RTP_JITTER_BUFFER_MODE_SLAVE,
RTPJitterBufferMode::Buffer => ffi::RTP_JITTER_BUFFER_MODE_BUFFER,
@ -88,8 +88,8 @@ impl RTPJitterBufferItem {
next: ptr::null_mut(),
prev: ptr::null_mut(),
r#type: 0,
dts: dts.to_glib(),
pts: pts.to_glib(),
dts: dts.into_glib(),
pts: pts.into_glib(),
seqnum: seqnum.map(|s| s as u32).unwrap_or(std::u32::MAX),
count: 1,
rtptime,
@ -229,7 +229,7 @@ impl RTPJitterBuffer {
#[allow(dead_code)]
pub fn set_mode(&self, mode: RTPJitterBufferMode) {
unsafe { ffi::rtp_jitter_buffer_set_mode(self.to_glib_none().0, mode.to_glib()) }
unsafe { ffi::rtp_jitter_buffer_set_mode(self.to_glib_none().0, mode.into_glib()) }
}
#[allow(dead_code)]
@ -238,7 +238,7 @@ impl RTPJitterBuffer {
}
pub fn set_delay(&self, delay: gst::ClockTime) {
unsafe { ffi::rtp_jitter_buffer_set_delay(self.to_glib_none().0, delay.to_glib()) }
unsafe { ffi::rtp_jitter_buffer_set_delay(self.to_glib_none().0, delay.into_glib()) }
}
pub fn set_clock_rate(&self, clock_rate: u32) {
@ -262,12 +262,12 @@ impl RTPJitterBuffer {
unsafe {
let pts = ffi::rtp_jitter_buffer_calculate_pts(
self.to_glib_none().0,
dts.to_glib(),
estimated_dts.to_glib(),
dts.into_glib(),
estimated_dts.into_glib(),
rtptime,
base_time.to_glib(),
base_time.into_glib(),
gap,
is_rtx.to_glib(),
is_rtx.into_glib(),
);
if pts == gst::ffi::GST_CLOCK_TIME_NONE {

View file

@ -74,7 +74,7 @@ pub fn set_element_flags<T: glib::IsA<gst::Object> + glib::IsA<gst::Element>>(
unsafe {
let ptr: *mut gst::ffi::GstObject = element.as_ptr() as *mut _;
let _guard = MutexGuard::lock(&(*ptr).lock);
(*ptr).flags |= flags.to_glib();
(*ptr).flags |= flags.into_glib();
}
}

View file

@ -98,8 +98,8 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
unsafe {
ffi::gst_aggregator_set_latency(
self.as_ref().to_glib_none().0,
min_latency.to_glib(),
max_latency.to_glib(),
min_latency.into_glib(),
max_latency.into_glib(),
);
}
}

View file

@ -421,8 +421,8 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
Some(f) => gst::result_from_gboolean!(
f(
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
mode.to_glib(),
active.to_glib()
mode.into_glib(),
active.into_glib()
),
gst::CAT_RUST,
"Parent function `src_activate` failed"
@ -444,7 +444,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
.expect("Missing parent function `aggregate`");
gst::FlowReturn::from_glib(f(
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
timeout.to_glib(),
timeout.into_glib(),
))
.into_result()
}
@ -656,7 +656,7 @@ unsafe extern "C" fn aggregator_flush<T: AggregatorImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
imp.flush(wrap.unsafe_cast_ref()).into()
})
.to_glib()
.into_glib()
}
unsafe extern "C" fn aggregator_clip<T: AggregatorImpl>(
@ -691,7 +691,7 @@ unsafe extern "C" fn aggregator_finish_buffer<T: AggregatorImpl>(
imp.finish_buffer(wrap.unsafe_cast_ref(), from_glib_full(buffer))
.into()
})
.to_glib()
.into_glib()
}
unsafe extern "C" fn aggregator_sink_event<T: AggregatorImpl>(
@ -710,7 +710,7 @@ unsafe extern "C" fn aggregator_sink_event<T: AggregatorImpl>(
from_glib_full(event),
)
})
.to_glib()
.into_glib()
}
unsafe extern "C" fn aggregator_sink_event_pre_queue<T: AggregatorImpl>(
@ -730,7 +730,7 @@ unsafe extern "C" fn aggregator_sink_event_pre_queue<T: AggregatorImpl>(
)
.into()
})
.to_glib()
.into_glib()
}
unsafe extern "C" fn aggregator_sink_query<T: AggregatorImpl>(
@ -749,7 +749,7 @@ unsafe extern "C" fn aggregator_sink_query<T: AggregatorImpl>(
gst::QueryRef::from_mut_ptr(query),
)
})
.to_glib()
.into_glib()
}
unsafe extern "C" fn aggregator_sink_query_pre_queue<T: AggregatorImpl>(
@ -768,7 +768,7 @@ unsafe extern "C" fn aggregator_sink_query_pre_queue<T: AggregatorImpl>(
gst::QueryRef::from_mut_ptr(query),
)
})
.to_glib()
.into_glib()
}
unsafe extern "C" fn aggregator_src_event<T: AggregatorImpl>(
@ -782,7 +782,7 @@ unsafe extern "C" fn aggregator_src_event<T: AggregatorImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
})
.to_glib()
.into_glib()
}
unsafe extern "C" fn aggregator_src_query<T: AggregatorImpl>(
@ -796,7 +796,7 @@ unsafe extern "C" fn aggregator_src_query<T: AggregatorImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
})
.to_glib()
.into_glib()
}
unsafe extern "C" fn aggregator_src_activate<T: AggregatorImpl>(
@ -817,7 +817,7 @@ unsafe extern "C" fn aggregator_src_activate<T: AggregatorImpl>(
}
}
})
.to_glib()
.into_glib()
}
unsafe extern "C" fn aggregator_aggregate<T: AggregatorImpl>(
@ -832,7 +832,7 @@ unsafe extern "C" fn aggregator_aggregate<T: AggregatorImpl>(
imp.aggregate(wrap.unsafe_cast_ref(), from_glib(timeout))
.into()
})
.to_glib()
.into_glib()
}
unsafe extern "C" fn aggregator_start<T: AggregatorImpl>(
@ -851,7 +851,7 @@ unsafe extern "C" fn aggregator_start<T: AggregatorImpl>(
}
}
})
.to_glib()
.into_glib()
}
unsafe extern "C" fn aggregator_stop<T: AggregatorImpl>(
@ -870,7 +870,7 @@ unsafe extern "C" fn aggregator_stop<T: AggregatorImpl>(
}
}
})
.to_glib()
.into_glib()
}
unsafe extern "C" fn aggregator_get_next_time<T: AggregatorImpl>(
@ -883,7 +883,7 @@ unsafe extern "C" fn aggregator_get_next_time<T: AggregatorImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), gst::CLOCK_TIME_NONE, {
imp.next_time(wrap.unsafe_cast_ref())
})
.to_glib()
.into_glib()
}
unsafe extern "C" fn aggregator_create_new_pad<T: AggregatorImpl>(
@ -931,7 +931,7 @@ unsafe extern "C" fn aggregator_update_src_caps<T: AggregatorImpl>(
Err(err) => err.into(),
}
})
.to_glib()
.into_glib()
}
unsafe extern "C" fn aggregator_fixate_src_caps<T: AggregatorImpl>(
@ -965,7 +965,7 @@ unsafe extern "C" fn aggregator_negotiated_src_caps<T: AggregatorImpl>(
}
}
})
.to_glib()
.into_glib()
}
unsafe extern "C" fn aggregator_negotiate<T: AggregatorImpl>(
@ -978,5 +978,5 @@ unsafe extern "C" fn aggregator_negotiate<T: AggregatorImpl>(
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
imp.negotiate(wrap.unsafe_cast_ref())
})
.to_glib()
.into_glib()
}

View file

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