gst-switch

A replacement of DVSwitch based on gstreamer

Python - API:

gst-switch python API

gstswitch Package

Python API for gst-switch

connection Module

connection deals with all low level method calls over dbus The Connection object is capable of invoking remote methods over dbus

class gstswitch.connection.Connection(address='unix:abstract=gstswitch', bus_name='info.duzy.gst.switch.SwitchController', object_path='/info/duzy/gst/switch/SwitchController', default_interface='info.duzy.gst.switch.SwitchControllerInterface')[source]

Bases: object

Class which makes all remote object class. Deals with lower level connection and remote method invoking

Default bus-address:
 unix:abstract=gstswitch
Param:None
CONNECTION_FLAGS = 1
address[source]

Get the address

adjust_pip(xpos, ypos, width, height)[source]
adjust_pip(in i dx,
in i dy, in i dw, in i dh, out u result);

Calls adjust_pip remotely

Parameters:
  • xpos – the X position of the PIP
  • ypos – the Y position of the PIP
  • width – the width of the PIP
  • height – the height of the PIP
Returns:

tuple with first element as result -

PIP has been changed succefully

bus_name[source]

Get the bus name

click_video(xpos, ypos, width, height)[source]
click_video(in i x,
in i y, in i fw, in i fh, out b result);

Calls click_video remotely

Parameters:
  • xpos
  • ypos
  • width
  • height
Returns:

tuple with first element True if requested

connect_dbus()[source]

Make a new connection using the parameters belonging to the class to the gst-switch-srv over dbus. Sets the self.connection

Params:None
Returns:Nothing
Raises ConnectionError:
 GError occurs while making a connection
default_interface[source]

Get the default interface

get_audio_port()[source]

get_audio_port(out i port); Calls get_audio_port remotely

Param:None
Returns:tuple wit first element audio port number
get_compose_port()[source]

get_compose_port(out i port); Calls get_compose_port remotely

Param:None
Returns:tuple with first element compose port number
get_encode_port()[source]

get_encode_port(out i port); Calls get_encode_port remotely

Param:None
Returns:tuple with first element encode port number
get_preview_ports()[source]

get_preview_ports(out s ports); Calls get_preview_ports remotely

Param:None
Returns:tuple with first element a string in the form of

‘[(3002, 1, 7), (3003, 1, 8)]’

mark_face(faces)[source]

mark_face(in a(iiii) faces); Calls mark_face remotely

Parameters:faces – tuple having four elements
Returns:tuple with first element True if requested
mark_tracking(faces)[source]

mark_tracking(in a(iiii) faces); Calls mark_tracking remotely

Parameters:faces – tuple having four elements
Returns:tuple with first element True if requested
new_record()[source]

new_record(out b result); Calls new_record remotely

Param:None:

returns: tuple with first element True if requested

object_path[source]

Get the object path

set_composite_mode(mode)[source]
set_composite_mode(in i channel,
out b result);

Calls set_composite_mode remotely

Parameters:mode – new composite mode
Returns:tuple with first element True if requested
set_encode_mode(channel)[source]
set_encode_mode(in i channel,
out b result);

Calls set_encode_mode remotely Does not do anything

Param:channel
Returns:tuple with first element True if requested
switch(channel, port)[source]
switch(in i channel,
in i port, out b result);

Calls switch remotely

Parameters:
  • channel – The channel to be switched, ‘A’, ‘B’, ‘a’
  • port – The target port number
Returns:

tuple with first element True if requested

controller Module

The controller is the interface for all remote method calls over dbus. The Controller class creates the controller, which can be used to invoke the remote methods.

class gstswitch.controller.Controller(address='unix:abstract=gstswitch', bus_name='info.duzy.gst.switch.SwitchController', object_path='/info/duzy/gst/switch/SwitchController', default_interface='info.duzy.gst.switch.SwitchControllerInterface')[source]

Bases: object

A Class to control all interactions with the gst-switch-srv over dbus. Provides the interface for higher level interactions

Param:None
address[source]

Get the address

adjust_pip(xpos, ypos, width, height)[source]

Change the PIP position and size

Parameters:
  • xpos – the x position of the PIP
  • ypos – the y position of the PIP
  • width – the width of the PIP
  • height – the height of the PIP
Returns:

result - PIP has been changed succefully

bus_name[source]

Get the bus name

click_video(xpos, ypos, width, height)[source]

User click on the video

Parameters:
  • xpos
  • ypos
  • width
  • height
Returns:

True when requested

default_interface[source]

Get the default interface

establish_connection()[source]

Establishes a fresh connection to the dbus Connection stored as self.connection

Param:None
Returns:None
get_audio_port()[source]

Get the audio port number

Param:None
Returns:audio port number
get_compose_port()[source]

Get the compose port number

Param:None
Returns:compose port number
get_encode_port()[source]

Get the encode port number

Param:None
Returns:encode port number
get_preview_ports()[source]

Get all the preview ports

Param:None
Returns:list of all preview ports
mark_face(faces)[source]

Mark faces

Parameters:faces – tuple having four elements
Returns:True when requested
mark_tracking(faces)[source]

Mark tracking

Parameters:faces – tuple having four elements
Returns:True when requested
new_record()[source]

Start a new recording

Param:None
object_path[source]

Get the object path

classmethod parse_preview_ports(res)[source]

Parses the preview_ports string

set_composite_mode(mode)[source]

Set the current composite mode. Modes between 0 and 3 are allowed.

Parameters:mode – new composite mode
Returns:True when requested
set_encode_mode(channel)[source]

Set the encode mode WARNING: THIS DOES NOT WORK.

Param:channel
Returns:True when requested
switch(channel, port)[source]

Switch the channel to the target port

Parameters:
  • channel – The channel to be switched, ‘A’, ‘B’, ‘a’
  • port – The target port number
Returns:

True when requested

exception Module

All custom exceptions come here

exception gstswitch.exception.BaseError[source]

Bases: exceptions.Exception

docstring for BaseError

exception gstswitch.exception.PathError[source]

Bases: gstswitch.exception.BaseError

docstring for PathError

exception gstswitch.exception.ServerProcessError[source]

Bases: gstswitch.exception.BaseError

docstring for ServerProcessError

exception gstswitch.exception.ConnectionError[source]

Bases: gstswitch.exception.BaseError

docstring for ConnectionError

exception gstswitch.exception.ConnectionReturnError[source]

Bases: gstswitch.exception.BaseError

docstring for ConnectionReturnError

exception gstswitch.exception.RangeError[source]

Bases: gstswitch.exception.BaseError

docstring for RangeError

exception gstswitch.exception.InvalidIndexError[source]

Bases: gstswitch.exception.BaseError

docstring for InvalidIndexError

helpers Module

Has helper classes which create test video and audio sources. It is also possible to create a preview out source showing the compose port output.

class gstswitch.helpers.TestSources(video_port=None, audio_port=None)[source]

Bases: object

A Controller of test sources feeding into the gst-switch-srv :param width: The width of the output video :param height: The height of the output video :param pattern: The videotestsrc pattern of the output video :param timeoverlay: True to enable a running time over video :param clockoverlay: True to enable current clock time over video

audio_port[source]

Get the audio port

get_test_audio()[source]

Returns a list of processes acting as audio test sources running :returns: A list containing all audio test sources running

get_test_video()[source]

Returns a list of processes acting as video test sources running :returns: A list containing all video test sources running

new_test_audio(freq=110, wave=None)[source]

Start a new test audio :param port: The port of where the TCP stream will be sent Should be same as audio port of gst-switch-src :param width: The width of the output audio :param height: The height of the output audio :param pattern: The audiotestsrc pattern of the output audio :param timeoverlay: True to enable a running time over audio :param clockoverlay: True to enable current clock time over audio

new_test_video(width=300, height=200, pattern=None, timeoverlay=False, clockoverlay=False)[source]

