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
impl TypeFind
sourcepub fn register<F>(
plugin: Option<&Plugin>,
name: &str,
rank: Rank,
extensions: Option<&str>,
possible_caps: Option<&Caps>,
func: F,
) -> Result<(), BoolError>
pub fn register<F>( plugin: Option<&Plugin>, name: &str, rank: Rank, extensions: Option<&str>, possible_caps: Option<&Caps>, func: F, ) -> Result<(), BoolError>
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
sourcepub fn peek(&mut self, offset: i64, size: u32) -> Option<&[u8]>
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.
sourcepub fn suggest(&mut self, probability: TypeFindProbability, caps: &Caps)
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
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TypeFind
impl RefUnwindSafe for TypeFind
impl !Send for TypeFind
impl !Sync for TypeFind
impl Unpin for TypeFind
impl UnwindSafe for TypeFind
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more