mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-01-18 13:16:30 +00:00
gstreamer-video: Add support for VideoOrientation interface and VideoOrientationMethod enum
This commit is contained in:
parent
59d91b2abf
commit
0ea48e9894
10 changed files with 302 additions and 12 deletions
|
@ -27,6 +27,7 @@ generate = [
|
||||||
"GstVideo.VideoAlphaMode",
|
"GstVideo.VideoAlphaMode",
|
||||||
"GstVideo.VideoChromaMode",
|
"GstVideo.VideoChromaMode",
|
||||||
"GstVideo.VideoMatrixMode",
|
"GstVideo.VideoMatrixMode",
|
||||||
|
"GstVideo.VideoOrientationMethod",
|
||||||
"GstVideo.VideoGammaMode",
|
"GstVideo.VideoGammaMode",
|
||||||
"GstVideo.VideoPrimariesMode",
|
"GstVideo.VideoPrimariesMode",
|
||||||
"GstVideo.VideoResamplerMethod",
|
"GstVideo.VideoResamplerMethod",
|
||||||
|
@ -72,6 +73,26 @@ name = "Gst.Caps"
|
||||||
status = "manual"
|
status = "manual"
|
||||||
ref_mode = "ref"
|
ref_mode = "ref"
|
||||||
|
|
||||||
|
[[object]]
|
||||||
|
name = "GstVideo.VideoOrientation"
|
||||||
|
status = "generate"
|
||||||
|
[[object.function]]
|
||||||
|
name = "set_hcenter"
|
||||||
|
[object.function.return]
|
||||||
|
bool_return_is_error = "Failed to set horizontal centering"
|
||||||
|
[[object.function]]
|
||||||
|
name = "set_hflip"
|
||||||
|
[object.function.return]
|
||||||
|
bool_return_is_error = "Failed to set horizontal flipping"
|
||||||
|
[[object.function]]
|
||||||
|
name = "set_vcenter"
|
||||||
|
[object.function.return]
|
||||||
|
bool_return_is_error = "Failed to set vertical centering"
|
||||||
|
[[object.function]]
|
||||||
|
name = "set_vflip"
|
||||||
|
[object.function.return]
|
||||||
|
bool_return_is_error = "Failed to set vertical flipping"
|
||||||
|
|
||||||
[[object]]
|
[[object]]
|
||||||
name = "GstVideo.VideoOverlay"
|
name = "GstVideo.VideoOverlay"
|
||||||
status = "generate"
|
status = "generate"
|
||||||
|
|
|
@ -1967,6 +1967,113 @@ impl SetValue for VideoMultiviewMode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||||
|
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
#[doc(alias = "GstVideoOrientationMethod")]
|
||||||
|
pub enum VideoOrientationMethod {
|
||||||
|
#[doc(alias = "GST_VIDEO_ORIENTATION_IDENTITY")]
|
||||||
|
Identity,
|
||||||
|
#[doc(alias = "GST_VIDEO_ORIENTATION_90R")]
|
||||||
|
_90r,
|
||||||
|
#[doc(alias = "GST_VIDEO_ORIENTATION_180")]
|
||||||
|
_180,
|
||||||
|
#[doc(alias = "GST_VIDEO_ORIENTATION_90L")]
|
||||||
|
_90l,
|
||||||
|
#[doc(alias = "GST_VIDEO_ORIENTATION_HORIZ")]
|
||||||
|
Horiz,
|
||||||
|
#[doc(alias = "GST_VIDEO_ORIENTATION_VERT")]
|
||||||
|
Vert,
|
||||||
|
#[doc(alias = "GST_VIDEO_ORIENTATION_UL_LR")]
|
||||||
|
UlLr,
|
||||||
|
#[doc(alias = "GST_VIDEO_ORIENTATION_UR_LL")]
|
||||||
|
UrLl,
|
||||||
|
#[doc(alias = "GST_VIDEO_ORIENTATION_AUTO")]
|
||||||
|
Auto,
|
||||||
|
#[doc(alias = "GST_VIDEO_ORIENTATION_CUSTOM")]
|
||||||
|
Custom,
|
||||||
|
#[doc(hidden)]
|
||||||
|
__Unknown(i32),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||||
|
#[doc(hidden)]
|
||||||
|
impl ToGlib for VideoOrientationMethod {
|
||||||
|
type GlibType = ffi::GstVideoOrientationMethod;
|
||||||
|
|
||||||
|
fn to_glib(&self) -> ffi::GstVideoOrientationMethod {
|
||||||
|
match *self {
|
||||||
|
VideoOrientationMethod::Identity => ffi::GST_VIDEO_ORIENTATION_IDENTITY,
|
||||||
|
VideoOrientationMethod::_90r => ffi::GST_VIDEO_ORIENTATION_90R,
|
||||||
|
VideoOrientationMethod::_180 => ffi::GST_VIDEO_ORIENTATION_180,
|
||||||
|
VideoOrientationMethod::_90l => ffi::GST_VIDEO_ORIENTATION_90L,
|
||||||
|
VideoOrientationMethod::Horiz => ffi::GST_VIDEO_ORIENTATION_HORIZ,
|
||||||
|
VideoOrientationMethod::Vert => ffi::GST_VIDEO_ORIENTATION_VERT,
|
||||||
|
VideoOrientationMethod::UlLr => ffi::GST_VIDEO_ORIENTATION_UL_LR,
|
||||||
|
VideoOrientationMethod::UrLl => ffi::GST_VIDEO_ORIENTATION_UR_LL,
|
||||||
|
VideoOrientationMethod::Auto => ffi::GST_VIDEO_ORIENTATION_AUTO,
|
||||||
|
VideoOrientationMethod::Custom => ffi::GST_VIDEO_ORIENTATION_CUSTOM,
|
||||||
|
VideoOrientationMethod::__Unknown(value) => value,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||||
|
#[doc(hidden)]
|
||||||
|
impl FromGlib<ffi::GstVideoOrientationMethod> for VideoOrientationMethod {
|
||||||
|
unsafe fn from_glib(value: ffi::GstVideoOrientationMethod) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
match value {
|
||||||
|
0 => VideoOrientationMethod::Identity,
|
||||||
|
1 => VideoOrientationMethod::_90r,
|
||||||
|
2 => VideoOrientationMethod::_180,
|
||||||
|
3 => VideoOrientationMethod::_90l,
|
||||||
|
4 => VideoOrientationMethod::Horiz,
|
||||||
|
5 => VideoOrientationMethod::Vert,
|
||||||
|
6 => VideoOrientationMethod::UlLr,
|
||||||
|
7 => VideoOrientationMethod::UrLl,
|
||||||
|
8 => VideoOrientationMethod::Auto,
|
||||||
|
9 => VideoOrientationMethod::Custom,
|
||||||
|
value => VideoOrientationMethod::__Unknown(value),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||||
|
impl StaticType for VideoOrientationMethod {
|
||||||
|
fn static_type() -> Type {
|
||||||
|
unsafe { from_glib(ffi::gst_video_orientation_method_get_type()) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||||
|
impl<'a> FromValueOptional<'a> for VideoOrientationMethod {
|
||||||
|
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
|
||||||
|
Some(FromValue::from_value(value))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||||
|
impl<'a> FromValue<'a> for VideoOrientationMethod {
|
||||||
|
unsafe fn from_value(value: &glib::Value) -> Self {
|
||||||
|
from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||||
|
impl SetValue for VideoOrientationMethod {
|
||||||
|
unsafe fn set_value(value: &mut glib::Value, this: &Self) {
|
||||||
|
glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
|
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[doc(alias = "GstVideoPrimariesMode")]
|
#[doc(alias = "GstVideoPrimariesMode")]
|
||||||
|
|
|
@ -16,6 +16,10 @@ pub use self::video_encoder::{VideoEncoder, NONE_VIDEO_ENCODER};
|
||||||
mod video_filter;
|
mod video_filter;
|
||||||
pub use self::video_filter::{VideoFilter, NONE_VIDEO_FILTER};
|
pub use self::video_filter::{VideoFilter, NONE_VIDEO_FILTER};
|
||||||
|
|
||||||
|
mod video_orientation;
|
||||||
|
pub use self::video_orientation::VideoOrientationExt;
|
||||||
|
pub use self::video_orientation::{VideoOrientation, NONE_VIDEO_ORIENTATION};
|
||||||
|
|
||||||
mod video_overlay;
|
mod video_overlay;
|
||||||
pub use self::video_overlay::VideoOverlayExt;
|
pub use self::video_overlay::VideoOverlayExt;
|
||||||
pub use self::video_overlay::{VideoOverlay, NONE_VIDEO_OVERLAY};
|
pub use self::video_overlay::{VideoOverlay, NONE_VIDEO_OVERLAY};
|
||||||
|
@ -48,6 +52,9 @@ pub use self::enums::VideoInterlaceMode;
|
||||||
pub use self::enums::VideoMatrixMode;
|
pub use self::enums::VideoMatrixMode;
|
||||||
pub use self::enums::VideoMultiviewFramePacking;
|
pub use self::enums::VideoMultiviewFramePacking;
|
||||||
pub use self::enums::VideoMultiviewMode;
|
pub use self::enums::VideoMultiviewMode;
|
||||||
|
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||||
|
pub use self::enums::VideoOrientationMethod;
|
||||||
pub use self::enums::VideoPrimariesMode;
|
pub use self::enums::VideoPrimariesMode;
|
||||||
pub use self::enums::VideoResamplerMethod;
|
pub use self::enums::VideoResamplerMethod;
|
||||||
pub use self::enums::VideoTileMode;
|
pub use self::enums::VideoTileMode;
|
||||||
|
@ -71,6 +78,7 @@ pub use self::flags::VideoTimeCodeFlags;
|
||||||
pub mod traits {
|
pub mod traits {
|
||||||
pub use super::VideoDecoderExt;
|
pub use super::VideoDecoderExt;
|
||||||
pub use super::VideoEncoderExt;
|
pub use super::VideoEncoderExt;
|
||||||
|
pub use super::VideoOrientationExt;
|
||||||
pub use super::VideoOverlayExt;
|
pub use super::VideoOverlayExt;
|
||||||
pub use super::VideoSinkExt;
|
pub use super::VideoSinkExt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
|
Generated by gir (https://github.com/gtk-rs/gir @ d8408d8)
|
||||||
from gir-files (https://github.com/gtk-rs/gir-files @ 3c0281db)
|
from gir-files (https://github.com/gtk-rs/gir-files @ 59d91b2a)
|
||||||
|
|
154
gstreamer-video/src/auto/video_orientation.rs
Normal file
154
gstreamer-video/src/auto/video_orientation.rs
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||||
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||||
|
// DO NOT EDIT
|
||||||
|
|
||||||
|
use glib::object::IsA;
|
||||||
|
use glib::translate::*;
|
||||||
|
use std::mem;
|
||||||
|
|
||||||
|
glib::wrapper! {
|
||||||
|
pub struct VideoOrientation(Interface<ffi::GstVideoOrientation>);
|
||||||
|
|
||||||
|
match fn {
|
||||||
|
get_type => || ffi::gst_video_orientation_get_type(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl Send for VideoOrientation {}
|
||||||
|
unsafe impl Sync for VideoOrientation {}
|
||||||
|
|
||||||
|
pub const NONE_VIDEO_ORIENTATION: Option<&VideoOrientation> = None;
|
||||||
|
|
||||||
|
pub trait VideoOrientationExt: 'static {
|
||||||
|
#[doc(alias = "gst_video_orientation_get_hcenter")]
|
||||||
|
fn get_hcenter(&self) -> Option<i32>;
|
||||||
|
|
||||||
|
#[doc(alias = "gst_video_orientation_get_hflip")]
|
||||||
|
fn get_hflip(&self) -> Option<bool>;
|
||||||
|
|
||||||
|
#[doc(alias = "gst_video_orientation_get_vcenter")]
|
||||||
|
fn get_vcenter(&self) -> Option<i32>;
|
||||||
|
|
||||||
|
#[doc(alias = "gst_video_orientation_get_vflip")]
|
||||||
|
fn get_vflip(&self) -> Option<bool>;
|
||||||
|
|
||||||
|
#[doc(alias = "gst_video_orientation_set_hcenter")]
|
||||||
|
fn set_hcenter(&self, center: i32) -> Result<(), glib::error::BoolError>;
|
||||||
|
|
||||||
|
#[doc(alias = "gst_video_orientation_set_hflip")]
|
||||||
|
fn set_hflip(&self, flip: bool) -> Result<(), glib::error::BoolError>;
|
||||||
|
|
||||||
|
#[doc(alias = "gst_video_orientation_set_vcenter")]
|
||||||
|
fn set_vcenter(&self, center: i32) -> Result<(), glib::error::BoolError>;
|
||||||
|
|
||||||
|
#[doc(alias = "gst_video_orientation_set_vflip")]
|
||||||
|
fn set_vflip(&self, flip: bool) -> Result<(), glib::error::BoolError>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<O: IsA<VideoOrientation>> VideoOrientationExt for O {
|
||||||
|
fn get_hcenter(&self) -> Option<i32> {
|
||||||
|
unsafe {
|
||||||
|
let mut center = mem::MaybeUninit::uninit();
|
||||||
|
let ret = from_glib(ffi::gst_video_orientation_get_hcenter(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
center.as_mut_ptr(),
|
||||||
|
));
|
||||||
|
let center = center.assume_init();
|
||||||
|
if ret {
|
||||||
|
Some(center)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_hflip(&self) -> Option<bool> {
|
||||||
|
unsafe {
|
||||||
|
let mut flip = mem::MaybeUninit::uninit();
|
||||||
|
let ret = from_glib(ffi::gst_video_orientation_get_hflip(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
flip.as_mut_ptr(),
|
||||||
|
));
|
||||||
|
let flip = flip.assume_init();
|
||||||
|
if ret {
|
||||||
|
Some(from_glib(flip))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_vcenter(&self) -> Option<i32> {
|
||||||
|
unsafe {
|
||||||
|
let mut center = mem::MaybeUninit::uninit();
|
||||||
|
let ret = from_glib(ffi::gst_video_orientation_get_vcenter(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
center.as_mut_ptr(),
|
||||||
|
));
|
||||||
|
let center = center.assume_init();
|
||||||
|
if ret {
|
||||||
|
Some(center)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_vflip(&self) -> Option<bool> {
|
||||||
|
unsafe {
|
||||||
|
let mut flip = mem::MaybeUninit::uninit();
|
||||||
|
let ret = from_glib(ffi::gst_video_orientation_get_vflip(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
flip.as_mut_ptr(),
|
||||||
|
));
|
||||||
|
let flip = flip.assume_init();
|
||||||
|
if ret {
|
||||||
|
Some(from_glib(flip))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_hcenter(&self, center: i32) -> Result<(), glib::error::BoolError> {
|
||||||
|
unsafe {
|
||||||
|
glib::result_from_gboolean!(
|
||||||
|
ffi::gst_video_orientation_set_hcenter(self.as_ref().to_glib_none().0, center),
|
||||||
|
"Failed to set horizontal centering"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_hflip(&self, flip: bool) -> Result<(), glib::error::BoolError> {
|
||||||
|
unsafe {
|
||||||
|
glib::result_from_gboolean!(
|
||||||
|
ffi::gst_video_orientation_set_hflip(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
flip.to_glib()
|
||||||
|
),
|
||||||
|
"Failed to set horizontal flipping"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_vcenter(&self, center: i32) -> Result<(), glib::error::BoolError> {
|
||||||
|
unsafe {
|
||||||
|
glib::result_from_gboolean!(
|
||||||
|
ffi::gst_video_orientation_set_vcenter(self.as_ref().to_glib_none().0, center),
|
||||||
|
"Failed to set vertical centering"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_vflip(&self, flip: bool) -> Result<(), glib::error::BoolError> {
|
||||||
|
unsafe {
|
||||||
|
glib::result_from_gboolean!(
|
||||||
|
ffi::gst_video_orientation_set_vflip(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
flip.to_glib()
|
||||||
|
),
|
||||||
|
"Failed to set vertical flipping"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
|
// This file was generated by gir (https://github.com/gtk-rs/gir @ d8408d8)
|
||||||
// from gir-files (https://github.com/gtk-rs/gir-files @ 3c0281db)
|
// from gir-files (https://github.com/gtk-rs/gir-files @ 59d91b2a)
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
|
|
||||||
#[cfg(not(feature = "dox"))]
|
#[cfg(not(feature = "dox"))]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
|
// This file was generated by gir (https://github.com/gtk-rs/gir @ d8408d8)
|
||||||
// from gir-files (https://github.com/gtk-rs/gir-files @ 3c0281db)
|
// from gir-files (https://github.com/gtk-rs/gir-files @ 59d91b2a)
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
|
|
||||||
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
|
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
|
// This file was generated by gir (https://github.com/gtk-rs/gir @ d8408d8)
|
||||||
// from gir-files (https://github.com/gtk-rs/gir-files @ 3c0281db)
|
// from gir-files (https://github.com/gtk-rs/gir-files @ 59d91b2a)
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
|
|
||||||
use gstreamer_video_sys::*;
|
use gstreamer_video_sys::*;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
|
// This file was generated by gir (https://github.com/gtk-rs/gir @ d8408d8)
|
||||||
// from gir-files (https://github.com/gtk-rs/gir-files @ 3c0281db)
|
// from gir-files (https://github.com/gtk-rs/gir-files @ 59d91b2a)
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
|
|
||||||
#include "manual.h"
|
#include "manual.h"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
|
// This file was generated by gir (https://github.com/gtk-rs/gir @ d8408d8)
|
||||||
// from gir-files (https://github.com/gtk-rs/gir-files @ 3c0281db)
|
// from gir-files (https://github.com/gtk-rs/gir-files @ 59d91b2a)
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
|
|
||||||
#include "manual.h"
|
#include "manual.h"
|
||||||
|
|
Loading…
Reference in a new issue