Start a new test video :param port: The port of where the TCP stream will be sent Should be same as video port of gst-switch-src :param width: The width of the output video :param height: The height of the output video :param pattern: The videotestsrc pattern of the output video :param timeoverlay: True to enable a running time over video :param clockoverlay: True to enable current clock time over video

running_tests_audio[source]

Get the currently running test audio list

running_tests_video[source]

Get the currently running test video list

terminate_audio()[source]

Terminate all test audio sources

terminate_index_audio(index)[source]

Terminate audio test source specified by index :param index: The index of the audio source to terminate Use get_test_audio for finding the index

terminate_index_video(index)[source]

Terminate video test source specified by index :param index: The index of the video source to terminate Use get_test_video for finding the index

terminate_video()[source]

Terminate all test video sources

video_port[source]

Get the video port

class gstswitch.helpers.PreviewSinks(preview_port=3001)[source]

Bases: object

A Controller for preview sinks to preview ports of gst-switch-srv :param preview_port: The preview port to get the preview

preview_port[source]

Get the preview port

run()[source]

Run the Preview Sink

terminate()[source]

End/Terminate the Preview Sink

server Module

The server deals with all operations controlling gst-switch-srv These include all OS related tasks

class gstswitch.server.Server(path=None, video_port=3000, audio_port=4000, control_port=5000, record_file=False)[source]

Bases: object

Control all server related operations

Parameters:path – Path where the executable gst-switch-srv

is located. Provide the full path. By default looks in the current $PATH. :param video_port: The video port number - default = 3000 :param audio_port: The audio port number - default = 4000 :param control_port: The control port number - default = 5000 :param record_file: The record file format :returns: nothing

SLEEP_TIME = 0.5
audio_port[source]

Get the audio port

control_port[source]

Get the control port

gcov_flush()[source]

Generate gcov coverage by sending the signal SIGUSR1 The generated gcda files are dumped in tools directory. Does not kill the process

Param:

None

Returns:

True when success

Raises:
  • ServerProcessError – If Server is not running
  • ServerProcessError – Unable to send signal
kill(cov=False)[source]

Kill the server process by sending signal.SIGKILL self.proc is made None on success

Param:

None

Returns:

True when success

Raises:
  • ServerProcessError – Process does not exist
  • ServerProcessError – Cannot kill process
classmethod make_coverage()[source]

Generate coverage Calls ‘make coverage’ to generate coverage in .gcov files

path[source]

Get the path

record_file[source]

Get the record file

run(gst_option='')[source]

Launch the server process

Param:None
Gst-option:Any gstreamer option.

Refer to http://www.linuxmanpages.com/man1/gst-launch-0.8.1.php#lbAF. Multiple can be added separated by spaces :returns: nothing :raises IOError: Fail to open /dev/null (os.devnull) :raises PathError: Unable to find gst-switch-srv at path specified :raises ServerProcessError: Running gst-switch-srv gives a OS based error.

terminate(cov=False)[source]

Terminate the server. self.proc is made None on success

Param:

None

Returns:

True when success

Raises:
  • ServerProcessError – Process does not exist
  • ServerProcessError – Cannot terminate process. Try killing it
video_port[source]

Get the video port

testsource Module

The testsource contains all gstreamer pipelines It provides the abse for all the other gstreamer components are build upon.

class gstswitch.testsource.Preview(port)[source]

Bases: object

A Preview Element :param port: The preview port

end()[source]

End/disable the pipeline

pause()[source]

Pause the pipeline

preview_port[source]

Get the Preview Port

run()[source]

Run the pipeline

class gstswitch.testsource.VideoSrc(port, width=300, height=200, pattern=None, timeoverlay=False, clockoverlay=False)[source]

Bases: object

A Test Video Source :param width: The width of the output video :param height: The height of the output video :param pattern: The videotestsrc pattern of the output video None for random :param timeoverlay: True to enable a running time over video :param clockoverlay: True to enable current clock time over video

HOST = 'localhost'
clockoverlay[source]

Get the Clockoverlay

end()[source]

