Class Discoverer
- All Implemented Interfaces:
Proxy
GstDiscoverer is a utility object which allows to get as much
information as possible from one or many URIs.
It provides two APIs, allowing usage in blocking or non-blocking mode.
The blocking mode just requires calling gst_discoverer_discover_uri() with the URI one wishes to discover.
The non-blocking mode requires a running GMainLoop iterating a
GMainContext, where one connects to the various signals, appends the
URIs to be processed (through gst_discoverer_discover_uri_async()) and then
asks for the discovery to begin (through gst_discoverer_start()).
By default this will use the GLib default main context unless you have
set a custom context using g_main_context_push_thread_default().
All the information is returned in a GstDiscovererInfo structure.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDiscoverer.Builder<B extends Discoverer.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theDiscoveredCallbackcallback.static classstatic interfaceFunctional interface declaration of theFinishedCallbackcallback.static interfaceFunctional interface declaration of theLoadSerializedInfoCallbackcallback.static interfaceFunctional interface declaration of theSourceSetupCallbackcallback.static interfaceFunctional interface declaration of theStartingCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Discoverer.Discoverer(MemorySegment address) Create a Discoverer proxy instance for the provided memory address.Discoverer(ClockTime timeout) Creates a newGstDiscovererwith the provided timeout. -
Method Summary
Modifier and TypeMethodDescriptionprotected DiscovererasParent()Returns this instance as if it were its parent type.static Discoverer.Builder<? extends Discoverer.Builder> builder()ADiscoverer.Builderobject constructs aDiscovererwith the specified properties.protected voiddiscovered(DiscovererInfo info, GError err) discoverUri(String uri) Synchronously discovers the givenuri.booleandiscoverUriAsync(String uri) Appends the givenurito the list of URIs to discoverer.voidemitDiscovered(@Nullable DiscovererInfo info, @Nullable GError error) Emits the "discovered" signal.voidEmits the "finished" signal.Emits the "load-serialized-info" signal.voidemitSourceSetup(@Nullable Element source) Emits the "source-setup" signal.voidEmits the "starting" signal.protected voidfinished()static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the Discoverer classprotected DiscovererInfoloadSerializeInfo(String uri) Loads the serialized info from the given uri.Will be emitted in async mode when all information on a URI could be discovered, or an error occurred.onFinished(Discoverer.FinishedCallback handler) Will be emitted in async mode when all pending URIs have been processed.Retrieves information about a URI from and external source of information, like a cache file.This signal is emitted after the source element has been created for, so the URI being discovered, so it can be configured by setting additional properties (e.g.onStarting(Discoverer.StartingCallback handler) Will be emitted when the discover starts analyzing the pending URIsprotected voidsourceSetup(Element source) voidstart()Allow asynchronous discovering of URIs to take place.protected voidstarting()voidstop()Stop the discovery of any pending URIs and clears the list of pending URIS (if any).Methods 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, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, 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
-
Discoverer
Create a Discoverer proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Discoverer
Creates a newGstDiscovererwith the provided timeout.- Parameters:
timeout- timeout per file, in nanoseconds. Allowed are values between one second (GST_SECOND) and one hour (3600 *GST_SECOND)- Throws:
GErrorException- seeGError
-
Discoverer
public Discoverer()Creates a new Discoverer.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
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. -
discoverUri
Synchronously discovers the givenuri.A copy of
uriwill be made internally, so the caller can safely g_free() afterwards.- Parameters:
uri- The URI to run on.- Returns:
- the result of the scanning. Can be
nullif an error occurred. - Throws:
GErrorException- seeGError
-
discoverUriAsync
Appends the givenurito the list of URIs to discoverer. The actual discovery of theuriwill only take place if gst_discoverer_start() has been called.A copy of
uriwill be made internally, so the caller can safely g_free() afterwards.- Parameters:
uri- the URI to add.- Returns:
trueif theuriwas successfully appended to the list of pending uris, elsefalse
-
start
public void start()Allow asynchronous discovering of URIs to take place. AGMainLoopmust be available forGstDiscovererto properly work in asynchronous mode. -
stop
public void stop()Stop the discovery of any pending URIs and clears the list of pending URIS (if any). -
discovered
-
finished
protected void finished() -
loadSerializeInfo
Loads the serialized info from the given uri.- Parameters:
uri- the uri to load the info from- Returns:
- the
GstDiscovererInfoornullif it could not be loaded - Since:
- 1.24
-
sourceSetup
-
starting
protected void starting() -
onDiscovered
public SignalConnection<Discoverer.DiscoveredCallback> onDiscovered(Discoverer.DiscoveredCallback handler) Will be emitted in async mode when all information on a URI could be discovered, or an error occurred.When an error occurs,
infomight still contain some partial information, depending on the circumstances of the error.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitDiscovered
Emits the "discovered" signal. SeeonDiscovered(org.freedesktop.gstreamer.pbutils.Discoverer.DiscoveredCallback). -
onFinished
public SignalConnection<Discoverer.FinishedCallback> onFinished(Discoverer.FinishedCallback handler) Will be emitted in async mode when all pending URIs have been processed.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitFinished
public void emitFinished()Emits the "finished" signal. SeeonFinished(org.freedesktop.gstreamer.pbutils.Discoverer.FinishedCallback). -
onLoadSerializedInfo
public SignalConnection<Discoverer.LoadSerializedInfoCallback> onLoadSerializedInfo(Discoverer.LoadSerializedInfoCallback handler) Retrieves information about a URI from and external source of information, like a cache file. This is used by the discoverer to speed up the discovery.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 1.24
- See Also:
-
emitLoadSerializedInfo
Emits the "load-serialized-info" signal. SeeonLoadSerializedInfo(org.freedesktop.gstreamer.pbutils.Discoverer.LoadSerializedInfoCallback). -
onSourceSetup
public SignalConnection<Discoverer.SourceSetupCallback> onSourceSetup(Discoverer.SourceSetupCallback handler) This signal is emitted after the source element has been created for, so the URI being discovered, so it can be configured by setting additional properties (e.g. set a proxy server for an http source, or set the device and read speed for an audio cd source).This signal is usually emitted from the context of a GStreamer streaming thread.
- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitSourceSetup
Emits the "source-setup" signal. SeeonSourceSetup(org.freedesktop.gstreamer.pbutils.Discoverer.SourceSetupCallback). -
onStarting
public SignalConnection<Discoverer.StartingCallback> onStarting(Discoverer.StartingCallback handler) Will be emitted when the discover starts analyzing the pending URIs- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitStarting
public void emitStarting()Emits the "starting" signal. SeeonStarting(org.freedesktop.gstreamer.pbutils.Discoverer.StartingCallback). -
builder
ADiscoverer.Builderobject constructs aDiscovererwith the specified properties. Use the variousset...()methods to set properties, and finish construction withDiscoverer.Builder.build().- Returns:
- the builder object
-