mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-27 14:01:04 +00:00
Cast correctly audio data in buffer from *mut u8 to *mut i16
This commit is contained in:
parent
d3ba5efff8
commit
b85fcdf649
3 changed files with 5 additions and 2 deletions
|
@ -12,6 +12,7 @@ gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
|
|||
gstreamer-video = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
|
||||
gstreamer-audio = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
|
||||
lazy_static = "1.1.0"
|
||||
byte-slice-cast = "0.2.0"
|
||||
|
||||
[lib]
|
||||
name = "gstndi"
|
||||
|
|
|
@ -11,6 +11,7 @@ extern crate gstreamer_video as gst_video;
|
|||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
extern crate byte_slice_cast;
|
||||
|
||||
mod ndiaudiosrc;
|
||||
pub mod ndisys;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case, cast_ptr_alignment)]
|
||||
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
|
||||
|
||||
use glib;
|
||||
use glib::subclass;
|
||||
|
@ -22,6 +22,7 @@ use ndisys::*;
|
|||
use stop_ndi;
|
||||
|
||||
use hashmap_receivers;
|
||||
use byte_slice_cast::AsMutSliceOf;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct Settings {
|
||||
|
@ -471,7 +472,7 @@ impl ObjectSubclass for NdiAudioSrc {
|
|||
|
||||
let mut dst: NDIlib_audio_frame_interleaved_16s_t = Default::default();
|
||||
dst.reference_level = 0;
|
||||
dst.p_data = buffer.map_writable().unwrap().as_mut_slice().as_mut_ptr() as *mut i16;
|
||||
dst.p_data = buffer.map_writable().unwrap().as_mut_slice_of::<i16>().unwrap().as_mut_ptr();
|
||||
NDIlib_util_audio_to_interleaved_16s_v2(&audio_frame, &mut dst);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue