forked from mirrors/gstreamer-rs
video: Use nested [[f32; 4]; 4] slices for the affine transformation meta instead of [f32; 16]
This commit is contained in:
parent
4e235b0492
commit
e5977c2d20
1 changed files with 15 additions and 8 deletions
|
@ -461,7 +461,7 @@ impl VideoAffineTransformationMeta {
|
||||||
#[doc(alias = "gst_buffer_add_meta")]
|
#[doc(alias = "gst_buffer_add_meta")]
|
||||||
pub fn add<'a>(
|
pub fn add<'a>(
|
||||||
buffer: &'a mut gst::BufferRef,
|
buffer: &'a mut gst::BufferRef,
|
||||||
matrix: Option<&[f32; 16]>,
|
matrix: Option<&[[f32; 4]; 4]>,
|
||||||
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
|
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -473,7 +473,9 @@ impl VideoAffineTransformationMeta {
|
||||||
|
|
||||||
if let Some(matrix) = matrix {
|
if let Some(matrix) = matrix {
|
||||||
let meta = &mut *meta;
|
let meta = &mut *meta;
|
||||||
meta.matrix.copy_from_slice(matrix);
|
for (i, o) in Iterator::zip(matrix.iter().flatten(), meta.matrix.iter_mut()) {
|
||||||
|
*o = *i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Self::from_mut_ptr(buffer, meta)
|
Self::from_mut_ptr(buffer, meta)
|
||||||
|
@ -481,18 +483,23 @@ impl VideoAffineTransformationMeta {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(alias = "get_matrix")]
|
#[doc(alias = "get_matrix")]
|
||||||
pub fn matrix(&self) -> &[f32; 16] {
|
pub fn matrix(&self) -> &[[f32; 4]; 4] {
|
||||||
&self.0.matrix
|
unsafe { &*(&self.0.matrix as *const [f32; 16] as *const [[f32; 4]; 4]) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_matrix(&mut self, matrix: &[f32; 16]) {
|
pub fn set_matrix(&mut self, matrix: &[[f32; 4]; 4]) {
|
||||||
self.0.matrix.copy_from_slice(matrix);
|
for (i, o) in Iterator::zip(matrix.iter().flatten(), self.0.matrix.iter_mut()) {
|
||||||
|
*o = *i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(alias = "gst_video_affine_transformation_meta_apply_matrix")]
|
#[doc(alias = "gst_video_affine_transformation_meta_apply_matrix")]
|
||||||
pub fn apply_matrix(&mut self, matrix: &[f32; 16]) {
|
pub fn apply_matrix(&mut self, matrix: &[[f32; 4]; 4]) {
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::gst_video_affine_transformation_meta_apply_matrix(&mut self.0, matrix);
|
ffi::gst_video_affine_transformation_meta_apply_matrix(
|
||||||
|
&mut self.0,
|
||||||
|
matrix as *const [[f32; 4]; 4] as *const [f32; 16],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue