Package org.freedesktop.gstreamer.gst
Class TypeFindFactory
java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.gobject.TypeInstance
org.gnome.gobject.GObject
org.gnome.gobject.InitiallyUnowned
org.freedesktop.gstreamer.gst.GstObject
org.freedesktop.gstreamer.gst.PluginFeature
org.freedesktop.gstreamer.gst.TypeFindFactory
- All Implemented Interfaces:
Proxy
These functions allow querying information about registered typefind
functions. How to create and register these functions is described in
the section <link linkend="gstreamer-Writing-typefind-functions">
"Writing typefind functions"</link>.
The following example shows how to write a very simple typefinder that identifies the given data. You can get quite a bit more complicated than that though.
typedef struct {
guint8 *data;
guint size;
guint probability;
GstCaps *data;
} MyTypeFind;
static void
my_peek (gpointer data, gint64 offset, guint size)
{
MyTypeFind *find = (MyTypeFind *) data;
if (offset >= 0 && offset + size <= find->size) {
return find->data + offset;
}
return NULL;
}
static void
my_suggest (gpointer data, guint probability, GstCaps *caps)
{
MyTypeFind *find = (MyTypeFind *) data;
if (probability > find->probability) {
find->probability = probability;
gst_caps_replace (&find->caps, caps);
}
}
static GstCaps *
find_type (guint8 *data, guint size)
{
GList *walk, *type_list;
MyTypeFind find = {data, size, 0, NULL};
GstTypeFind gst_find = {my_peek, my_suggest, &find, };
walk = type_list = gst_type_find_factory_get_list ();
while (walk) {
GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (walk->data);
walk = g_list_next (walk)
gst_type_find_factory_call_function (factory, &gst_find);
}
g_list_free (type_list);
return find.caps;
};
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTypeFindFactory.Builder<B extends TypeFindFactory.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class org.freedesktop.gstreamer.gst.PluginFeature
PluginFeature.PluginFeature$Impl, PluginFeature.PluginFeatureClassNested classes/interfaces inherited from class org.freedesktop.gstreamer.gst.GstObject
GstObject.DeepNotifyCallback, GstObject.Object$Impl, GstObject.ObjectClassNested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new TypeFindFactory.TypeFindFactory(MemorySegment address) Create a TypeFindFactory proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected TypeFindFactoryasParent()Returns this instance as if it were its parent type.static TypeFindFactory.Builder<? extends TypeFindFactory.Builder> builder()ATypeFindFactory.Builderobject constructs aTypeFindFactorywith the specified properties.voidcallFunction(TypeFind find) Calls theGstTypeFindFunctionassociated with this factory.@Nullable CapsgetCaps()Gets theGstCapsassociated with a typefind factory.@Nullable String @Nullable []Gets the extensions associated with aGstTypeFindFactory.static List<TypeFindFactory> getList()Gets the list of all registered typefind factories.static @Nullable TypegetType()Get the GType of the TypeFindFactory classbooleanCheck whether the factory has a typefind function.Methods inherited from class org.freedesktop.gstreamer.gst.PluginFeature
checkVersion, getPlugin, getPluginName, getRank, listCopy, listDebug, listFree, load, rankCompareFunc, setRankMethods inherited from class org.freedesktop.gstreamer.gst.GstObject
addControlBinding, checkUniqueness, deepNotify, defaultDeepNotify, defaultError, emitDeepNotify, getControlBinding, getControlRate, getGValueArray, getMemoryLayout, getName, getParent, getPathString, getValue, getValueArray, hasActiveControlBindings, hasAncestor, hasAsAncestor, hasAsParent, onDeepNotify, ref, refSink, removeControlBinding, replace, setControlBindingDisabled, setControlBindingsDisabled, setControlRate, setName, setParent, suggestNextSync, syncValues, unparent, unrefMethods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
TypeFindFactory
Create a TypeFindFactory proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
TypeFindFactory
public TypeFindFactory()Creates a new TypeFindFactory.
-
-
Method Details
-
getType
Get the GType of the TypeFindFactory class- Returns:
- the GType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type.- Overrides:
asParentin classPluginFeature
-
getList
Gets the list of all registered typefind factories. You must free the list using gst_plugin_feature_list_free().The returned factories are sorted by highest rank first, and then by factory name.
Free-function: gst_plugin_feature_list_free
- Returns:
- the list of all
registered
GstTypeFindFactory.
-
callFunction
Calls theGstTypeFindFunctionassociated with this factory.- Parameters:
find- a properly setupGstTypeFindentry. The get_data and suggest_type members must be set.
-
getCaps
Gets theGstCapsassociated with a typefind factory.- Returns:
- the
GstCapsassociated with this factory
-
getExtensions
Gets the extensions associated with aGstTypeFindFactory. The returned array should not be changed. If you need to change stuff in it, you should copy it using g_strdupv(). This function may returnnullto indicate a 0-length list.- Returns:
- a
null-terminated array of extensions associated with this factory
-
hasFunction
public boolean hasFunction()Check whether the factory has a typefind function. Typefind factories without typefind functions are a last-effort fallback mechanism to e.g. assume a certain media type based on the file extension.- Returns:
trueif the factory has a typefind functions set, otherwisefalse
-
builder
ATypeFindFactory.Builderobject constructs aTypeFindFactorywith the specified properties. Use the variousset...()methods to set properties, and finish construction withTypeFindFactory.Builder.build().- Returns:
- the builder object
-