mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 09:31:06 +00:00
Fix various new 1.79 clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1467>
This commit is contained in:
parent
4c3146d5bd
commit
529b91b524
35 changed files with 103 additions and 89 deletions
|
@ -10,8 +10,6 @@
|
|||
// This is the format we request:
|
||||
// Audio / Signed 16bit / 1 channel / arbitrary sample rate
|
||||
|
||||
use std::i16;
|
||||
|
||||
use anyhow::Error;
|
||||
use byte_slice_cast::*;
|
||||
use derive_more::{Display, Error};
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
// {audiotestsrc} - {fakesink}
|
||||
#![allow(clippy::question_mark)]
|
||||
|
||||
use std::i16;
|
||||
|
||||
use byte_slice_cast::*;
|
||||
use gst::prelude::*;
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ void main() {
|
|||
#[allow(clippy::too_many_arguments)]
|
||||
#[allow(clippy::manual_non_exhaustive)]
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
#[allow(clippy::missing_transmute_annotations)]
|
||||
pub(crate) mod gl {
|
||||
pub use self::Gles2 as Gl;
|
||||
include!(concat!(env!("OUT_DIR"), "/test_gl_bindings.rs"));
|
||||
|
|
|
@ -484,7 +484,7 @@ macro_rules! define_mtd_iter {
|
|||
meta,
|
||||
state: std::ptr::null_mut(),
|
||||
mtd_type: T::mtd_type(),
|
||||
an_meta_id: std::u32::MAX,
|
||||
an_meta_id: u32::MAX,
|
||||
rel_type: RelTypes::ANY.into_glib(),
|
||||
phantom: PhantomData,
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ macro_rules! define_mtd_iter {
|
|||
unsafe {
|
||||
let mut mtd = ffi::GstAnalyticsMtd::unsafe_from(&**self.meta);
|
||||
let ret = {
|
||||
if self.an_meta_id == std::u32::MAX {
|
||||
if self.an_meta_id == u32::MAX {
|
||||
ffi::gst_analytics_relation_meta_iterate(
|
||||
self.meta.as_mut_ptr(),
|
||||
&mut self.state,
|
||||
|
|
|
@ -652,7 +652,7 @@ impl AppSink {
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::async\0".as_ptr() as *const _,
|
||||
Some(mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_async_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
@ -680,7 +680,7 @@ impl AppSink {
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::blocksize\0".as_ptr() as *const _,
|
||||
Some(mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_blocksize_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
@ -708,7 +708,7 @@ impl AppSink {
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::enable-last-sample\0".as_ptr() as *const _,
|
||||
Some(mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_enable_last_sample_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
@ -736,7 +736,7 @@ impl AppSink {
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::last-sample\0".as_ptr() as *const _,
|
||||
Some(mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_last_sample_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
@ -764,7 +764,7 @@ impl AppSink {
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::max-bitrate\0".as_ptr() as *const _,
|
||||
Some(mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_max_bitrate_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
@ -792,7 +792,7 @@ impl AppSink {
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::max-lateness\0".as_ptr() as *const _,
|
||||
Some(mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_max_lateness_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
@ -822,7 +822,7 @@ impl AppSink {
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::processing-deadline\0".as_ptr() as *const _,
|
||||
Some(mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_processing_deadline_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
@ -848,7 +848,7 @@ impl AppSink {
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::qos\0".as_ptr() as *const _,
|
||||
Some(mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_qos_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
@ -876,7 +876,7 @@ impl AppSink {
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::render-delay\0".as_ptr() as *const _,
|
||||
Some(mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_render_delay_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
@ -904,7 +904,7 @@ impl AppSink {
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::stats\0".as_ptr() as *const _,
|
||||
Some(mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_stats_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
@ -930,7 +930,7 @@ impl AppSink {
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::sync\0".as_ptr() as *const _,
|
||||
Some(mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_sync_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
@ -958,7 +958,7 @@ impl AppSink {
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::throttle-time\0".as_ptr() as *const _,
|
||||
Some(mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_throttle_time_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
@ -986,7 +986,7 @@ impl AppSink {
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::ts-offset\0".as_ptr() as *const _,
|
||||
Some(mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_ts_offset_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
|
|
@ -329,7 +329,7 @@ impl AppSrc {
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::do-timestamp\0".as_ptr() as *const _,
|
||||
Some(mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_do_timestamp_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
|
|
@ -68,7 +68,7 @@ pub trait AudioAggregatorExtManual: sealed::Sealed + IsA<AudioAggregator> + 'sta
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::output-buffer-duration-fraction\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_output_buffer_duration_fraction_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
|
|
@ -52,7 +52,7 @@ pub trait AudioAggregatorConvertPadExtManual:
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::converter-config\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_converter_config_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||
|
||||
use std::i32;
|
||||
|
||||
use glib::translate::{from_glib_full, IntoGlibPtr, ToGlibPtr};
|
||||
|
||||
#[doc(alias = "gst_audio_buffer_clip")]
|
||||
|
@ -39,7 +37,7 @@ pub fn audio_buffer_truncate(
|
|||
buffer.into_glib_ptr(),
|
||||
bpf as i32,
|
||||
trim,
|
||||
samples.unwrap_or(std::usize::MAX),
|
||||
samples.unwrap_or(usize::MAX),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -602,8 +602,8 @@ unsafe extern "C" fn audio_decoder_parse<T: AudioDecoderImpl>(
|
|||
gst::panic_to_error!(imp, gst::FlowReturn::Error, {
|
||||
match imp.parse(&from_glib_borrow(adapter)) {
|
||||
Ok((new_offset, new_len)) => {
|
||||
assert!(new_offset <= std::i32::MAX as u32);
|
||||
assert!(new_len <= std::i32::MAX as u32);
|
||||
assert!(new_offset <= i32::MAX as u32);
|
||||
assert!(new_len <= i32::MAX as u32);
|
||||
*offset = new_offset as i32;
|
||||
*len = new_len as i32;
|
||||
Ok(gst::FlowSuccess::Ok)
|
||||
|
|
|
@ -65,7 +65,7 @@ pub trait AggregatorExtManual: sealed::Sealed + IsA<Aggregator> + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::min-upstream-latency\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_min_upstream_latency_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -184,7 +184,7 @@ pub trait AggregatorExtManual: sealed::Sealed + IsA<Aggregator> + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"samples-selected\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(transmute::<*const (), unsafe extern "C" fn()>(
|
||||
samples_selected_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -29,7 +29,7 @@ impl Discoverer {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::timeout\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_timeout_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -34,7 +34,7 @@ impl PlaySignalAdapter {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"duration-changed\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(transmute::<*const (), unsafe extern "C" fn()>(
|
||||
duration_changed_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -65,7 +65,7 @@ impl PlaySignalAdapter {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"position-updated\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(transmute::<*const (), unsafe extern "C" fn()>(
|
||||
position_updated_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -97,7 +97,7 @@ impl PlaySignalAdapter {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"seek-done\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(transmute::<*const (), unsafe extern "C" fn()>(
|
||||
seek_done_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -37,7 +37,7 @@ impl Player {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"duration-changed\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(transmute::<*const (), unsafe extern "C" fn()>(
|
||||
duration_changed_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -55,7 +55,7 @@ impl Player {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"position-updated\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(transmute::<*const (), unsafe extern "C" fn()>(
|
||||
position_updated_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
@ -73,7 +73,7 @@ impl Player {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"seek-done\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(transmute::<*const (), unsafe extern "C" fn()>(
|
||||
seek_done_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -45,7 +45,7 @@ pub trait RTPBaseDepayloadExtManual: sealed::Sealed + IsA<RTPBaseDepayload> + 's
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::extensions\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_extensions_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
|
|
@ -62,7 +62,7 @@ pub trait RTPBasePayloadExtManual: sealed::Sealed + IsA<RTPBasePayload> + 'stati
|
|||
glib::signal::connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::extensions\0".as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_extensions_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
|
|
@ -45,7 +45,7 @@ pub trait RTSPAuthExtManual: sealed::Sealed + IsA<RTSPAuth> + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"accept-certificate\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(transmute::<*const (), unsafe extern "C" fn()>(
|
||||
accept_certificate_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -53,7 +53,7 @@ pub trait RTSPSessionPoolExtManual: sealed::Sealed + IsA<RTSPSessionPool> + 'sta
|
|||
glib::ffi::g_source_set_callback(
|
||||
source,
|
||||
Some(transmute::<
|
||||
_,
|
||||
*const (),
|
||||
unsafe extern "C" fn(glib::ffi::gpointer) -> i32,
|
||||
>(trampoline_watch::<F> as *const ())),
|
||||
into_raw_watch(func),
|
||||
|
|
|
@ -241,9 +241,10 @@ unsafe extern "C" fn factory_create_pipeline<T: RTSPMediaFactoryImpl>(
|
|||
media as *mut _,
|
||||
pipeline_quark.into_glib(),
|
||||
pipeline as *mut _,
|
||||
Some(transmute::<_, unsafe extern "C" fn(glib::ffi::gpointer)>(
|
||||
glib::gobject_ffi::g_object_unref as *const (),
|
||||
)),
|
||||
Some(transmute::<
|
||||
*const (),
|
||||
unsafe extern "C" fn(glib::ffi::gpointer),
|
||||
>(glib::gobject_ffi::g_object_unref as *const ())),
|
||||
);
|
||||
|
||||
pipeline as *mut _
|
||||
|
|
|
@ -107,7 +107,7 @@ impl FromGlib<ffi::GstValidateActionReturn> for ActionReturn {
|
|||
{
|
||||
ActionReturn::Error
|
||||
} else {
|
||||
std::mem::transmute(value)
|
||||
std::mem::transmute::<i32, ActionReturn>(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,21 +129,21 @@ impl ActionReturn {
|
|||
pub fn into_result(self) -> Result<ActionSuccess, ActionError> {
|
||||
match self {
|
||||
Self::Error | Self::ErrorReported | Self::None => {
|
||||
Err(unsafe { std::mem::transmute(self) })
|
||||
Err(unsafe { std::mem::transmute::<ActionReturn, ActionError>(self) })
|
||||
}
|
||||
_ => Ok(unsafe { std::mem::transmute(self) }),
|
||||
_ => Ok(unsafe { std::mem::transmute::<ActionReturn, ActionSuccess>(self) }),
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn from_error(v: ActionError) -> Self {
|
||||
skip_assert_initialized!();
|
||||
unsafe { std::mem::transmute(v) }
|
||||
unsafe { std::mem::transmute::<ActionError, ActionReturn>(v) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn from_ok(v: ActionSuccess) -> Self {
|
||||
skip_assert_initialized!();
|
||||
unsafe { std::mem::transmute(v) }
|
||||
unsafe { std::mem::transmute::<ActionSuccess, ActionReturn>(v) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||
|
||||
use std::{i32, mem, ptr};
|
||||
use std::{mem, ptr};
|
||||
|
||||
use glib::translate::{from_glib, from_glib_full, IntoGlib, ToGlibPtr};
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ pub trait VideoAggregatorConvertPadExtManual:
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"notify::converter-config\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(transmute::<*const (), unsafe extern "C" fn()>(
|
||||
notify_converter_config_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box::into_raw(f),
|
||||
|
|
|
@ -151,8 +151,18 @@ impl VideoMasteringDisplayInfo {
|
|||
skip_assert_initialized!();
|
||||
|
||||
VideoMasteringDisplayInfo(ffi::GstVideoMasteringDisplayInfo {
|
||||
display_primaries: unsafe { mem::transmute(display_primaries) },
|
||||
white_point: unsafe { mem::transmute(white_point) },
|
||||
display_primaries: unsafe {
|
||||
mem::transmute::<
|
||||
[VideoMasteringDisplayInfoCoordinate; 3],
|
||||
[ffi::GstVideoMasteringDisplayInfoCoordinates; 3],
|
||||
>(display_primaries)
|
||||
},
|
||||
white_point: unsafe {
|
||||
mem::transmute::<
|
||||
VideoMasteringDisplayInfoCoordinate,
|
||||
ffi::GstVideoMasteringDisplayInfoCoordinates,
|
||||
>(white_point)
|
||||
},
|
||||
max_display_mastering_luminance,
|
||||
min_display_mastering_luminance,
|
||||
_gst_reserved: [ptr::null_mut(); 4],
|
||||
|
@ -167,7 +177,12 @@ impl VideoMasteringDisplayInfo {
|
|||
&mut self,
|
||||
display_primaries: [VideoMasteringDisplayInfoCoordinate; 3],
|
||||
) {
|
||||
self.0.display_primaries = unsafe { mem::transmute(display_primaries) };
|
||||
self.0.display_primaries = unsafe {
|
||||
mem::transmute::<
|
||||
[VideoMasteringDisplayInfoCoordinate; 3],
|
||||
[ffi::GstVideoMasteringDisplayInfoCoordinates; 3],
|
||||
>(display_primaries)
|
||||
};
|
||||
}
|
||||
|
||||
pub fn white_point(&self) -> VideoMasteringDisplayInfoCoordinate {
|
||||
|
@ -175,7 +190,12 @@ impl VideoMasteringDisplayInfo {
|
|||
}
|
||||
|
||||
pub fn set_white_point(&mut self, white_point: VideoMasteringDisplayInfoCoordinate) {
|
||||
self.0.white_point = unsafe { mem::transmute(white_point) };
|
||||
self.0.white_point = unsafe {
|
||||
mem::transmute::<
|
||||
VideoMasteringDisplayInfoCoordinate,
|
||||
ffi::GstVideoMasteringDisplayInfoCoordinates,
|
||||
>(white_point)
|
||||
};
|
||||
}
|
||||
|
||||
pub fn max_display_mastering_luminance(&self) -> u32 {
|
||||
|
|
|
@ -95,7 +95,7 @@ pub trait GstBinExtManual: sealed::Sealed + IsA<Bin> + 'static {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
b"do-latency\0".as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(transmute::<*const (), unsafe extern "C" fn()>(
|
||||
do_latency_trampoline::<Self, F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::{
|
|||
marker::PhantomData,
|
||||
mem, ops,
|
||||
ops::{Bound, ControlFlow, Range, RangeBounds},
|
||||
ptr, slice, u64, usize,
|
||||
ptr, slice,
|
||||
};
|
||||
|
||||
use glib::translate::*;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||
|
||||
use std::{fmt, io, marker::PhantomData, mem, ptr, u64, usize};
|
||||
use std::{fmt, io, marker::PhantomData, mem, ptr};
|
||||
|
||||
use crate::{
|
||||
buffer::{Readable, Writable},
|
||||
|
|
|
@ -120,7 +120,7 @@ impl Bus {
|
|||
glib::ffi::g_source_set_callback(
|
||||
source,
|
||||
Some(transmute::<
|
||||
_,
|
||||
*const (),
|
||||
unsafe extern "C" fn(glib::ffi::gpointer) -> i32,
|
||||
>(trampoline_watch::<F> as *const ())),
|
||||
into_raw_watch(func),
|
||||
|
|
|
@ -76,7 +76,7 @@ impl StateChangeReturn {
|
|||
pub fn into_result(self) -> Result<StateChangeSuccess, StateChangeError> {
|
||||
match self {
|
||||
StateChangeReturn::Failure => Err(StateChangeError),
|
||||
_ => Ok(unsafe { std::mem::transmute(self) }),
|
||||
_ => Ok(unsafe { std::mem::transmute::<StateChangeReturn, StateChangeSuccess>(self) }),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ impl FromGlib<ffi::GstFlowReturn> for FlowReturn {
|
|||
{
|
||||
FlowReturn::Ok
|
||||
} else {
|
||||
std::mem::transmute(value)
|
||||
std::mem::transmute::<i32, FlowReturn>(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -225,9 +225,9 @@ impl FlowReturn {
|
|||
#[inline]
|
||||
pub fn into_result(self) -> Result<FlowSuccess, FlowError> {
|
||||
if self.into_glib() >= 0 {
|
||||
Ok(unsafe { std::mem::transmute(self) })
|
||||
Ok(unsafe { std::mem::transmute::<FlowReturn, FlowSuccess>(self) })
|
||||
} else {
|
||||
Err(unsafe { std::mem::transmute(self) })
|
||||
Err(unsafe { std::mem::transmute::<FlowReturn, FlowError>(self) })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ impl FromGlib<ffi::GstPadLinkReturn> for PadLinkReturn {
|
|||
} else if value < ffi::GST_PAD_LINK_REFUSED {
|
||||
PadLinkReturn::Refused
|
||||
} else {
|
||||
std::mem::transmute(value)
|
||||
std::mem::transmute::<i32, PadLinkReturn>(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ impl PadLinkReturn {
|
|||
if self == PadLinkReturn::Ok {
|
||||
Ok(PadLinkSuccess)
|
||||
} else {
|
||||
Err(unsafe { std::mem::transmute(self) })
|
||||
Err(unsafe { std::mem::transmute::<PadLinkReturn, PadLinkError>(self) })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ impl ClockReturn {
|
|||
match self {
|
||||
ClockReturn::Ok => Ok(ClockSuccess::Ok),
|
||||
ClockReturn::Done => Ok(ClockSuccess::Done),
|
||||
_ => Err(unsafe { std::mem::transmute(self) }),
|
||||
_ => Err(unsafe { std::mem::transmute::<ClockReturn, ClockError>(self) }),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -565,8 +565,8 @@ impl TryFrom<Duration> for ClockTime {
|
|||
|
||||
let nanos = d.as_nanos();
|
||||
|
||||
// Note: `std::u64::MAX` is `ClockTime::NONE`.
|
||||
if nanos >= std::u64::MAX as u128 {
|
||||
// Note: `u64::MAX` is `ClockTime::NONE`.
|
||||
if nanos >= u64::MAX as u128 {
|
||||
return Err(DurationError);
|
||||
}
|
||||
|
||||
|
@ -1305,7 +1305,7 @@ mod tests {
|
|||
fn display() {
|
||||
let none = Option::<ClockTime>::None;
|
||||
let some = Some(45_834_908_569_837 * ClockTime::NSECOND);
|
||||
let lots = ClockTime::from_nseconds(std::u64::MAX - 1);
|
||||
let lots = ClockTime::from_nseconds(u64::MAX - 1);
|
||||
|
||||
// Simple
|
||||
|
||||
|
|
|
@ -1452,12 +1452,12 @@ macro_rules! impl_signed_div_mul_trait(
|
|||
match self {
|
||||
Positive(lhs) => {
|
||||
$into_inner(lhs)
|
||||
.mul_div_floor(num.abs() as $inner, denom.abs() as $inner)
|
||||
.mul_div_floor(num.unsigned_abs(), denom.unsigned_abs())
|
||||
.and_then(|val| Self::signed_from_inner(val, num.signum() * denom.signum()))
|
||||
}
|
||||
Negative(lhs) => {
|
||||
$into_inner(lhs)
|
||||
.mul_div_floor(num.abs() as $inner, denom.abs() as $inner)
|
||||
.mul_div_floor(num.unsigned_abs(), denom.unsigned_abs())
|
||||
.and_then(|val| Self::signed_from_inner(val, -num.signum() * denom.signum()))
|
||||
}
|
||||
}
|
||||
|
@ -1469,12 +1469,12 @@ macro_rules! impl_signed_div_mul_trait(
|
|||
match self {
|
||||
Positive(lhs) => {
|
||||
$into_inner(lhs)
|
||||
.mul_div_round(num.abs() as $inner, denom.abs() as $inner)
|
||||
.mul_div_round(num.unsigned_abs(), denom.unsigned_abs())
|
||||
.and_then(|val| Self::signed_from_inner(val, num.signum() * denom.signum()))
|
||||
}
|
||||
Negative(lhs) => {
|
||||
$into_inner(lhs)
|
||||
.mul_div_round(num.abs() as $inner, denom.abs() as $inner)
|
||||
.mul_div_round(num.unsigned_abs(), denom.unsigned_abs())
|
||||
.and_then(|val| Self::signed_from_inner(val, -num.signum() * denom.signum()))
|
||||
}
|
||||
}
|
||||
|
@ -1486,12 +1486,12 @@ macro_rules! impl_signed_div_mul_trait(
|
|||
match self {
|
||||
Positive(lhs) => {
|
||||
$into_inner(lhs)
|
||||
.mul_div_ceil(num.abs() as $inner, denom.abs() as $inner)
|
||||
.mul_div_ceil(num.unsigned_abs(), denom.unsigned_abs())
|
||||
.and_then(|val| Self::signed_from_inner(val, num.signum() * denom.signum()))
|
||||
}
|
||||
Negative(lhs) => {
|
||||
$into_inner(lhs)
|
||||
.mul_div_ceil(num.abs() as $inner, denom.abs() as $inner)
|
||||
.mul_div_ceil(num.unsigned_abs(), denom.unsigned_abs())
|
||||
.and_then(|val| Self::signed_from_inner(val, -num.signum() * denom.signum()))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -172,12 +172,12 @@ mod tests {
|
|||
|
||||
let segment: Segment = ron::de::from_str(segment_ron).unwrap();
|
||||
assert_eq!(segment.flags(), SegmentFlags::RESET | SegmentFlags::SEGMENT);
|
||||
assert!((segment.rate() - 1f64).abs() < std::f64::EPSILON);
|
||||
assert!((segment.applied_rate() - 0.9f64).abs() < std::f64::EPSILON);
|
||||
assert!((segment.rate() - 1f64).abs() < f64::EPSILON);
|
||||
assert!((segment.applied_rate() - 0.9f64).abs() < f64::EPSILON);
|
||||
assert_eq!(segment.format(), Format::Time);
|
||||
assert_eq!(segment.flags(), SegmentFlags::RESET | SegmentFlags::SEGMENT);
|
||||
assert!((segment.rate() - 1f64).abs() < std::f64::EPSILON);
|
||||
assert!((segment.applied_rate() - 0.9f64).abs() < std::f64::EPSILON);
|
||||
assert!((segment.rate() - 1f64).abs() < f64::EPSILON);
|
||||
assert!((segment.applied_rate() - 0.9f64).abs() < f64::EPSILON);
|
||||
assert_eq!(segment.format(), Format::Time);
|
||||
assert_eq!(
|
||||
segment.base(),
|
||||
|
@ -233,8 +233,8 @@ mod tests {
|
|||
|
||||
let fmt_seg: FormattedSegment<Time> = ron::de::from_str(segment_ron).unwrap();
|
||||
assert_eq!(fmt_seg.flags(), SegmentFlags::RESET | SegmentFlags::SEGMENT);
|
||||
assert!((fmt_seg.rate() - 1f64).abs() < std::f64::EPSILON);
|
||||
assert!((fmt_seg.applied_rate() - 0.9f64).abs() < std::f64::EPSILON);
|
||||
assert!((fmt_seg.rate() - 1f64).abs() < f64::EPSILON);
|
||||
assert!((fmt_seg.applied_rate() - 0.9f64).abs() < f64::EPSILON);
|
||||
assert_eq!(fmt_seg.format(), Format::Time);
|
||||
assert_eq!(fmt_seg.base(), Some(ClockTime::from_nseconds(123)));
|
||||
assert_eq!(fmt_seg.offset(), Some(ClockTime::from_nseconds(42)));
|
||||
|
@ -265,8 +265,8 @@ mod tests {
|
|||
|
||||
let segment_de: Segment = ron::de::from_str(segment_se.as_str()).unwrap();
|
||||
assert_eq!(segment_de.flags(), segment.flags());
|
||||
assert!((segment_de.rate() - segment.rate()).abs() < std::f64::EPSILON);
|
||||
assert!((segment_de.applied_rate() - segment.applied_rate()).abs() < std::f64::EPSILON);
|
||||
assert!((segment_de.rate() - segment.rate()).abs() < f64::EPSILON);
|
||||
assert!((segment_de.applied_rate() - segment.applied_rate()).abs() < f64::EPSILON);
|
||||
assert_eq!(segment_de.format(), segment.format());
|
||||
assert_eq!(segment_de.base(), segment.base());
|
||||
assert_eq!(segment_de.offset(), segment.offset());
|
||||
|
|
|
@ -176,7 +176,7 @@ impl StreamCollection {
|
|||
connect_raw(
|
||||
self.as_ptr() as *mut _,
|
||||
signal_name.as_ptr() as *const _,
|
||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||
Some(transmute::<*const (), unsafe extern "C" fn()>(
|
||||
stream_notify_trampoline::<F> as *const (),
|
||||
)),
|
||||
Box_::into_raw(f),
|
||||
|
|
|
@ -124,7 +124,7 @@ macro_rules! define_tracer_hooks {
|
|||
ffi::gst_tracing_register_hook(
|
||||
instance.to_glib_none().0 as *mut ffi::GstTracer,
|
||||
hook_type.as_ptr() as *const _,
|
||||
Some(std::mem::transmute::<_, extern "C" fn()>(callback)),
|
||||
Some(std::mem::transmute::<*const (), extern "C" fn()>(callback)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -463,7 +463,7 @@ mod tests {
|
|||
120 * ClockTime::SECOND,
|
||||
);
|
||||
assert_eq!(tags.index::<Bitrate>(0).unwrap().get(), 96_000);
|
||||
assert!((tags.index::<TrackGain>(0).unwrap().get() - 1f64).abs() < std::f64::EPSILON);
|
||||
assert!((tags.index::<TrackGain>(0).unwrap().get() - 1f64).abs() < f64::EPSILON);
|
||||
assert_eq!(
|
||||
tags.index::<Date>(0).unwrap().get(),
|
||||
glib::Date::from_dmy(28, glib::DateMonth::May, 2018).unwrap()
|
||||
|
@ -499,7 +499,7 @@ mod tests {
|
|||
assert_eq!(tags.index::<Title>(0).unwrap().get(), "a title");
|
||||
assert_eq!(tags.index::<Title>(1).unwrap().get(), "another title");
|
||||
assert_eq!(tags.index::<Bitrate>(0).unwrap().get(), 96_000);
|
||||
assert!((tags.index::<TrackGain>(0).unwrap().get() - 1f64).abs() < std::f64::EPSILON);
|
||||
assert!((tags.index::<TrackGain>(0).unwrap().get() - 1f64).abs() < f64::EPSILON);
|
||||
assert_eq!(
|
||||
tags.index::<Date>(0).unwrap().get(),
|
||||
glib::Date::from_dmy(28, glib::DateMonth::May, 2018).unwrap()
|
||||
|
@ -575,7 +575,7 @@ mod tests {
|
|||
(tags_de.index::<TrackGain>(0).unwrap().get()
|
||||
- tags.index::<TrackGain>(0).unwrap().get())
|
||||
.abs()
|
||||
< std::f64::EPSILON
|
||||
< f64::EPSILON
|
||||
);
|
||||
assert_eq!(
|
||||
tags_de.index::<Date>(0).unwrap().get(),
|
||||
|
|
|
@ -148,8 +148,6 @@ unsafe extern "C" fn type_find_suggest<T: TypeFindImpl + ?Sized>(
|
|||
unsafe extern "C" fn type_find_get_length<T: TypeFindImpl + ?Sized>(
|
||||
data: glib::ffi::gpointer,
|
||||
) -> u64 {
|
||||
use std::u64;
|
||||
|
||||
let find = &*(data as *mut &mut T);
|
||||
find.length().unwrap_or(u64::MAX)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue