forked from timvideos/gst-switch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gstswitch.py
67 lines (58 loc) · 1.54 KB
/
gstswitch.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
54
55
56
57
58
59
60
61
62
63
64
65
66
# from controller import Controller
# from testsource import VideoSrc
from server import Server
import os
import sys
import signal
import subprocess
import random
#IMPORTS
class UI(object):
"""docstring for UI"""
def __init__(self):
"""Constructor for the UI Object.
Returns:
UI() object
Parameters:
None
"""
super(UI, self).__init__()
self.proc = None
self.proc = self.run()
if self.proc is None:
pass
def run(self):
"""Launches the UI process
"""
cmd = """gst-switch-ui \
"""
with open(os.devnull, 'w') as tempf:
process = subprocess.Popen(cmd.split(), stdout=tempf, stderr=tempf, bufsize=-1, shell=False)
#print "created process:", proc, proc.pid
return process
def end(self):
"""Stops the UI
Returns:
True on success
False on failure
Parameters:
None
"""
proc = self.proc
ret = True
try:
proc.terminate()
print "UI killed"
except:
ret = False
return ret
def connect_controller(self, Controller=None):
"""Connect the UI to the controller enabling all further method calls
Creates a Controller() and returns it if it does not exist
Returns:
Controller object on success
None on failure
Parameters:
Controller object(optional)
"""
pass