Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _select_device_by_index_func(self, source):
self._cleanup_driver_func()
self.lock.acquire()
try:
self.ffi = FFI()
self.hdmi_in = HDMI('in', init_timeout=10)
self.hdmi_in.start()
# TODO: under development
if False and self._enable_output:
self.hdmi_out = HDMI('out', frame_list=self.hdmi_in.frame_list)
mode = self._select_output_mode(self.hdmi_in.frame_width(), self.hdmi_in.frame_height())
self.hdmi_out.mode(mode)
time.sleep(1)
if self.hdmi_out is not None:
self.hdmi_out.start()
self.hdmi_in_geom = \
(self.hdmi_in.frame_width(), self.hdmi_in.frame_height())
self.framebuffer = []
for i in range(video.VDMA_DICT['NUM_FSTORES']):
pointer = self.ffi.cast('uint8_t *', self.hdmi_in.frame_addr(i))
#buffer_size = video.MAX_FRAME_WIDTH * video.MAX_FRAME_HEIGHT * 3 # 3 == sizeof(RGB)
buffer_size = self.hdmi_in_geom[0] * self.hdmi_in_geom[1] * 3
def _select_device_by_index_func(self, source):
self._cleanup_driver_func()
self.lock.acquire()
try:
self.ffi = FFI()
self.hdmi_in = HDMI('in', init_timeout=10)
self.hdmi_in.start()
# TODO: under development
if False and self._enable_output:
self.hdmi_out = HDMI('out', frame_list=self.hdmi_in.frame_list)
mode = self._select_output_mode(self.hdmi_in.frame_width(), self.hdmi_in.frame_height())
self.hdmi_out.mode(mode)
time.sleep(1)
if self.hdmi_out is not None:
self.hdmi_out.start()
self.hdmi_in_geom = \
(self.hdmi_in.frame_width(), self.hdmi_in.frame_height())