Gst.DeviceProvider

g GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gst.DeviceProvider Gst.DeviceProvider Gst.Object->Gst.DeviceProvider

Subclasses:

None

Methods

Inherited:

Gst.Object (27), GObject.Object (37)

Structs:

Gst.DeviceProviderClass (5), GObject.ObjectClass (5)

class

add_metadata (key, value)

class

add_static_metadata (key, value)

class

get_metadata (key)

class

register (plugin, name, rank, type)

class

set_metadata (longname, classification, description, author)

class

set_static_metadata (longname, classification, description, author)

can_monitor ()

device_add (device)

device_changed (device, changed_device)

device_remove (device)

get_bus ()

get_devices ()

get_factory ()

get_hidden_providers ()

get_metadata (key)

hide_provider (name)

is_started ()

start ()

stop ()

unhide_provider (name)

Virtual Methods

Inherited:

Gst.Object (1), GObject.Object (7)

do_start ()

do_stop ()

Properties

Inherited:

Gst.Object (2)

Signals

Inherited:

Gst.Object (1), GObject.Object (1)

Name

Short Description

provider-hidden

provider-unhidden

Fields

Inherited:

Gst.Object (1), GObject.Object (1)

Name

Type

Access

Description

devices

[object]

r

a GLib.List of the Gst.Device objects

parent

Gst.Object

r

The parent Gst.Object

Class Details

class Gst.DeviceProvider(**kwargs)
Bases:

Gst.Object

Abstract:

Yes

Structure:

Gst.DeviceProviderClass

A Gst.DeviceProvider subclass is provided by a plugin that handles devices if there is a way to programmatically list connected devices. It can also optionally provide updates to the list of connected devices.

Each Gst.DeviceProvider subclass is a singleton, a plugin should normally provide a single subclass for all devices.

Applications would normally use a Gst.DeviceMonitor to monitor devices from all relevant providers.

New in version 1.4.

classmethod add_metadata(key, value)
Parameters:
  • key (str) – the key to set

  • value (str) – the value to set

Set key with value as metadata in self.

New in version 1.4.

classmethod add_static_metadata(key, value)
Parameters:
  • key (str) – the key to set

  • value (str) – the value to set

Set key with value as metadata in self.

Same as Gst.DeviceProviderClass.add_metadata(), but value must be a static string or an inlined string, as it will not be copied. (GStreamer plugins will be made resident once loaded, so this function can be used even from dynamically loaded plugins.)

New in version 1.4.

classmethod get_metadata(key)[source]
Parameters:

key (str) – the key to get

Returns:

the metadata for key.

Return type:

str or None

Get metadata with key in self.

New in version 1.4.

classmethod register(plugin, name, rank, type)[source]
Parameters:
  • plugin (Gst.Plugin or None) – Gst.Plugin to register the device provider with, or None for a static device provider.

  • name (str) – name of device providers of this type

  • rank (int) – rank of device provider (higher rank means more importance when autoplugging)

  • type (GObject.GType) – GObject.GType of device provider to register

Returns:

True, if the registering succeeded, False on error

Return type:

bool

Create a new device providerfactory capable of instantiating objects of the type and add the factory to plugin.

New in version 1.4.

classmethod set_metadata(longname, classification, description, author)
Parameters:
  • longname (str) – The long English name of the device provider. E.g. “File Sink”

  • classification (str) – String describing the type of device provider, as an unordered list separated with slashes (‘/’). See draft-klass.txt of the design docs for more details and common types. E.g: “Sink/File”

  • description (str) – Sentence describing the purpose of the device provider. E.g: “Write stream to a file”

  • author (str) – Name and contact details of the author(s). Use \n to separate multiple author metadata. E.g: “Joe Bloggs <joe.blogs at foo.com>”

Sets the detailed information for a Gst.DeviceProviderClass.

This function is for use in _class_init functions only.

New in version 1.4.

classmethod set_static_metadata(longname, classification, description, author)
Parameters:
  • longname (str) – The long English name of the element. E.g. “File Sink”

  • classification (str) – String describing the type of element, as an unordered list separated with slashes (‘/’). See draft-klass.txt of the design docs for more details and common types. E.g: “Sink/File”

  • description (str) – Sentence describing the purpose of the element. E.g: “Write stream to a file”

  • author (str) – Name and contact details of the author(s). Use \n to separate multiple author metadata. E.g: “Joe Bloggs <joe.blogs at foo.com>”

Sets the detailed information for a Gst.DeviceProviderClass.

This function is for use in _class_init functions only.

Same as Gst.DeviceProviderClass.set_metadata(), but longname, classification, description, and author must be static strings or inlined strings, as they will not be copied. (GStreamer plugins will be made resident once loaded, so this function can be used even from dynamically loaded plugins.)

New in version 1.4.

can_monitor()[source]
Return type:

bool

device_add(device)[source]
Parameters:

