mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 11:01:10 +00:00
video: Add conversions between VideoInfo
and VideoInfoDmaDrm
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1286>
This commit is contained in:
parent
bc979b7ce9
commit
67b8c29274
1 changed files with 41 additions and 3 deletions
|
@ -121,9 +121,7 @@ impl VideoInfoDmaDrm {
|
|||
#[doc(alias = "gst_video_info_dma_drm_to_caps")]
|
||||
pub fn to_caps(&self) -> Result<gst::Caps, glib::error::BoolError> {
|
||||
unsafe {
|
||||
let result = from_glib_full(ffi::gst_video_info_dma_drm_to_caps(
|
||||
&self.0 as *const _ as *mut _,
|
||||
));
|
||||
let result = from_glib_full(ffi::gst_video_info_dma_drm_to_caps(mut_override(&self.0)));
|
||||
match result {
|
||||
Some(c) => Ok(c),
|
||||
None => Err(glib::bool_error!(
|
||||
|
@ -133,6 +131,46 @@ impl VideoInfoDmaDrm {
|
|||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_video_info_dma_drm_from_video_info")]
|
||||
pub fn from_video_info(
|
||||
video_info: &crate::VideoInfo,
|
||||
modifier: u64,
|
||||
) -> Result<Self, glib::error::BoolError> {
|
||||
skip_assert_initialized!();
|
||||
|
||||
unsafe {
|
||||
let mut info = mem::MaybeUninit::uninit();
|
||||
if from_glib(ffi::gst_video_info_dma_drm_from_video_info(
|
||||
info.as_mut_ptr(),
|
||||
video_info.to_glib_none().0,
|
||||
modifier,
|
||||
)) {
|
||||
Ok(Self(info.assume_init()))
|
||||
} else {
|
||||
Err(glib::bool_error!(
|
||||
"Failed to create VideoInfoDmaDrm from VideoInfo"
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_video_info_dma_drm_to_video_info")]
|
||||
pub fn to_video_info(&self) -> Result<crate::VideoInfo, glib::error::BoolError> {
|
||||
unsafe {
|
||||
let mut video_info = mem::MaybeUninit::uninit();
|
||||
if from_glib(ffi::gst_video_info_dma_drm_to_video_info(
|
||||
mut_override(&self.0),
|
||||
video_info.as_mut_ptr(),
|
||||
)) {
|
||||
Ok(crate::VideoInfo(video_info.assume_init()))
|
||||
} else {
|
||||
Err(glib::bool_error!(
|
||||
"Failed to create VideoInfo from VideoInfoDmaDrm"
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn fourcc(&self) -> u32 {
|
||||
self.0.drm_fourcc
|
||||
|
|
Loading…
Reference in a new issue