GstPbutils.Discoverer

g GObject.Object GObject.Object GstPbutils.Discoverer GstPbutils.Discoverer GObject.Object->GstPbutils.Discoverer

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (timeout)

discover_uri (uri)

discover_uri_async (uri)

start ()

stop ()

Virtual Methods

Inherited:

GObject.Object (7)

do_discovered (info, err)

do_finished ()

do_load_serialize_info (uri)

do_source_setup (source)

do_starting ()

Properties

Name

Type

Flags

Short Description

timeout

int

r/w/c

Timeout

use-cache

bool

r/w/c

Use cache

Signals

Inherited:

GObject.Object (1)

Name

Short Description

discovered

Will be emitted in async mode when all information on a URI could be discovered, or an error occurred.

finished

Will be emitted in async mode when all pending URIs have been processed.

load-serialized-info

Retrieves information about a URI from and external source of information, like a cache file.

source-setup

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.

starting

Will be emitted when the discover starts analyzing the pending URIs

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class GstPbutils.Discoverer(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GstPbutils.DiscovererClass

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 a GLib.MainContext, where one connects to the various signals, appends the URIs to be processed (through GstPbutils.Discoverer.discover_uri_async()) and then asks for the discovery to begin (through GstPbutils.Discoverer.start()). By default this will use the GLib default main context unless you have set a custom context using GLib.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:

GLib.Error

Returns:

The new GstPbutils.Discoverer. If an error occurred when creating the discoverer, err will be set accordingly and None will be returned. If err is set, the caller must free it when no longer needed using GLib.Error.free().

Return type:

GstPbutils.Discoverer

Creates a new GstPbutils.Discoverer with the provided timeout.

discover_uri(uri)[source]
Parameters:

uri (str) – The URI to run on.

Raises:

GLib.Error

Returns:

the result of the scanning. Can be None if an error occurred.

Return type:

GstPbutils.DiscovererInfo

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, else False

Return type:

bool

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 for GstPbutils.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:
do_finished() virtual
do_load_serialize_info(uri) virtual
Parameters:

uri (str) – the uri to load the info from

Returns:

the GstPbutils.DiscovererInfo or None if it could not be loaded

Return type:

GstPbutils.DiscovererInfo

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:

RUN_LAST

Parameters:

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:

RUN_LAST

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:

RUN_LAST

Parameters:
  • discoverer (GstPbutils.Discoverer) – The object which received the signal

  • uri (str) – THe URI to load the serialized info for

Returns:

The GstPbutils.DiscovererInfo representing uri, or None if no information

Return type:

GstPbutils.DiscovererInfo or None

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:

RUN_LAST

Parameters:

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:

RUN_LAST

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
Name:

timeout

Type:

int

Default Value:

15000000000

Flags:

READABLE, WRITABLE, CONSTRUCT

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.

GstPbutils.Discoverer.props.use_cache
Name:

use-cache

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Use cache