End/disable the pipeline

classmethod generate_pattern(pattern)[source]

Generate a random pattern if not specified

height[source]

Get the height

pattern[source]

Get the Pattern

pause()[source]

End the pipeline

port[source]

Get the Video Port

run()[source]

Run the pipeline

timeoverlay[source]

Get the timeoverlay

width[source]

Get the width

class gstswitch.testsource.AudioSrc(port, freq=110, wave=None)[source]

Bases: object

docstring for AudioSrc

HOST = 'localhost'
end()[source]

End/disable the pipeline

freq[source]

Get the Frequency

classmethod generate_wave(wave)[source]

Generate a random wave if not specified

pause()[source]

End the pipeline

port[source]

Get the Audio Port

run()[source]

Run the pipeline

wave[source]

Get the wave number

Tests:

Unittest for Python-API

unittests Package

Unittests for gst-switch Python-API

test_connection_unit Module

Unittests for Connection class in connection.py

class unittests.test_connection_unit.MockConnection(method)[source]

Bases: object

A class which mocks the Connection class

call_sync(bus_name, object_path, interface_name, method_name, parameters, reply_type, flags, timeout_msec, cancellable)[source]

Mock of call_sync method, raises GLib.GError if interface_name invalid

funs = {'mark_tracking': None, 'get_audio_port': (4000,), 'click_video': (True,), 'adjust_pip': (1,), 'set_encode_mode': (False,), 'get_compose_port': (3001,), 'set_composite_mode': (False,), 'switch': (True,), 'mark_face': None, 'get_encode_port': (3002,), 'new_record': (False,), 'get_preview_ports': ('[(3002, 1, 7), (3003, 1, 8)]',)}
class unittests.test_connection_unit.TestAddress[source]

Bases: object

Unittests for address parameter

test_address_colon()[source]

Test if address has no colon

test_address_normal()[source]

“Test if address is valid

test_address_null()[source]

Test if address is null

class unittests.test_connection_unit.TestBusName[source]

Bases: object

Unittests for bus_name parameter

test_normal()[source]

Test if bus_name is not null

test_normal_none()[source]

Test if bus_name is null

class unittests.test_connection_unit.TestConnectDBus[source]

Bases: object

Unittests for the connect_dbus method of Connection class

test_bad_address()[source]

Test if wrong address is given - 1

test_bad_address2()[source]

Test if wrong address is given - 2

test_bad_address3()[source]

Test if wrong address is given - 3

test_mock1(monkeypatch)[source]

Test GLib.GError exception

test_mock2(monkeypatch)[source]

Test GLib.GError exception

class unittests.test_connection_unit.TestInterface[source]

Bases: object

Unittests for default_interface parameter

test_interface_dot()[source]

Test when the default_interface has <2 dots

test_interface_none()[source]

Test if default_interface is null

test_interface_normal()[source]

Test if default_interface is valid

class unittests.test_connection_unit.TestObjectPath[source]

Bases: object

Unittests for object_path parameter

test_object_path_blank()[source]

Test if object_path is null

test_object_path_normal()[source]

Test of object_path is valid

test_object_path_slash()[source]

Test when object_path doesn’t have slash in start

unittests.test_connection_unit.test_adjust_pip()[source]

Test the adjust_pip method

unittests.test_connection_unit.test_click_video()[source]

Test the click_video method

unittests.test_connection_unit.test_get_audio_port()[source]

Test the get_audio_port method

unittests.test_connection_unit.test_get_compose_port()[source]

Test the get_compose_port method

unittests.test_connection_unit.test_get_encode_port()[source]

Test the get_encode_port method

unittests.test_connection_unit.test_get_preview_ports()[source]

Test the get_preview_ports method

unittests.test_connection_unit.test_mark_face()[source]

Test the mark_face method

unittests.test_connection_unit.test_mark_tracking()[source]

Test the mark_tracking method

unittests.test_connection_unit.test_new_record()[source]

Test the new_record method

unittests.test_connection_unit.test_set_composite_mode()[source]

Test the set_composite_mode method

unittests.test_connection_unit.test_set_encode_mode()[source]

Test the set_encode_mode method

unittests.test_connection_unit.test_switch()[source]

Test the switch method

test_controller_unit Module

Unittests for Controller class in controller.py

class unittests.test_controller_unit.MockConnection(mode)[source]

Bases: object

A class which mocks the Connection class

adjust_pip(xpos, ypos, width, height)[source]

mock of adjust_pip

click_video(xpos, ypos, width, height)[source]

mock of click_video

get_audio_port()[source]

mock of get_audio_port

get_compose_port()[source]

mock of get_compose_port

get_encode_port()[source]

mock of get_encode_port

get_preview_ports()[source]

mock of get_preview_ports

mark_face(face)[source]

mock of mark_face

mark_tracking(face)[source]

mock of mark_tracking

new_record()[source]

mock of new_record

set_composite_mode(mode)[source]

mock of set_composite_mode

set_encode_mode(mode)[source]

mock of get_set_encode_mode

switch(channel, port)[source]

mock of switch

class unittests.test_controller_unit.TestAddress[source]

Bases: object

Test the address parameter

test_address_colon()[source]

Test if address has no colon

test_address_normal()[source]

Test if address is valid

test_address_null()[source]

Test if address is null

class unittests.test_controller_unit.TestAdjustPIP[source]

Bases: object

Test the adjust_pip method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestBusName[source]

Bases: object

Test bus_name parameter

test_normal()[source]

Test when bus_name is not null

test_normal_none()[source]

Test when bus_name is null

class unittests.test_controller_unit.TestClickVideo[source]

Bases: object

Test the click_video method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestEstablishConnection[source]

Bases: object

Test the establish_connection method

test_normal(monkeypatch)[source]

Test if the parameters are valid

class unittests.test_controller_unit.TestGetAudioPort[source]

Bases: object

Test the get_audio_port method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestGetComposePort[source]

Bases: object

Test the get_compose_port method

test_normal_unpack()[source]

Test when valid

test_unpack()[source]

Test when values cant unpack

class unittests.test_controller_unit.TestGetEncodePort[source]

Bases: object

Test the get_encode_port method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestGetPreviewPorts[source]

Bases: object

Test the get_preview_ports method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestInterface[source]

Bases: object

Test the default_interface parameter

test_interface_dot()[source]

Test when the default_interface has <2 dots

test_interface_none()[source]

Test when the default_interface is null

test_interface_normal()[source]

Test when the interface is valid

class unittests.test_controller_unit.TestMarkFaces[source]

Bases: object

Tes the mark_face method

test_normal()[source]

Test if valid

class unittests.test_controller_unit.TestMarkTracking[source]

Bases: object

Test the mark_tracking method

test_normal()[source]

Test if valid

class unittests.test_controller_unit.TestNewRecord[source]

Bases: object

Test the new_record method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestObjectPath[source]

Bases: object

Test object_path parameter

test_object_path_blank()[source]

Test when the object_path is null

test_object_path_normal()[source]

Test when object_path is valid

test_object_path_slash()[source]

Test when object_path doesn’t have slash in start

class unittests.test_controller_unit.TestParsePreviewPorts[source]

Bases: object

Test the parse_preview_ports class method

test_normal()[source]

Test if valid

test_syntax_error()[source]

Test if syntax error detected

test_value_error()[source]

Test if invalid

class unittests.test_controller_unit.TestSetCompositeMode[source]

Bases: object

Test the set_composite_mode method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestSetEncodeMode[source]

Bases: object

Test the set_encode_mode method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

class unittests.test_controller_unit.TestSwitch[source]

Bases: object

Test the switch method

test_normal_unpack()[source]

Test if valid

test_unpack()[source]

Test if unpack fails

test_helpers_unit Module

Unittests for helper.py

class unittests.test_helpers_unit.TestPreviewSinks[source]

Bases: object

Test Preview Sinks

class MockPreview(preview_port=3001)[source]

Bases: object

