def _find_wired_ports(self): """For systems with wired tools, gets the number of tools plugged in and sticks them in the tool descriptors list""" if not self._device: raise ValueError('find wired ports called with no NDI device') ndicapy.ndiCommand(self._device, 'PHSR:02') number_of_tools = ndicapy.ndiGetPHSRNumberOfHandles(self._device) while number_of_tools > 0: for ndi_tool_index in range(number_of_tools): port_handle = ndicapy.ndiGetPHSRHandle(self._device, ndi_tool_index) self._tool_descriptors.append({ "description": ndi_tool_index, "port handle": port_handle, "c_str port handle": int2byte(port_handle) }) ndicapy.ndiCommand(self._device, "PINIT:{0:02x}".format(port_handle)) ndicapy.ndiCommand(self._device, 'PHSR:02') number_of_tools = ndicapy.ndiGetPHSRNumberOfHandles(self._device)
def _enable_tools(self): if not self._device: raise ValueError('enable tools called with no NDI device') if not self._tracker_type == "dummy": ndicapy.ndiCommand(self._device, "PHSR:03") number_of_tools = ndicapy.ndiGetPHSRNumberOfHandles(self._device) for tool_index in range(number_of_tools): port_handle = ndicapy.ndiGetPHSRHandle(self._device, tool_index) port_handle_already_present = False for tool in self._tool_descriptors: if tool.get("port handle") == port_handle: port_handle_already_present = True break if not port_handle_already_present: self._tool_descriptors.append({ "description": tool_index, "port handle": port_handle, "c_str port handle": int2byte(port_handle) }) mode = 'D' ndicapy.ndiCommand(self._device, "PENA:{0:02x}{1}".format(port_handle, mode)) self._check_for_errors( 'Enabling port handle {}.'.format(port_handle))
def _read_sroms_from_file(self): if not self._device: raise ValueError('read srom called with no NDI device') if self._state == "tracking": self.stop_tracking() #free ports that are waiting to be freed ndicapy.ndiCommand(self._device, 'PHSR:01') number_of_tools = ndicapy.ndiGetPHSRNumberOfHandles(self._device) for tool_index in range(number_of_tools): port_handle = ndicapy.ndiGetPHRQHandle(self._device, tool_index) ndicapy.ndiCommand(self._device, "PHF:{0:02x}".format(port_handle)) self._check_for_errors( 'freeing port handle {0:02x}.'.format(tool_index)) for tool in self._tool_descriptors: ndicapy.ndiCommand(self._device, 'PHRQ:*********1****') port_handle = ndicapy.ndiGetPHRQHandle(self._device) tool.update({"port handle": port_handle}) if self._tracker_type == "aurora": tool.update({"c_str port handle": str(port_handle).encode()}) else: tool.update({"c_str port handle": int2byte(port_handle)}) self._check_for_errors( 'getting srom file port handle {}.'.format(port_handle)) ndicapy.ndiPVWRFromFile(self._device, port_handle, tool.get("description")) self._check_for_errors( 'setting srom file port handle {}.'.format(port_handle)) ndicapy.ndiCommand(self._device, 'PHSR:01')