From 9265cc823252e9ef97bc780b8267374df4415100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 4 Oct 2018 11:39:15 +0300 Subject: [PATCH] Correctly generate VideoOverlayFormatFlags as flags --- gir-files/GstVideo-1.0.gir | 12 ++++++---- gstreamer-video/src/auto/enums.rs | 37 ------------------------------- gstreamer-video/src/auto/flags.rs | 25 +++++++++++++++++++++ gstreamer-video/src/auto/mod.rs | 2 +- 4 files changed, 34 insertions(+), 42 deletions(-) diff --git a/gir-files/GstVideo-1.0.gir b/gir-files/GstVideo-1.0.gir index f3345b5dd..41bc9b77c 100644 --- a/gir-files/GstVideo-1.0.gir +++ b/gir-files/GstVideo-1.0.gir @@ -9411,7 +9411,7 @@ contained in the rectangles are not copied. - Overlay format flags. c:identifier="GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA"> a global-alpha value != 1 is set. - + @@ -11582,11 +11582,15 @@ gst_buffer_add_video_meta_full() with them. offset of each plane - + + + stride of each plane - + + + diff --git a/gstreamer-video/src/auto/enums.rs b/gstreamer-video/src/auto/enums.rs index a87ba3500..502ddb0b3 100644 --- a/gstreamer-video/src/auto/enums.rs +++ b/gstreamer-video/src/auto/enums.rs @@ -764,43 +764,6 @@ impl SetValue for VideoMultiviewMode { } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] -pub enum VideoOverlayFormatFlags { - None, - PremultipliedAlpha, - GlobalAlpha, - #[doc(hidden)] - __Unknown(i32), -} - -#[doc(hidden)] -impl ToGlib for VideoOverlayFormatFlags { - type GlibType = ffi::GstVideoOverlayFormatFlags; - - fn to_glib(&self) -> ffi::GstVideoOverlayFormatFlags { - match *self { - VideoOverlayFormatFlags::None => ffi::GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE, - VideoOverlayFormatFlags::PremultipliedAlpha => ffi::GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA, - VideoOverlayFormatFlags::GlobalAlpha => ffi::GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA, - VideoOverlayFormatFlags::__Unknown(value) => value - } - } -} - -#[doc(hidden)] -impl FromGlib for VideoOverlayFormatFlags { - fn from_glib(value: ffi::GstVideoOverlayFormatFlags) -> Self { - skip_assert_initialized!(); - match value { - 0 => VideoOverlayFormatFlags::None, - 1 => VideoOverlayFormatFlags::PremultipliedAlpha, - 2 => VideoOverlayFormatFlags::GlobalAlpha, - value => VideoOverlayFormatFlags::__Unknown(value), - } - } -} - #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] #[derive(Clone, Copy)] pub enum VideoTileMode { diff --git a/gstreamer-video/src/auto/flags.rs b/gstreamer-video/src/auto/flags.rs index ae3056810..d5b131f02 100644 --- a/gstreamer-video/src/auto/flags.rs +++ b/gstreamer-video/src/auto/flags.rs @@ -278,3 +278,28 @@ impl SetValue for VideoMultiviewFlags { } } +bitflags! { + pub struct VideoOverlayFormatFlags: u32 { + const NONE = 0; + const PREMULTIPLIED_ALPHA = 1; + const GLOBAL_ALPHA = 2; + } +} + +#[doc(hidden)] +impl ToGlib for VideoOverlayFormatFlags { + type GlibType = ffi::GstVideoOverlayFormatFlags; + + fn to_glib(&self) -> ffi::GstVideoOverlayFormatFlags { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for VideoOverlayFormatFlags { + fn from_glib(value: ffi::GstVideoOverlayFormatFlags) -> VideoOverlayFormatFlags { + skip_assert_initialized!(); + VideoOverlayFormatFlags::from_bits_truncate(value) + } +} + diff --git a/gstreamer-video/src/auto/mod.rs b/gstreamer-video/src/auto/mod.rs index 4d58dc71a..9d5c3fbc9 100644 --- a/gstreamer-video/src/auto/mod.rs +++ b/gstreamer-video/src/auto/mod.rs @@ -18,7 +18,6 @@ pub use self::enums::VideoFormat; pub use self::enums::VideoInterlaceMode; pub use self::enums::VideoMultiviewFramePacking; pub use self::enums::VideoMultiviewMode; -pub use self::enums::VideoOverlayFormatFlags; pub use self::enums::VideoTileMode; pub use self::enums::VideoTransferFunction; @@ -28,6 +27,7 @@ pub use self::flags::VideoFlags; pub use self::flags::VideoFormatFlags; pub use self::flags::VideoFrameFlags; pub use self::flags::VideoMultiviewFlags; +pub use self::flags::VideoOverlayFormatFlags; #[doc(hidden)] pub mod traits {