Struct gstreamer::TypeFind

source ·
pub struct TypeFind(/* private fields */);
Expand description

The following functions allow you to detect the media type of an unknown stream.

Implementations§

source§

impl TypeFind

source

pub fn register<F>( plugin: Option<&Plugin>, name: &str, rank: Rank, extensions: Option<&str>, possible_caps: Option<&Caps>, func: F ) -> Result<(), BoolError>
where F: Fn(&mut TypeFind) + Send + Sync + 'static,

Registers a new typefind function to be used for typefinding. After registering this function will be available for typefinding. This function is typically called during an element’s plugin initialization.

§plugin

A Plugin, or None for a static typefind function

§name

The name for registering

§rank

The rank (or importance) of this typefind function

§func

The GstTypeFindFunction to use

§extensions

Optional comma-separated list of extensions that could belong to this type

§possible_caps

Optionally the caps that could be returned when typefinding succeeds

§data_notify

a GDestroyNotify that will be called on data when the plugin is unloaded.

§Returns

true on success, false otherwise

source

pub fn peek(&mut self, offset: i64, size: u32) -> Option<&[u8]>

Returns the size bytes of the stream to identify beginning at offset. If offset is a positive number, the offset is relative to the beginning of the stream, if offset is a negative number the offset is relative to the end of the stream. The returned memory is valid until the typefinding function returns and must not be freed.

§offset

The offset

§size

The number of bytes to return

§Returns

the requested data, or None if that data is not available.

source

pub fn suggest(&mut self, probability: TypeFindProbability, caps: &Caps)

If a GstTypeFindFunction calls this function it suggests the caps with the given probability. A GstTypeFindFunction may supply different suggestions in one call. It is up to the caller of the GstTypeFindFunction to interpret these values.

§probability

The probability in percent that the suggestion is right

§caps

The fixed Caps to suggest

source

pub fn length(&mut self) -> Option<u64>

Get the length of the data stream.

§Returns

The length of the data stream, or 0 if it is not available.

Trait Implementations§

source§

impl Debug for TypeFind

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.