backends package

vidhubcontrol.backends.base module

class vidhubcontrol.backends.base.BackendBase(**kwargs)[source]

Bases: pydispatch.dispatch.Dispatcher

Base class for communicating with devices

device_id

The unique id as reported by the switcher.

Type:str
device_version

The firmware version as reported by the switcher.

Type:str
device_model

The model name as reported by the switcher.

Type:str
connected

A flag indicating the connection status. pydispatch.properties.Property

Type:bool
Events:
on_preset_added: This Event is emitted
when a new Preset has been added.
on_preset_stored: This Event is emitted
when an existing Preset has been recorded (updated).
on_preset_active: This Event is emitted
when an existing Preset has determined that its stored routing information is currently active on the switcher.
class vidhubcontrol.backends.base.Preset(**kwargs)[source]

Bases: pydispatch.dispatch.Dispatcher

Stores and recalls routing information

name

The name of the preset. This is a pydispatch.Property

index

The index of the preset as it is stored in the presets container.

Type:int
crosspoints

The crosspoints that this preset has stored. This is a DictProperty

Type:dict
active

A flag indicating whether all of the crosspoints stored in this preset are currently active on the switcher. This is a pydispatch.Property

Type:bool
Events:
on_preset_stored: Dispatched after the preset stores its state.
class vidhubcontrol.backends.base.SmartScopeBackendBase(**kwargs)[source]

Bases: vidhubcontrol.backends.base.SmartViewBackendBase

class vidhubcontrol.backends.base.SmartScopeMonitor(**kwargs)[source]

Bases: vidhubcontrol.backends.base.SmartViewMonitor

A single instance of a monitor within a SmartScope device

scope_mode

The type of scope to display. Choices are: ‘audio_dbfs’, ‘audio_dbvu’, ‘histogram’, ‘parade_rgb’, ‘parade_yuv’, ‘video’, ‘vector_100’, ‘vector_75’, ‘waveform’.

Type:str
class vidhubcontrol.backends.base.SmartViewBackendBase(**kwargs)[source]

Bases: vidhubcontrol.backends.base.BackendBase

Base class for SmartView devices

num_monitors

Number of physical monitors as reported by the device

Type:int
inverted

True if the device has been mounted in an inverted configuration (to optimize viewing angle).

Type:bool
monitors

A list containing instances of SmartViewMonitor or SmartScopeMonitor, depending on device type.

Type:list
Events
on_monitor_property_change: Dispatched when any
Property value changes. The event signature for callbacks is (smartview_device, property_name, value, **kwargs) containing a keyword argument “monitor” containing the SmartViewMonitor instance.
coroutine set_monitor_property(monitor, name, value)[source]

Set a property value for the given SmartViewMonitor instance

Parameters:
  • monitor – The SmartViewMonitor instance to set
  • name (str) – Property name
  • value – The new value to set

This method is a coroutine.

class vidhubcontrol.backends.base.SmartViewMonitor(**kwargs)[source]

Bases: pydispatch.dispatch.Dispatcher

A single instance of a monitor within a SmartView device

index

Index of the monitor (zero-based)

Type:int
name

The name of the monitor (can be user-defined)

Type:str
brightness

The brightness value of the monitor (0-255)

Type:int
contrast

The contrast value of the monitor (0-255)

Type:int
saturation

The saturation value of the monitor (0-255)

Type:int
widescreen_sd

Aspect ratio setting for SD format. Choices can be: True (stretching enabled), False (pillar-box), or None (auto-detect).

identify

If set to True, the monitor’s border will be white for a brief duration to physically locate the device.

Type:bool
border

Sets the border of the monitor to the given color. Choices are: ‘red’, ‘green’, ‘blue’, ‘white’, or None.

Type:str
audio_channel

The audio channel pair (Embedded in the SDI input) used when scope_mode is set to audio monitoring. Values are from 0 to 7 (0 == Channels 1&2, etc).

Type:int
class vidhubcontrol.backends.base.VidhubBackendBase(**kwargs)[source]

Bases: vidhubcontrol.backends.base.BackendBase

Base class for Videohub devices

num_outputs

The number of outputs as reported by the switcher.

Type:int
num_inputs

The number of inputs as reported by the switcher.

Type:int
crosspoints

This represents the currently active routing of the switcher. Each element in the list represents an output (the zero-based index of the list) with its selected index as the value (also zero-based). This is a pydispatch.properties.ListProperty and can be observed using the bind() method.

Type:list
output_labels

A list containing the names of each output as reported by the switcher This is a pydispatch.properties.ListProperty and can be observed using the bind() method.

Type:list
input_labels

A list containing the names of each input as reported by the switcher This is a pydispatch.properties.ListProperty and can be observed using the bind() method.

Type:list
crosspoint_control

This is similar to crosspoints but if modified from outside code, the crosspoint changes will be set on the device (no method calls required). pydispatch.properties.ListProperty

Type:list
output_label_control

This is similar to :attr:~VidhubBackendBase.output_labels` but if modified from outside code, the label changes will be written to the device (no method calls required). pydispatch.properties.ListProperty

Type:list
input_label_control

This is similar to :attr:~VidhubBackendBase.input_labels` but if modified from outside code, the label changes will be written to the device (no method calls required). pydispatch.properties.ListProperty

Type:list
presets

The currently available (stored) list of Preset instances pydispatch.properties.ListProperty

Type:list
coroutine add_preset(name=None)[source]

Adds a new Preset instance

This method is used internally and should not normally be called outside of this module. Instead, see store_preset()

coroutine set_crosspoint(out_idx, in_idx)[source]

Set a single crosspoint on the switcher

Parameters:
  • out_idx (int) – The output to be set (zero-based)
  • in_idx (int) – The input to switch the output (out_idx) to (zero-based)
coroutine set_crosspoints(*args)[source]

Set multiple crosspoints in one method call

This is useful for setting many routing changes as it reduces the number of commands sent to the switcher.

Parameters:*args – Any number of output/input pairs to set. These should be given as tuples of (out_idx, in_idx) as defined in set_crosspoint(). They can be discontinuous and unordered.
coroutine set_input_label(in_idx, label)[source]

Set the label (name) of an input

Parameters:
  • in_idx (int) – The input to be set (zero-based)
  • label (str) – The label for the input
coroutine set_input_labels(*args)[source]

Set multiple input labels in one method call

This is useful for setting many labels as it reduces the number of commands sent to the switcher.

Parameters:*args – Any number of input/label pairs to set. These should be given as tuples of (in_idx, label) as defined in set_input_label(). They can be discontinuous and unordered.
coroutine set_output_label(out_idx, label)[source]

Set the label (name) of an output

Parameters:
  • out_idx (int) – The output to be set (zero-based)
  • label (str) – The label for the output
coroutine set_output_labels(*args)[source]

Set multiple output labels in one method call

This is useful for setting many labels as it reduces the number of commands sent to the switcher.

Parameters:*args – Any number of output/label pairs to set. These should be given as tuples of (out_idx, label) as defined in set_output_label(). They can be discontinuous and unordered.
coroutine store_preset(outputs_to_store=None, name=None, index=None, clear_current=True)[source]

Store the current switcher state to a Preset

Parameters:
  • outputs_to_store (optional) – An iterable of the output numbers (zero-based) that should be saved in the preset. If given, only these outputs will be recorded and when recalled, any output not in this argument will be unchanged. If not given or None, all outputs will be recorded.
  • name (optional) – The name to be given to the preset. If not provided or None the preset will be given a name based off of its index.
  • index (optional) – The index for the preset. If given and the preset exists in the presets list, that preset will be updated. If there is no preset found with the index, a new one will be created. If not given or None, the next available index will be used and a new preset will be created.
  • clear_current (bool) – If True, any previously existing data will be removed from the preset (if it exists). If False, the data (if existing) will be merged with the current switcher state. Default is True
Returns:

The Preset instance that was created or updated

This method is a coroutine

vidhubcontrol.backends.telnet module

class vidhubcontrol.backends.telnet.SmartScopeTelnetBackend(**kwargs)[source]

Bases: vidhubcontrol.backends.telnet.SmartViewTelnetBackendBase, vidhubcontrol.backends.base.SmartScopeBackendBase

class vidhubcontrol.backends.telnet.SmartViewTelnetBackend(**kwargs)[source]

Bases: vidhubcontrol.backends.telnet.SmartViewTelnetBackendBase, vidhubcontrol.backends.base.SmartViewBackendBase

class vidhubcontrol.backends.telnet.SmartViewTelnetBackendBase[source]

Bases: vidhubcontrol.backends.telnet.TelnetBackendBase

class vidhubcontrol.backends.telnet.TelnetBackend(**kwargs)[source]

Bases: vidhubcontrol.backends.telnet.TelnetBackendBase, vidhubcontrol.backends.base.VidhubBackendBase

Base class for backends implementing telnet

coroutine set_crosspoint(out_idx, in_idx)[source]

Set a single crosspoint on the switcher

Parameters:
  • out_idx (int) – The output to be set (zero-based)
  • in_idx (int) – The input to switch the output (out_idx) to (zero-based)
coroutine set_crosspoints(*args)[source]

Set multiple crosspoints in one method call

This is useful for setting many routing changes as it reduces the number of commands sent to the switcher.

Parameters:*args – Any number of output/input pairs to set. These should be given as tuples of (out_idx, in_idx) as defined in set_crosspoint(). They can be discontinuous and unordered.
coroutine set_input_label(in_idx, label)[source]

Set the label (name) of an input

Parameters:
  • in_idx (int) – The input to be set (zero-based)
  • label (str) – The label for the input
coroutine set_input_labels(*args)[source]

Set multiple input labels in one method call

This is useful for setting many labels as it reduces the number of commands sent to the switcher.

Parameters:*args – Any number of input/label pairs to set. These should be given as tuples of (in_idx, label) as defined in set_input_label(). They can be discontinuous and unordered.
coroutine set_output_label(out_idx, label)[source]

Set the label (name) of an output

Parameters:
  • out_idx (int) – The output to be set (zero-based)
  • label (str) – The label for the output
coroutine set_output_labels(*args)[source]

Set multiple output labels in one method call

This is useful for setting many labels as it reduces the number of commands sent to the switcher.

Parameters:*args – Any number of output/label pairs to set. These should be given as tuples of (out_idx, label) as defined in set_output_label(). They can be discontinuous and unordered.
class vidhubcontrol.backends.telnet.TelnetBackendBase[source]

Bases: object

Mix-in class for backends implementing telnet

hostaddr

IPv4 address of the device

Type:str
hostport

Port address of the device

Type:int
read_enabled

Internal flag to keep the read_loop() running

Type:bool
rx_bfr

Data received from the device to be parsed

Type:bytes
client

Instance of vidhubcontrol.aiotelnetlib._Telnet