code: def setDevice(self, device): 
          
          self.report("setDevice :", device)
          
          if (self.mvision_process == None):
              return
          
          if (not device and not self.device): # None can be passed as an argument when the device has not been set yet
              return
              
          if (self.device):
              if self.device == device:
                  self.report("setDevice : same device")
                  return
              
          if self.filterchain: # there's video already
              self.clearDevice()
          
          self.device = device
          self.video.setDevice(self.device) # inform the video widget so it can start drags
          
          # ManagedFilterChain.addViewPort accepts ViewPort instance
          self.filterchain = self.filterchain_group.get(_id = self.device._id)
          
          if self.filterchain:
              self.viewport.setXScreenNum(self.n_xscreen)
              self.viewport.setWindowId  (int(self.video.winId()))
              self.filterchain.addViewPort(self.viewport)
              
              # now the shared mem / semaphore part :
              self.shmem_name = self.filterchain.getShmem()
              print(self.pre, "setDevice : got shmem name", self.shmem_name)
              
              self.mvision_widget = self.mvision_process.getWidget()
              self.mvision_widget.setParent(self.main_widget)
              self.main_layout.addWidget(self.mvision_widget)
              
              self.mvision_process.activate(
                  n_buffer         = constant.shmem_n_buffer,
                  image_dimensions = constant.shmem_image_dimensions,
                  shmem_name       = self.shmem_name
                  )
                  
              self.thread.addProcess(self.mvision_process)
              
              # is there a signal giving the bounding boxes..?  let's connect it
              if hasattr(self.mvision_process.signals,"bboxes"):
                  print(self.pre, "setDevice : connecting bboxes signal")
                  self.mvision_process.signals.bboxes.connect(self.set_bounding_boxes_slot)
docs: Sets the video stream
          
          :param device:      A rather generic device class.  In this case DataModel.RTSPCameraDevice.