A mock preview class

end()[source]

End the preview

run()[source]

Run the preview

TestPreviewSinks.test_run(monkeypatch)[source]

Test running preview

TestPreviewSinks.test_terminate_fail()[source]

Test terminating a preview when none exists

TestPreviewSinks.test_terminate_normal(monkeypatch)[source]

Test terminating a preview when valid exists

class unittests.test_helpers_unit.TestPreviewSinksPreviewPort[source]

Bases: object

Test preview_port parameter

test_blank()[source]

Test when preview_port is blank

test_invalid()[source]

Test when preview_port is not a integral value

test_normal()[source]

Test when preview_port is valid

test_range()[source]

Test when preview_port is out of range

class unittests.test_helpers_unit.TestTestSources[source]

Bases: object

Test for testsources

class MockAudioSrc(port, freq=110, wave=None)[source]

Bases: object

A Mock audio source

run()[source]

Run the source

class TestTestSources.MockTest(pattern)[source]

Bases: object

A mock test

end()[source]

End the test

class TestTestSources.MockTest2(wave)[source]

Bases: object

A mock audio source

end()[source]

End the source

class TestTestSources.MockVideoSrc(port, width=300, height=200, pattern=None, timeoverlay=False, clockoverlay=False)[source]

Bases: object

A mock video source

run()[source]

Run the mock video source

TestTestSources.test_get_test_audio()[source]

Test get_test_audio

TestTestSources.test_get_test_video()[source]

Test for get_test_video

TestTestSources.test_new_test_audio(monkeypatch)[source]

Test new_test_audio

TestTestSources.test_new_test_video(monkeypatch)[source]

Test for new_test_video

TestTestSources.test_terminate1_audio()[source]

Test terminate_audio multiple

TestTestSources.test_terminate1_video()[source]

Test terminate_video multiple

TestTestSources.test_terminate2_audio()[source]

Test terminate_audio none present

TestTestSources.test_terminate2_video()[source]

Test terminate_video none present

TestTestSources.test_terminate_index_error_audio()[source]

Test terminate_index_audio - invalid index

TestTestSources.test_terminate_index_error_video()[source]

Test for terminate_video

TestTestSources.test_terminate_index_normal_audio()[source]

Test terminate_index_audio valid index

TestTestSources.test_terminate_index_normal_video()[source]

Test terminate_index_video

class unittests.test_helpers_unit.TestTestSourcesAudioPort[source]

Bases: object

Test for audio_port parameter

test_invalid()[source]

Test when not integral value

test_normal()[source]

Test when valid

test_range()[source]

Test when out of range

class unittests.test_helpers_unit.TestTestSourcesVideoPort[source]

Bases: object

Test for video_port parameter

test_invalid()[source]

Test when not integral value

test_normal()[source]

Test when valid

test_range()[source]

Test when out of range

test_server_unit Module

Unittests for Server class in server.py

class unittests.test_server_unit.MockPopen(cmd, bufsize, shell)[source]

Bases: object

Mock Popen method

communicate()[source]

Mock communicate method of Popen

class unittests.test_server_unit.MockProcess(mode=True)[source]

Bases: object

A mock process

kill()[source]

Kill the mock process

make_coverage()[source]

Dump coverage

terminate()[source]

Terminate the mock process

class unittests.test_server_unit.TestAudioPort[source]

Bases: object

Test for audio_port parameter

test_invalid_audio_port_null()[source]

Test when the audio_port is null

test_invalid_audio_port_range()[source]

Test when the audio port is not in range

test_invalid_audio_port_type()[source]

Test when the audio port given is not a valid integral value

class unittests.test_server_unit.TestControlPort[source]

Bases: object

Test the control_port parameter

test_invalid_control_port_null()[source]

Test when the control port is null

test_invalid_control_port_range()[source]

Test when the control port is not in range

test_invalid_control_port_type()[source]

Test when the control port is not a valid integral value

class unittests.test_server_unit.TestKillTerminate[source]

Bases: object