device (Gst.Device) – a Gst.Device that has been added

Posts a message on the provider’s Gst.Bus to inform applications that a new device has been added.

This is for use by subclasses.

device's reference count will be incremented, and any floating reference will be removed (see gst_object_ref_sink()).

New in version 1.4.

device_changed(device, changed_device)[source]
Parameters:
  • device (Gst.Device) – the new version of changed_device

  • changed_device (Gst.Device) – the old version of the device that has been updated

This function is used when changed_device was modified into its new form device. This will post a DEVICE_CHANGED message on the bus to let the application know that the device was modified. Gst.Device is immutable for MT. safety purposes so this is an “atomic” way of letting the application know when a device was modified.

New in version 1.16.

device_remove(device)[source]
Parameters:

device (Gst.Device) – a Gst.Device that has been removed

Posts a message on the provider’s Gst.Bus to inform applications that a device has been removed.

This is for use by subclasses.

New in version 1.4.

get_bus()[source]
Returns:

a Gst.Bus

Return type:

Gst.Bus

Gets the Gst.Bus of this Gst.DeviceProvider

New in version 1.4.

get_devices()[source]
Returns:

a GLib.List of Gst.Device

Return type:

[Gst.Device]

Gets a list of devices that this provider understands. This may actually probe the hardware if the provider is not currently started.

If the provider has been started, this will returned the same Gst.Device objedcts that have been returned by the Gst.MessageType.DEVICE_ADDED messages.

New in version 1.4.

get_factory()[source]
Returns:

the Gst.DeviceProviderFactory used for creating this device provider. no refcounting is needed.

Return type:

Gst.DeviceProviderFactory or None

Retrieves the factory that was used to create this device provider.

New in version 1.4.

get_hidden_providers()[source]
Returns:

a list of hidden providers factory names or None when nothing is hidden by self. Free with GLib.strfreev.

Return type:

[str]

Get the provider factory names of the Gst.DeviceProvider instances that are hidden by self.

New in version 1.6.

get_metadata(key)[source]
Parameters:

key (str) – the key to get

Returns:

the metadata for key.

Return type:

str

Get metadata with key in self.

New in version 1.14.

hide_provider(name)[source]
Parameters:

name (str) – a provider factory name

Make self hide the devices from the factory with name.

This function is used when self will also provide the devices reported by provider factory name. A monitor should stop monitoring the device provider with name to avoid duplicate devices.

New in version 1.6.

is_started()[source]
Return type:

bool

This function can be used to know if the self was successfully started.

New in version 1.20.

start()[source]
Returns:

True if the device providering could be started

Return type:

bool

Starts providering the devices. This will cause Gst.MessageType.DEVICE_ADDED and Gst.MessageType.DEVICE_REMOVED messages to be posted on the provider’s bus when devices are added or removed from the system.

Since the Gst.DeviceProvider is a singleton, Gst.DeviceProvider.start() may already have been called by another user of the object, Gst.DeviceProvider.stop() needs to be called the same number of times.

After this function has been called, Gst.DeviceProvider.get_devices() will return the same objects that have been received from the Gst.MessageType.DEVICE_ADDED messages and will no longer probe.

New in version 1.4.

stop()[source]

Decreases the use-count by one. If the use count reaches zero, this Gst.DeviceProvider will stop providering the devices. This needs to be called the same number of times that Gst.DeviceProvider.start() was called.

New in version 1.4.

unhide_provider(name)[source]
Parameters:

name (str) – a provider factory name

Make self unhide the devices from factory name.

This function is used when self will no longer provide the devices reported by provider factory name. A monitor should start monitoring the devices from provider factory name in order to see all devices again.

New in version 1.6.

do_start() virtual
Returns:

True if the device providering could be started

Return type:

bool

Starts providering the devices. This will cause Gst.MessageType.DEVICE_ADDED and Gst.MessageType.DEVICE_REMOVED messages to be posted on the provider’s bus when devices are added or removed from the system.

Since the Gst.DeviceProvider is a singleton, Gst.DeviceProvider.start() may already have been called by another user of the object, Gst.DeviceProvider.stop() needs to be called the same number of times.

After this function has been called, Gst.DeviceProvider.get_devices() will return the same objects that have been received from the Gst.MessageType.DEVICE_ADDED messages and will no longer probe.

New in version 1.4.

do_stop() virtual

Decreases the use-count by one. If the use count reaches zero, this Gst.DeviceProvider will stop providering the devices. This needs to be called the same number of times that Gst.DeviceProvider.start() was called.

New in version 1.4.

Signal Details

Gst.DeviceProvider.signals.provider_hidden(device_provider, object)
Signal Name:

provider-hidden

Flags:

RUN_FIRST

Parameters:
Gst.DeviceProvider.signals.provider_unhidden(device_provider, object)
Signal Name:

provider-unhidden

Flags:

RUN_FIRST

Parameters: