diff --git a/gstreamer/Gir.toml b/gstreamer/Gir.toml index 9fe5ebf4a..7339093c3 100644 --- a/gstreamer/Gir.toml +++ b/gstreamer/Gir.toml @@ -25,7 +25,6 @@ generate = [ "Gst.DebugColorFlags", "Gst.DebugGraphDetails", "Gst.DebugLevel", - "Gst.ElementFactoryListType", "Gst.EventTypeFlags", "Gst.LibraryError", "Gst.PadDirection", @@ -232,6 +231,11 @@ status = "generate" name = "last" ignore = true +[[object]] +name = "Gst.ElementFactoryListType" +status = "manual" +conversion_type = "scalar" + [[object]] name = "Gst.Format" status = "generate" diff --git a/gstreamer/src/auto/alias.rs b/gstreamer/src/auto/alias.rs index b95a1209c..9fdf10c5a 100644 --- a/gstreamer/src/auto/alias.rs +++ b/gstreamer/src/auto/alias.rs @@ -6,4 +6,3 @@ use crate::auto::*; pub type ClockTimeDiff = i64; -pub type ElementFactoryListType = u64; diff --git a/gstreamer/src/auto/element_factory.rs b/gstreamer/src/auto/element_factory.rs index 121f66c9c..00a964897 100644 --- a/gstreamer/src/auto/element_factory.rs +++ b/gstreamer/src/auto/element_factory.rs @@ -144,7 +144,7 @@ impl ElementFactory { unsafe { from_glib(ffi::gst_element_factory_list_is_type( self.to_glib_none().0, - type_, + type_.to_glib(), )) } } @@ -178,7 +178,7 @@ impl ElementFactory { assert_initialized_main_thread!(); unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_element_factory_list_get_elements( - type_, + type_.to_glib(), minrank.to_glib(), )) } diff --git a/gstreamer/src/auto/mod.rs b/gstreamer/src/auto/mod.rs index 3a2e45654..b9a2f1ba2 100644 --- a/gstreamer/src/auto/mod.rs +++ b/gstreamer/src/auto/mod.rs @@ -208,7 +208,6 @@ pub use self::flags::StreamType; mod alias; pub use self::alias::ClockTimeDiff; -pub use self::alias::ElementFactoryListType; pub mod functions; diff --git a/gstreamer/src/element_factory_list_type.rs b/gstreamer/src/element_factory_list_type.rs new file mode 100644 index 000000000..d27bc972f --- /dev/null +++ b/gstreamer/src/element_factory_list_type.rs @@ -0,0 +1,53 @@ +// Take a look at the license at the top of the repository in the LICENSE file. + +use bitflags::bitflags; +use glib::translate::*; + +bitflags! { + pub struct ElementFactoryListType: u64 { + const DECODER = 0b_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0001; + const ENCODER = 0b_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0010; + const SINK = 0b_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0100; + const SRC = 0b_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_1000; + const MUXER = 0b_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0001_0000; + const DEMUXER = 0b_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0010_0000; + const PARSER = 0b_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0100_0000; + const PAYLOADER = 0b_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_1000_0000; + const DEPAYLOADER = 0b_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0001_0000_0000; + const FORMATTER = 0b_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0010_0000_0000; + const DECRYPTOR = 0b_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0100_0000_0000; + const ENCRYPTOR = 0b_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_1000_0000_0000; + const HARDWARE = 0b_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0001_0000_0000_0000; + + const MEDIA_VIDEO = 0b_0000_0000_0000_0010_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000; + const MEDIA_AUDIO = 0b_0000_0000_0000_0100_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000; + const MEDIA_IMAGE = 0b_0000_0000_0000_1000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000; + const MEDIA_SUBTITLE = 0b_0000_0000_0001_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000; + const MEDIA_METADATA = 0b_0000_0000_0010_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000; + + const ANY = 0b_0000_0000_0000_0001_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111; + const MEDIA_ANY = 0b_1111_1111_1111_1110_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000; + + const VIDEO_ENCODER = Self::ENCODER.bits | Self::MEDIA_VIDEO.bits | Self::MEDIA_IMAGE.bits; + const AUDIO_ENCODER = Self::ENCODER.bits | Self::MEDIA_AUDIO.bits; + const AUDIOVIDEO_SINKS = Self::SINK.bits | Self::MEDIA_AUDIO.bits | Self::MEDIA_VIDEO.bits | Self::MEDIA_IMAGE.bits; + const DECODABLE = Self::DECODER.bits | Self::DEMUXER.bits | Self::DEPAYLOADER.bits | Self::PARSER.bits | Self::DECRYPTOR.bits; + } +} + +#[doc(hidden)] +impl ToGlib for ElementFactoryListType { + type GlibType = ffi::GstElementFactoryListType; + + fn to_glib(&self) -> ffi::GstElementFactoryListType { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for ElementFactoryListType { + unsafe fn from_glib(value: ffi::GstElementFactoryListType) -> ElementFactoryListType { + skip_assert_initialized!(); + ElementFactoryListType::from_bits_truncate(value) + } +} diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index 9c1b2cebf..685351fa4 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -132,6 +132,9 @@ pub use crate::pipeline::GstPipelineExtManual; mod allocation_params; pub use self::allocation_params::AllocationParams; +mod element_factory_list_type; +pub use element_factory_list_type::*; + // OS dependent Bus extensions (also import the other plateform mod for doc) #[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]