diff --git a/gstreamer-audio/Cargo.toml b/gstreamer-audio/Cargo.toml index 8e8578863..b56f5d571 100644 --- a/gstreamer-audio/Cargo.toml +++ b/gstreamer-audio/Cargo.toml @@ -21,7 +21,6 @@ ffi = { package = "gstreamer-audio-sys", path = "sys" } glib = { git = "https://github.com/gtk-rs/gtk-rs-core" } gst = { package = "gstreamer", path = "../gstreamer" } gst-base = { package = "gstreamer-base", path = "../gstreamer-base" } -array-init = "2.0" once_cell = "1.0" serde = { version = "1.0", optional = true } diff --git a/gstreamer-audio/src/audio_channel_position.rs b/gstreamer-audio/src/audio_channel_position.rs index 120d67c78..c9bf00ce2 100644 --- a/gstreamer-audio/src/audio_channel_position.rs +++ b/gstreamer-audio/src/audio_channel_position.rs @@ -28,7 +28,7 @@ impl AudioChannelPosition { return Err(glib::bool_error!("Invalid number of channels")); } - let positions_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init(|i| { + let positions_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| { if i >= len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { @@ -94,7 +94,7 @@ impl AudioChannelPosition { } let len = positions.len(); - let mut positions_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init(|i| { + let mut positions_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| { if i >= len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { @@ -138,7 +138,7 @@ impl AudioChannelPosition { } let len = positions.len(); - let positions_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init(|i| { + let positions_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| { if i >= len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { @@ -173,7 +173,7 @@ pub fn buffer_reorder_channels( let from_len = from.len(); let to_len = to.len(); - let from_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init(|i| { + let from_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| { if i >= from_len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { @@ -181,7 +181,7 @@ pub fn buffer_reorder_channels( } }); - let to_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init(|i| { + let to_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| { if i >= to_len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { @@ -223,7 +223,7 @@ pub fn reorder_channels( let from_len = from.len(); let to_len = to.len(); - let from_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init(|i| { + let from_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| { if i >= from_len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { @@ -231,7 +231,7 @@ pub fn reorder_channels( } }); - let to_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init(|i| { + let to_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| { if i >= to_len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { @@ -273,7 +273,7 @@ pub fn channel_reorder_map( let from_len = from.len(); let to_len = to.len(); - let from_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init(|i| { + let from_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| { if i >= from_len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { @@ -281,7 +281,7 @@ pub fn channel_reorder_map( } }); - let to_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init(|i| { + let to_raw: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| { if i >= to_len as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { diff --git a/gstreamer-audio/src/audio_info.rs b/gstreamer-audio/src/audio_info.rs index b8a5ac1fd..6d00a1345 100644 --- a/gstreamer-audio/src/audio_info.rs +++ b/gstreamer-audio/src/audio_info.rs @@ -47,7 +47,7 @@ impl<'a> AudioInfoBuilder<'a> { return Err(glib::bool_error!("Invalid positions length")); } - let positions: [ffi::GstAudioChannelPosition; 64] = array_init::array_init(|i| { + let positions: [ffi::GstAudioChannelPosition; 64] = std::array::from_fn(|i| { if i >= self.channels as usize { ffi::GST_AUDIO_CHANNEL_POSITION_INVALID } else { @@ -96,7 +96,7 @@ impl<'a> AudioInfoBuilder<'a> { info.layout = layout.into_glib(); } - let positions = array_init::array_init(|i| from_glib(info.position[i])); + let positions = std::array::from_fn(|i| from_glib(info.position[i])); Ok(AudioInfo(info, positions)) } } @@ -156,7 +156,7 @@ impl AudioInfo { caps.as_ptr(), )) { let info = info.assume_init(); - let positions = array_init::array_init(|i| from_glib(info.position[i])); + let positions = std::array::from_fn(|i| from_glib(info.position[i])); Ok(Self(info, positions)) } else { Err(glib::bool_error!("Failed to create AudioInfo from caps")) @@ -407,7 +407,7 @@ impl glib::translate::FromGlibPtrNone<*mut ffi::GstAudioInfo> for AudioInfo { unsafe fn from_glib_none(ptr: *mut ffi::GstAudioInfo) -> Self { Self( ptr::read(ptr), - array_init::array_init(|i| from_glib((*ptr).position[i])), + std::array::from_fn(|i| from_glib((*ptr).position[i])), ) } }