forked from mirrors/gstreamer-rs
video: Implement gst_video_color_range_offsets for Video(Format)Info
This commit is contained in:
parent
7cb151dd46
commit
579ac6c4e4
2 changed files with 22 additions and 5 deletions
|
@ -5,7 +5,7 @@ use std::ffi::CStr;
|
|||
use std::fmt;
|
||||
use std::str;
|
||||
|
||||
use glib::translate::{from_glib, IntoGlib};
|
||||
use glib::translate::{from_glib, IntoGlib, ToGlibPtr};
|
||||
|
||||
pub struct VideoFormatInfo(&'static ffi::GstVideoFormatInfo);
|
||||
|
||||
|
@ -288,6 +288,21 @@ impl VideoFormatInfo {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_video_color_range_offsets")]
|
||||
pub fn range_offsets(&self, range: crate::VideoColorRange) -> ([i32; 4], [i32; 4]) {
|
||||
let mut offset = [0i32; 4];
|
||||
let mut scale = [0i32; 4];
|
||||
unsafe {
|
||||
ffi::gst_video_color_range_offsets(
|
||||
range.into_glib(),
|
||||
self.to_glib_none().0,
|
||||
&mut offset,
|
||||
&mut scale,
|
||||
)
|
||||
}
|
||||
(offset, scale)
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Sync for VideoFormatInfo {}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||
|
||||
use glib::translate::{
|
||||
from_glib, from_glib_full, from_glib_none, FromGlib, FromGlibPtrFull, IntoGlib, ToGlibPtr,
|
||||
ToGlibPtrMut,
|
||||
};
|
||||
use glib::translate::*;
|
||||
use gst::prelude::*;
|
||||
|
||||
use std::fmt;
|
||||
|
@ -843,6 +840,11 @@ impl VideoInfo {
|
|||
|
||||
Ok(plane_size)
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_video_color_range_offsets")]
|
||||
pub fn range_offsets(&self, range: crate::VideoColorRange) -> ([i32; 4], [i32; 4]) {
|
||||
self.format_info().range_offsets(range)
|
||||
}
|
||||
}
|
||||
|
||||
impl Clone for VideoInfo {
|
||||
|
|
Loading…
Reference in a new issue