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
Modifier and TypeClassDescriptionstatic class
Discoverer.Builder<B extends Discoverer.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theDiscoveredCallback
callback.static class
static interface
Functional interface declaration of theFinishedCallback
callback.static interface
Functional interface declaration of theLoadSerializedInfoCallback
callback.static interface
Functional interface declaration of theSourceSetupCallback
callback.static interface
Functional interface declaration of theStartingCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionDiscoverer
(MemorySegment address) Create a Discoverer proxy instance for the provided memory address.Discoverer
(ClockTime timeout) Creates a newGstDiscoverer
with the provided timeout. -
Method Summary
Modifier and TypeMethodDescriptionprotected Discoverer
asParent()
Returns this instance as if it were its parent type.static Discoverer.Builder
<? extends Discoverer.Builder> builder()
ADiscoverer.Builder
object constructs aDiscoverer
with the specified properties.protected void
discovered
(DiscovererInfo info, GError err) discoverUri
(String uri) Synchronously discovers the givenuri
.boolean
discoverUriAsync
(String uri) Appends the givenuri
to the list of URIs to discoverer.void
emitDiscovered
(DiscovererInfo info, @Nullable GError error) Emits the "discovered" signal.void
Emits the "finished" signal.Emits the "load-serialized-info" signal.void
emitSourceSetup
(Element source) Emits the "source-setup" signal.void
Emits the "starting" signal.protected void
finished()
static MemoryLayout
The memory layout of the native struct.static Type
getType()
Get the GType of the Discoverer classprotected DiscovererInfo
loadSerializeInfo
(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 void
sourceSetup
(Element source) void
start()
Allow asynchronous discovering of URIs to take place.protected void
starting()
void
stop()
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, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.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 newGstDiscoverer
with 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
-
-
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 Javasuper
keyword, 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
uri
will 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
null
if an error occurred. - Throws:
GErrorException
- seeGError
-
discoverUriAsync
Appends the givenuri
to the list of URIs to discoverer. The actual discovery of theuri
will only take place if gst_discoverer_start() has been called.A copy of
uri
will be made internally, so the caller can safely g_free() afterwards.- Parameters:
uri
- the URI to add.- Returns:
true
if theuri
was successfully appended to the list of pending uris, elsefalse
-
start
public void start()Allow asynchronous discovering of URIs to take place. AGMainLoop
must be available forGstDiscoverer
to 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
GstDiscovererInfo
ornull
if it could not be loaded
-
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,
info
might 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
- 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.Builder
object constructs aDiscoverer
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withDiscoverer.Builder.build()
.
-