GstPbutils.Discoverer¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/c |
Timeout |
||
r/w/c |
Use cache |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Will be emitted in async mode when all information on a URI could be discovered, or an error occurred. |
|
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. |
|
Will be emitted when the discover starts analyzing the pending URIs |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class GstPbutils.Discoverer(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
The
GstPbutils.Discoverer
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
GstPbutils.Discoverer.discover_uri
() with the URI one wishes to discover.The non-blocking mode requires a running
GLib.MainLoop
iterating aGLib.MainContext
, where one connects to the various signals, appends the URIs to be processed (throughGstPbutils.Discoverer.discover_uri_async
()) and then asks for the discovery to begin (throughGstPbutils.Discoverer.start
()). By default this will use the GLib default main context unless you have set a custom context usingGLib.MainContext.push_thread_default
().All the information is returned in a
GstPbutils.DiscovererInfo
structure.- classmethod new(timeout)[source]¶
- Parameters:
timeout (
int
) – timeout per file, in nanoseconds. Allowed are values between one second (Gst.SECOND
) and one hour (3600 *Gst.SECOND
)- Raises:
- Returns:
The new
GstPbutils.Discoverer
. If an error occurred when creating the discoverer, err will be set accordingly andNone
will be returned. If err is set, the caller must free it when no longer needed usingGLib.Error.free
().- Return type:
Creates a new
GstPbutils.Discoverer
with the provided timeout.
- discover_uri(uri)[source]¶
- Parameters:
uri (
str
) – The URI to run on.- Raises:
- Returns:
the result of the scanning. Can be
None
if an error occurred.- Return type:
Synchronously discovers the given uri.
A copy of uri will be made internally, so the caller can safely
GLib.free
() afterwards.
- discover_uri_async(uri)[source]¶
- Parameters:
uri (
str
) – the URI to add.- Returns:
True
if the uri was successfully appended to the list of pending uris, elseFalse
- Return type:
Appends the given uri to the list of URIs to discoverer. The actual discovery of the uri will only take place if
GstPbutils.Discoverer.start
() has been called.A copy of uri will be made internally, so the caller can safely
GLib.free
() afterwards.
- start()[source]¶
Allow asynchronous discovering of URIs to take place. A
GLib.MainLoop
must be available forGstPbutils.Discoverer
to properly work in asynchronous mode.
- stop()[source]¶
Stop the discovery of any pending URIs and clears the list of pending URIS (if any).
- do_discovered(info, err) virtual¶
- Parameters:
info (
GstPbutils.DiscovererInfo
) –err (
GLib.Error
) –
- do_finished() virtual¶
- do_load_serialize_info(uri) virtual¶
- Parameters:
uri (
str
) – the uri to load the info from- Returns:
the
GstPbutils.DiscovererInfo
orNone
if it could not be loaded- Return type:
Loads the serialized info from the given uri.
New in version 1.24.
- do_source_setup(source) virtual¶
- Parameters:
source (
Gst.Element
) –
- do_starting() virtual¶
Signal Details¶
- GstPbutils.Discoverer.signals.discovered(discoverer, info, error)¶
- Signal Name:
discovered
- Flags:
- Parameters:
discoverer (
GstPbutils.Discoverer
) – The object which received the signalinfo (
GstPbutils.DiscovererInfo
) – the resultsGstPbutils.DiscovererInfo
error (
GLib.Error
orNone
) –GLib.Error
, which will be non-None
if an error occurred during discovery. You must not free thisGLib.Error
, it will be freed by the discoverer.
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.
- GstPbutils.Discoverer.signals.finished(discoverer)¶
- Signal Name:
finished
- Flags:
- Parameters:
discoverer (
GstPbutils.Discoverer
) – The object which received the signal
Will be emitted in async mode when all pending URIs have been processed.
- GstPbutils.Discoverer.signals.load_serialized_info(discoverer, uri)¶
- Signal Name:
load-serialized-info
- Flags:
- Parameters:
discoverer (
GstPbutils.Discoverer
) – The object which received the signaluri (
str
) – THe URI to load the serialized info for
- Returns:
The
GstPbutils.DiscovererInfo
representing uri, orNone
if no information- Return type:
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.
New in version 1.24.
- GstPbutils.Discoverer.signals.source_setup(discoverer, source)¶
- Signal Name:
source-setup
- Flags:
- Parameters:
discoverer (
GstPbutils.Discoverer
) – The object which received the signalsource (
Gst.Element
) – source element
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.
- GstPbutils.Discoverer.signals.starting(discoverer)¶
- Signal Name:
starting
- Flags:
- Parameters:
discoverer (
GstPbutils.Discoverer
) – The object which received the signal
Will be emitted when the discover starts analyzing the pending URIs
Property Details¶
- GstPbutils.Discoverer.props.timeout¶
-
The duration (in nanoseconds) after which the discovery of an individual URI will timeout.
If the discovery of a URI times out, the
GstPbutils.DiscovererResult.TIMEOUT
will be set on the result flags.