Test kill, terminate and gcov_flush methods

test_gcov_flush_fail()[source]

Test when gcov_flush fails

test_kill_fail()[source]

Test when kill fails

test_no_process_gov_flush()[source]

Test when no process exists and gcov_flush is called

test_no_process_kill()[source]

Test when no process exists and kill is called

test_no_process_terminate()[source]

Test when no process exists and terminate is called

test_terminate_fail()[source]

Test when terminate fails

class unittests.test_server_unit.TestNormal[source]

Bases: object

Test the functioning of tests under valid conditions

test_kill(monkeypatch)[source]

Test kill ServerProcessError

test_kill_cov(monkeypatch)[source]

Test kill and gcov_flush ServerProcessError

test_make_coverage(monkeypatch)[source]

Test dumping coverage

test_normal_gcov_flush(monkeypatch)[source]

Test gcov_flush

test_normal_kill(monkeypatch)[source]

Test kill when normally called

test_normal_terminate()[source]

Test terminal when normally called

test_terminate()[source]

Test terminate ServerProcessError

test_terminate_cov()[source]

Test terminate and gcov_flush ServerProcessError

class unittests.test_server_unit.TestPath[source]

Bases: object

Test the path parameter

test_path_empty(monkeypatch)[source]

Test if null path is given

test_path_provided_no_slash()[source]

Test if a path is provided

test_path_provided_slash()[source]

Test if a path is provided

class unittests.test_server_unit.TestRecordFile[source]

Bases: object

Test the record_file parameter

test_record_file_false()[source]

Test if record file is False

test_record_file_invalid()[source]

Test when the record_file is invalid

test_record_file_slashes()[source]

Test when the record_file has forward slashes

test_record_file_true()[source]

Test if record file is True

test_record_file_valid()[source]

Test if record file is valid

test_record_file_valid_date()[source]

Test if record file is valid

test_record_file_valid_space()[source]

Test if record file is valid and has a space

class unittests.test_server_unit.TestRun[source]

Bases: object

Test running the server

test_run()[source]

Test the run method

test_run_process()[source]

Test _run_process method

test_start_process_error(monkeypatch)[source]

Test _start_process method

test_start_process_normal(monkeypatch)[source]

Test _start_process normally

class unittests.test_server_unit.TestVideoPort[source]

Bases: object

Test for video_port parameter

test_invalid_video_port_null()[source]

Test when the video_port is null

test_invalid_video_port_range()[source]

Test when the video port is not in range

test_invalid_video_port_type()[source]

Test when the video port given is not a valid integral value

test_testsource_unit Module

Unitests for testsource.py

class unittests.test_testsource_unit.MockPipeline[source]

Bases: object

Mock Pipeline

disable()[source]

Disable the pipeline

pause()[source]

Pause the pipeline

play()[source]

Play the pipeline

class unittests.test_testsource_unit.TestAudioSrcFreq[source]

Bases: object

Test frequency parameter

test_blank()[source]

Test when frequency is null

test_invalid()[source]

Test when frequency is not a valid integral value

test_normal()[source]

Test when frequency is valid

test_range()[source]

Test when frequency is not in range (negative)

class unittests.test_testsource_unit.TestAudioSrcPlay[source]

Bases: object

Test Audio Source options - play, pause, end

test_end()[source]

End the audio source

test_pause()[source]

Pause the audio source

test_run()[source]

Run the audio source

class unittests.test_testsource_unit.TestAudioSrcPort[source]

Bases: object

Test port parameter

test_blank()[source]

Test when port is null

test_invalid()[source]

Test when port is not a valid integral value

test_normal()[source]

Test when port is valid

test_range()[source]

Test when port is not in range

class unittests.test_testsource_unit.TestAudioSrcWave[source]

Bases: object

Test wave parameter

test_invalid()[source]

Test when wave is not a valid integral value

test_normal()[source]

Test when wave is valid

test_range()[source]

Test when wave is not in range

class unittests.test_testsource_unit.TestBasePipeline[source]

Bases: object

Test Base Pipeline

test_disable(monkeypatch)[source]

Test disable method

test_pause(monkeypatch)[source]

Test pause method

test_play(monkeypatch)[source]

Test play method

class unittests.test_testsource_unit.TestPreviewPlay[source]

Bases: object

Test preview options - play, pause, end

test_end()[source]

Test end method

test_pause()[source]

Test pause method

test_run()[source]

Test play method

class unittests.test_testsource_unit.TestPreviewPort[source]

Bases: object

Test port parameter

test_blank()[source]

Test when port is null

test_invalid()[source]

Test when port is not a valid integral value

test_normal()[source]

Test when port is valid

test_range()[source]

Test when port is not in range

class unittests.test_testsource_unit.TestVideoPipeline[source]

Bases: object

Test VideoPipeline

test_permuate_time_clock_1()[source]

Test when timeoverlay False and clockoverlay False

test_permuate_time_clock_2()[source]

test when timeoverlay False and clockoverlay True

test_permuate_time_clock_3()[source]

Test when timeoverlay True and clockoverlay False

test_permuate_time_clock_4()[source]

Test when timeoverlay True and clockoverlay True

class unittests.test_testsource_unit.TestVideoSrcClockOverlay[source]

Bases: object

Test clockoverlay pattern

test_fail()[source]

Test when clockoverlay is not boolean/valid

test_normal()[source]

Test when clockoverlay is valid

class unittests.test_testsource_unit.TestVideoSrcHeight[source]

Bases: object

Test for height parameter

test_blank()[source]

Test when the height is a null

test_invalid()[source]

Test when height is not a valid float value

test_non_positive()[source]

Test when heightis non-positive

test_normal()[source]

Test when height is valid

class unittests.test_testsource_unit.TestVideoSrcPattern[source]

Bases: object

Test the pattern parameter

test_invalid()[source]

Test when pattern is not a valid integer

test_normal()[source]

Test when pattern is valid

test_range()[source]

Test when pattern is not in range

class unittests.test_testsource_unit.TestVideoSrcPlay[source]

Bases: object

Test Video Source options - play, pause, disable

test_end()[source]

Test end method

test_pause()[source]

Test pause method

test_run()[source]

Test run method

class unittests.test_testsource_unit.TestVideoSrcPort[source]

Bases: object

Test the port parameter

test_blank()[source]

Test when the port is null

test_invalid()[source]

Test when the port is not a valid integral value

test_normal()[source]

Test when port is a valid value

test_range()[source]

Test when the port is not in range

class unittests.test_testsource_unit.TestVideoSrcTimeOverlay[source]

Bases: object

Test timeoverlay parameter

test_fail()[source]

Test when timeoverlay is not boolean/valid

test_normal()[source]

Test when timeoverlay is valid

class unittests.test_testsource_unit.TestVideoSrcWidth[source]

Bases: object

Test the width parameter

test_blank()[source]

Test when the width is null

test_invalid()[source]

Test when the width is not a valid float value

test_non_positive()[source]

Test when the width is non-positive

test_normal()[source]

Test when the width is valid

Integration Tests for gstswitch and Python-API

integrationtests Package

Integration tests for gst-switch and Python API

compare Module

generate_reference_frames Module

test_controller Module

test_helpers Module

Integartion tests for TestSources, PreviewSinks in helpers.py

class integrationtests.test_helpers.TestTestSourcesPreviews[source]

Bases: object

Test for TestSources and PreviewSinks

NUM = 1
add_audio_sources(num, audio_port)[source]

Add audio sources

add_video_sources(num, video_port)[source]

Add a video source

test_audio_sources()[source]

Test audio sources

test_video_sources()[source]

Test video sources

test_server Module

Integration tests for Server in server.py

class integrationtests.test_server.TestServerStartStop[source]

Bases: object

Test Starting and Stopping the Server Run Server and Stop multiple times

NUM = 5
startstop()[source]

Start and Stop the Server

test_start_stop()[source]

Test Start and Stop the Server

Indices and tables