Thor based player

This player can play Thor cameras using thorcam.

class cpl_media.thorcam.ThorCamPlayer(open_thread=True, **kwargs)

Bases: BasePlayer, object

Wrapper for Thor .Net camera based player.

_config_props_: Tuple[str] = ('supported_freqs', 'freq', 'supported_taps', 'taps', 'supports_color', 'exposure_range', 'exposure_ms', 'binning_x_range', 'binning_x', 'binning_y_range', 'binning_y', 'sensor_size', 'roi_x', 'roi_y', 'roi_width', 'roi_height', 'gain_range', 'gain', 'black_level_range', 'black_level', 'frame_queue_size', 'supported_triggers', 'trigger_type', 'trigger_count', 'num_queued_frames', 'color_gain', 'serial', 'serials')

A list of configurable property names of the class that is set/read by the configuration API.

Each sub/super-class can define this and the properties are accumulated across all the sub/super-classes.

binning_x

The x binning value to use.

binning_x_range

The supported exposure range.

binning_y

The y binning value to use.

binning_y_range

The supported exposure range.

black_level

The black level value to use.

black_level_range

The supported exposure range.

cam_state

The current state of the state machine of the camera.

Can be one of none, opening, open, closing.

close_camera()

closes the camera and also stops playing if we were playing.

color_gain

The color gain for each red, green, and blue channel.

exposure_ms

The exposure value in ms to use.

exposure_range

The supported exposure range in ms.

frame_queue_size

The max number of image frames to be allowed on the camera’s hardware queue. Once exceeded, the frames are dropped.

freq

The frequency to use.

gain

The gain value to use.

gain_range

The supported exposure range.

is_available

Whether thorcam is available to play.

num_queued_frames

The number of image frames currently on the camera’s hardware queue.

open_camera(serial)

Opens the camera so that we can play().

play()

Starts playing the video source and sets the play_state to starting.

May be called from main kivy thread only.

May only be called when play_state is none, otherwise an exception is raised.

Players need to eventually call complete_start() to finish starting playing.

play_thread_run()

The method that runs in the internal play thread.

process_in_kivy_thread(*largs)

Processes messages from the camera in the kivy thread.

refresh_cameras()

Refreshes the list of Thor cameras plugged in.

It updates serials when we have the new list.

roi_height

The height after the y start position of the ROI in pixels, to use.

roi_width

The width after the x start position of the ROI in pixels, to use.

roi_x

The x start position of the ROI in pixels.

roi_y

The y start position of the ROI in pixels.

sensor_size

The size of the sensor in pixels.

serial

The serial number of the camera that will be opened.

serials

The list of serial numbers representing the cameras available.

set_setting(name, value)

Requests that the setting should be changed for the camera.

Parameters
  • name – The setting name to be changed. E.g. "exposure_ms".

  • value – The new setting value.

stop(*largs, join=False)

Stops playing the video source, if it is playing and sets the play_state to stopping.

Players need to eventually call complete_stop() to finish stopping playing.

Parameters

join – whether to block the thread until the internal play thread has exited.

Returns

Whether we stopped playing (True) or were already stop(ping/ed) playing.

stop_all(join=False)

Causes all internal threads to stop and exit.

Parameters

join – Whether to wait and block the calling thread until the internal threads exit.

supported_freqs

The supported frequencies.

supported_taps

The supported taps.

supported_triggers

The trigger types supported by the camera.

supports_color

Whether the camera supports color.

taps

The tap to use.

to_kivy_queue = None

The queue that sends messages to be executed in the Kivy thread.

trigger_count

The number of frames to capture in response to the trigger.

trigger_type

The trigger type of the camera to use.

class cpl_media.thorcam.ThorCamSettingsWidget(player=None, **kwargs)

Bases: BoxLayout

Settings widget for ThorCamPlayer.

player: ThorCamPlayer = None

The player.