Skip to main content

ElementClassExt

Trait ElementClassExt 

Source
pub unsafe trait ElementClassExt {
    // Provided methods
    fn metadata<'a>(&self, key: &str) -> Option<&'a str> { ... }
    fn pad_template(&self, name: &str) -> Option<PadTemplate> { ... }
    fn pad_template_list(&self) -> List<PadTemplate> { ... }
    fn is_untrusted_aware(&self) -> bool { ... }
    fn mark_as_untrusted_aware(&mut self) { ... }
    fn set_metadata(
        &mut self,
        long_name: &str,
        classification: &str,
        description: &str,
        author: &str,
    ) { ... }
    fn add_pad_template(&mut self, pad_template: &PadTemplate) { ... }
    fn add_metadata(&mut self, key: &str, value: &str) { ... }
    fn set_static_metadata(
        &mut self,
        long_name: &'static GStr,
        classification: &'static GStr,
        description: &'static GStr,
        author: &'static GStr,
    ) { ... }
    fn add_static_metadata(&mut self, key: &str, value: &'static GStr) { ... }
    fn add_static_pad_template(&mut self, pad_template: &StaticPadTemplate) { ... }
    fn add_static_pad_template_with_gtype(
        &mut self,
        pad_template: &StaticPadTemplate,
        pad_type: Type,
    ) { ... }
}

Provided Methods§

Source

fn metadata<'a>(&self, key: &str) -> Option<&'a str>

Get metadata with key in self.

§key

the key to get

§Returns

the metadata for key.

Source

fn pad_template(&self, name: &str) -> Option<PadTemplate>

Retrieves a padtemplate from self with the given name.

If you use this function in the GInstanceInitFunc of an object class that has subclasses, make sure to pass the g_class parameter of the GInstanceInitFunc here.

§name

the name of the PadTemplate to get.

§Returns

the PadTemplate with the given name, or None if none was found. No unreferencing is necessary.

Source

fn pad_template_list(&self) -> List<PadTemplate>

Retrieves a list of the pad templates associated with self. The list must not be modified by the calling code.

If you use this function in the GInstanceInitFunc of an object class that has subclasses, make sure to pass the g_class parameter of the GInstanceInitFunc here.

§Returns

the GList of pad templates.

Source

fn is_untrusted_aware(&self) -> bool

Checks whether self was marked with mark_as_untrusted_aware().

Use ElementFactory::is_untrusted_aware() to check this without loading the plugin the element lives in.

§Returns

true if self was reviewed for use with untrusted input.

Source

fn mark_as_untrusted_aware(&mut self)

Declares that self was reviewed for being instantiated and configured from an untrusted pipeline description, for example a [parse_launch()][crate::parse_launch()] string that came from an untrusted source: instantiating it cannot by itself reach outside media processing, and every property whose value can is marked GST_PARAM_UNTRUSTED_SENSITIVE.

Parsing a description with ParseFlags::NO_UNTRUSTED refuses to create elements that are not marked this way, so an element that was never reviewed, including any third-party element, cannot be instantiated from such a description.

Source

fn set_metadata( &mut self, long_name: &str, classification: &str, description: &str, author: &str, )

Sets the detailed information for a [ElementClass][crate::ElementClass].

This function is for use in _class_init functions only.

§longname

The long English name of the element. E.g. “File Sink”

§classification

String describing the type of element, as an unordered list separated with slashes (‘/’). See draft-klass.txt of the design docs for more details and common types. E.g: “Sink/File”

§description

Sentence describing the purpose of the element. E.g: “Write stream to a file”

§author

Name and contact details of the author(s). Use \n to separate multiple author metadata. E.g: “Joe Bloggs <joe.blogs at foo.com>”

Source

fn add_pad_template(&mut self, pad_template: &PadTemplate)

Adds a padtemplate to an element class. This is mainly used in the _class_init functions of classes. If a pad template with the same name as an already existing one is added the old one is replaced by the new one.

templ’s reference count will be incremented, and any floating reference will be removed (see gst_object_ref_sink())

§templ

a PadTemplate to add to the element class.

Source

fn add_metadata(&mut self, key: &str, value: &str)

Set key with value as metadata in self.

§key

the key to set

§value

the value to set

Source

fn set_static_metadata( &mut self, long_name: &'static GStr, classification: &'static GStr, description: &'static GStr, author: &'static GStr, )

Sets the detailed information for a [ElementClass][crate::ElementClass].

This function is for use in _class_init functions only.

Same as set_metadata(), but longname, classification, description, and author must be static strings or inlined strings, as they will not be copied. (GStreamer plugins will be made resident once loaded, so this function can be used even from dynamically loaded plugins.)

§longname

The long English name of the element. E.g. “File Sink”

§classification

String describing the type of element, as an unordered list separated with slashes (‘/’). See draft-klass.txt of the design docs for more details and common types. E.g: “Sink/File”

§description

Sentence describing the purpose of the element. E.g: “Write stream to a file”

§author

Name and contact details of the author(s). Use \n to separate multiple author metadata. E.g: “Joe Bloggs <joe.blogs at foo.com>”

Source

fn add_static_metadata(&mut self, key: &str, value: &'static GStr)

Set key with value as metadata in self.

Same as add_metadata(), but value must be a static string or an inlined string, as it will not be copied. (GStreamer plugins will be made resident once loaded, so this function can be used even from dynamically loaded plugins.)

§key

the key to set

§value

the value to set

Source

fn add_static_pad_template(&mut self, pad_template: &StaticPadTemplate)

Adds a pad template to an element class based on the static pad template templ. This is mainly used in the _class_init functions of element implementations. If a pad template with the same name already exists, the old one is replaced by the new one.

§static_templ

StaticPadTemplate to add as pad template to the element class.

Source

fn add_static_pad_template_with_gtype( &mut self, pad_template: &StaticPadTemplate, pad_type: Type, )

Adds a pad template to an element class based on the static pad template templ. This is mainly used in the _class_init functions of element implementations. If a pad template with the same name already exists, the old one is replaced by the new one.

§static_templ

StaticPadTemplate to add as pad template to the element class.

§pad_type

The GType of the pad to create

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: IsA<Element> + IsClass> ElementClassExt for Class<T>

Implementors§