Exemplo n.º 1
0
 def close(self):
     """
     close video
     """
     ret = libatlas.CloseVideo(self._channel_id)
     if ret != SUCCESS:
         acl_logger.log_info("ERROR:Close %s failed" % (self._name))
Exemplo n.º 2
0
    def read(self):
        frame = ImageDataC()
        image = None
        ret = libatlas.ReadDecodedFrame(self._channel_id, byref(frame))
        if ret == READ_VIDEO_OK:
            image = AclImage(addressof(frame.data.contents), frame.width,
                             frame.height, frame.size, MEMORY_DVPP)
        elif ret == VIDEO_DECODE_FINISH:
            log_info("Video has been read finished")
        else:
            log_error("Read frame error: ", ret)

        return ret, image
Exemplo n.º 3
0
    def read(self):
        """
        read decode frame and output status information
        """
        frame = ImageDataC()
        image = None
        ret = libatlas.ReadDecodedFrame(self._channel_id, byref(frame))
        if ret == READ_VIDEO_OK:
            image = acl_image.AclImage(addressof(frame.data.contents),
                                       frame.width, frame.height, frame.size,
                                       MEMORY_DVPP)
        if ret == READ_VIDEO_ERROR:
            acl_logger.log_error("Read frame error")
        elif ret == READ_VIDEO_NOFRAME:
            acl_logger.log_info("No frame to read")
        elif ret == READ_VIDEO_FINISHED:
            acl_logger.log_info("Read video finished")

        return ret, image
Exemplo n.º 4
0
def StartPresenterAgent(msg_queue, server_ip, port, open_status,
                        data_respone_counter):
    agent = PresenterAgent(server_ip, port)
    ret = agent.connect_server()
    if ret:
        log_error("Connect server failed, ret =", ret)
        return

    open_status.value = datatype.STATUS_CONNECTED

    while True:
        data = msg_queue.get()
        if data is None:
            continue

        if isinstance(data, datatype.FinishMsg):
            log_info("Receive presenter agent exit notification, queue size ",
                     msg_queue.qsize())
            time.sleep(0.1)
            agent.exit()
            break

        agent.socket.send_msg(data)
        msg_name, msg_body = agent.socket.recv_msg()
        if (msg_name == None) or (msg_body == None):
            log_error("Recv invalid message, message name ", msg_name)
            continue

        if ((open_status.value == datatype.STATUS_CONNECTED)
                and pm.is_open_channel_response(msg_name)):
            log_info("Received open channel respone")
            open_status.value = datatype.STATUS_OPENED
            agent.start_heard_beat_thread()
            log_info("presenter agent change connect_status to ",
                     open_status.value)

        if ((open_status.value == datatype.STATUS_OPENED)
                and pm.is_image_frame_response(msg_name)):
            data_respone_counter.value += 1
Exemplo n.º 5
0
 def destroy(self):
     if self._is_destroyed is False:
         self.close()
         self._is_destroyed = True
         resource_list.unregister(self)
         log_info("Video decoder ok")