MCPcopy Create free account
hub / github.com/ARM-software/AVH / VideoClient

Class VideoClient

interface/video/python/vsi_video.py:36–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34logger = logging.getLogger(__name__)
35
36class VideoClient:
37 def __init__(self):
38 # Server commands
39 self.SET_FILENAME = 1
40 self.STREAM_CONFIGURE = 2
41 self.STREAM_ENABLE = 3
42 self.STREAM_DISABLE = 4
43 self.FRAME_READ = 5
44 self.FRAME_WRITE = 6
45 self.CLOSE_SERVER = 7
46 # Color space
47 self.GRAYSCALE8 = 1
48 self.RGB888 = 2
49 self.BGR565 = 3
50 self.YUV420 = 4
51 self.NV12 = 5
52 self.NV21 = 6
53 # Variables
54 self.conn = None
55
56 def connectToServer(self, address, authkey):
57 for _ in range(50):
58 try:
59 self.conn = Client(address, authkey=authkey.encode('utf-8'))
60 if isinstance(self.conn, Connection):
61 break
62 else:
63 self.conn = None
64 except Exception:
65 self.conn = None
66 time.sleep(0.01)
67
68 def setFilename(self, filename, mode):
69 self.conn.send([self.SET_FILENAME, getcwd(), filename, mode])
70 filename_valid = self.conn.recv()
71
72 return filename_valid
73
74 def configureStream(self, frame_width, frame_height, color_format, frame_rate):
75 self.conn.send([self.STREAM_CONFIGURE, frame_width, frame_height, color_format, frame_rate])
76 configuration_valid = self.conn.recv()
77
78 return configuration_valid
79
80 def enableStream(self, mode):
81 self.conn.send([self.STREAM_ENABLE, mode])
82 stream_active = self.conn.recv()
83
84 return stream_active
85
86 def disableStream(self):
87 self.conn.send([self.STREAM_DISABLE])
88 stream_active = self.conn.recv()
89
90 return stream_active
91
92 def readFrame(self):
93 self.conn.send([self.FRAME_READ])

Callers 1

vsi_video.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected