Commit 830f0b7d authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Add VideoInfo and related bindings

parent 3a50ca61
......@@ -21,6 +21,12 @@ generate = [
"GstVideo.VideoInterlaceMode",
"GstVideo.VideoFlags",
"GstVideo.VideoChromaSite",
"GstVideo.VideoColorMatrix",
"GstVideo.VideoTransferFunction",
"GstVideo.VideoColorPrimaries",
"GstVideo.VideoMultiviewMode",
"GstVideo.VideoMultiviewFlags",
"GstVideo.VideoFieldOrder",
]
manual = [
......@@ -29,6 +35,7 @@ manual = [
"GstVideo.VideoInfo",
"GstVideo.VideoFormatInfo",
"GstVideo.VideoColorimetry",
"GstVideo.VideoColorRange",
]
[[object]]
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
use ffi;
use glib::Type;
use glib::StaticType;
use glib::value::{FromValue, FromValueOptional, SetValue, Value};
use glib::value::{Value, SetValue, FromValue, FromValueOptional};
use gobject_ffi;
use glib::translate::*;
......@@ -53,9 +53,7 @@ impl<'a> FromValueOptional<'a> for VideoChromaSite {
impl<'a> FromValue<'a> for VideoChromaSite {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstVideoChromaSite::from_bits_truncate(
gobject_ffi::g_value_get_flags(value.to_glib_none().0),
))
from_glib(ffi::GstVideoChromaSite::from_bits_truncate(gobject_ffi::g_value_get_flags(value.to_glib_none().0)))
}
}
......@@ -104,9 +102,7 @@ impl<'a> FromValueOptional<'a> for VideoFlags {
impl<'a> FromValue<'a> for VideoFlags {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstVideoFlags::from_bits_truncate(
gobject_ffi::g_value_get_flags(value.to_glib_none().0),
))
from_glib(ffi::GstVideoFlags::from_bits_truncate(gobject_ffi::g_value_get_flags(value.to_glib_none().0)))
}
}
......@@ -161,9 +157,7 @@ impl<'a> FromValueOptional<'a> for VideoFormatFlags {
impl<'a> FromValue<'a> for VideoFormatFlags {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstVideoFormatFlags::from_bits_truncate(
gobject_ffi::g_value_get_flags(value.to_glib_none().0),
))
from_glib(ffi::GstVideoFormatFlags::from_bits_truncate(gobject_ffi::g_value_get_flags(value.to_glib_none().0)))
}
}
......@@ -172,3 +166,58 @@ impl SetValue for VideoFormatFlags {
gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib().bits())
}
}
bitflags! {
pub struct VideoMultiviewFlags: u32 {
const VIDEO_MULTIVIEW_FLAGS_NONE = 0;
const VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST = 1;
const VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED = 2;
const VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED = 4;
const VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED = 8;
const VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED = 16;
const VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT = 16384;
const VIDEO_MULTIVIEW_FLAGS_MIXED_MONO = 32768;
}
}
#[doc(hidden)]
impl ToGlib for VideoMultiviewFlags {
type GlibType = ffi::GstVideoMultiviewFlags;
fn to_glib(&self) -> ffi::GstVideoMultiviewFlags {
ffi::GstVideoMultiviewFlags::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstVideoMultiviewFlags> for VideoMultiviewFlags {
fn from_glib(value: ffi::GstVideoMultiviewFlags) -> VideoMultiviewFlags {
skip_assert_initialized!();
VideoMultiviewFlags::from_bits_truncate(value.bits())
}
}
impl StaticType for VideoMultiviewFlags {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_video_multiview_flags_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for VideoMultiviewFlags {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for VideoMultiviewFlags {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstVideoMultiviewFlags::from_bits_truncate(gobject_ffi::g_value_get_flags(value.to_glib_none().0)))
}
}
impl SetValue for VideoMultiviewFlags {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib().bits())
}
}
......@@ -2,9 +2,15 @@
// DO NOT EDIT
mod enums;
pub use self::enums::VideoColorMatrix;
pub use self::enums::VideoColorPrimaries;
#[cfg(feature = "v1_12")]
pub use self::enums::VideoFieldOrder;
pub use self::enums::VideoFormat;
pub use self::enums::VideoInterlaceMode;
pub use self::enums::VideoMultiviewMode;
pub use self::enums::VideoTileMode;
pub use self::enums::VideoTransferFunction;
mod flags;
pub use self::flags::VideoChromaSite;
......@@ -31,6 +37,16 @@ pub use self::flags::VIDEO_FORMAT_FLAG_PALETTE;
pub use self::flags::VIDEO_FORMAT_FLAG_COMPLEX;
pub use self::flags::VIDEO_FORMAT_FLAG_UNPACK;
pub use self::flags::VIDEO_FORMAT_FLAG_TILED;
pub use self::flags::VideoMultiviewFlags;
pub use self::flags::VIDEO_MULTIVIEW_FLAGS_NONE;
pub use self::flags::VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST;
pub use self::flags::VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED;
pub use self::flags::VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED;
pub use self::flags::VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED;
pub use self::flags::VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED;
pub use self::flags::VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT;
pub use self::flags::VIDEO_MULTIVIEW_FLAGS_MIXED_MONO;
#[doc(hidden)]
pub mod traits {}
pub mod traits {
}
......@@ -15,16 +15,8 @@ extern crate gobject_sys as gobject_ffi;
extern crate gstreamer_sys as gst_ffi;
extern crate gstreamer_video_sys as ffi;
extern crate gstreamer as gst;
#[macro_use]
extern crate glib;
macro_rules! assert_initialized_main_thread {
() => (
use gst_ffi;
assert_eq!(unsafe {gst_ffi::gst_is_initialized()}, ::glib_ffi::GTRUE)
)
}
macro_rules! skip_assert_initialized {
() => (
)
......@@ -44,3 +36,5 @@ mod video_format;
pub use video_format::*;
mod video_format_info;
pub use video_format_info::*;
mod video_info;
pub use video_info::*;
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment