forked from timvideos/gst-switch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
executable file
·53 lines (46 loc) · 1.49 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
# WARNING:
# THIS FILE IS ONLY FOR MY PERSONAL TESTING PURPOSES.
# IT IS NOT MADE TO AND SHOULD NOT BE TESTING THE ENTIRE API
from gstswitch.server import Server
from gstswitch.helpers import *
from gstswitch.controller import Controller
import time
# all executables (gst-launch-1.0, gst-switch-srv, gst-switch-ui, gst-switch-cap) at this path
# path = '/home/hyades/gst/master/gstreamer/tools/'
path = '/usr/local/bin/'
s = Server(path)
try:
s.run() # launches the server default parameters
port = s.video_port
# connects a gstreamer module to view the output of the gst-switch-srv
output = PreviewSinks()
output.run()
# adding two test video sources
sources = TestSources(port)
sources.new_test_video()
sources.new_test_video(timeoverlay=True)
# waiting till user ends the server
controller = Controller()
controller.establish_connection()
res = []
tests_get = [controller.get_compose_port,
controller.get_encode_port,
controller.get_audio_port,
controller.get_preview_ports,
]
test_set_composite_mode = controller.set_composite_mode
# testing random 10 modes
for x in tests_get:
print x()
time.sleep(1)
modes = [3, 2, 1, 0, 1, 2, 3, 0]
for mode in modes:
print 'composite mode=', mode
test_set_composite_mode(mode)
time.sleep(1)
sources.terminate()
s.terminate()
finally:
if s.proc:
s.kill()