sail.MultiDecoder ____________________ Multichannel decoding interface, supporting simultaneous decoding of multichannel video. \_\_init\_\_ >>>>>>>>>>>>>> **Interface:** .. code-block:: python def __init__(self, queue_size: int = 10, tpu_id: int = 0, discard_mode: int = 0) **Parameters:** * queue_size: int For each video, the length of the decoded cached image queue. * tpu_id: int Tpu id that used, which defaults to 0. * discard_mode: int Data discard method when the cache reaches the maximum value. \ 0 indicates that data is not put into the cache; \ 1 indicates that the image of the queue header is poped , \ and then push into the decoded image. The default value is 0. set_read_timeout >>>>>>>>>>>>>>>>>>>> 设置读取图片的超时时间,对read和read_接口生效,超时之后仍然没有获取到图像,结果就会返回。 Set the timeout period for reading images. This takes effect on the read and read\_ interfaces.\ If the image is not obtained after the timeout, the result will be returned. **Interface:** .. code-block:: python def set_read_timeout(self, timeout: int) -> None **Parameters:** * timeout: int Timeout period, in seconds. add_channel >>>>>>>>>>>>>>>> Add a channel **Interface:** .. code-block:: python def add_channel(self, file_path: str, frame_skip_num: int = 0) -> int **Parameters:** * file_path: str The path or link to the video. * frame_skip_num: int Number of active frame loss in decoded cache. The default value is 0, which means no active frame loss. **Returns** Returns the unique channel number corresponding to the video. The type is an integer. del_channel >>>>>>>>>>>>>>> Delete a video channel that has been added. **Interface:** .. code-block:: python def del_channel(self, channel_idx: int) -> int **Parameters:** * channel_idx: int The channel number of the video to be deleted. **Returns** Return 0 on success and other values on failure. clear_queue >>>>>>>>>>>>>>> Clears the image cache for the specified channel. **Interface:** .. code-block:: python def clear_queue(self, channel_idx: int) -> int **Parameters:** * channel_idx: int The channel number of the video to be deleted. **Returns:** Return 0 on success and other values on failure. read >>>>>>>> Gets an image from the specified video channel. **Interface1:** .. code-block:: python def read(self, channel_idx: int, image: BMImage, read_mode: int = 0) -> int **Parameters1:** * channel_idx: int The specified video channel number. * image: BMImage The decoded image. * read_mode: int Mode of obtaining images. 0 indicates that one image is read directly from the cache \ without waiting, and will be returned whether it is read or not. \ Others representations wait until the image is retrieved and then return. **Returns1:** Return 0 on success and other values on failure. **Interface2:** .. code-block:: python def read(self, channel_idx: int) -> BMImage **Parameters2:** * channel_idx: int The specified video channel number. **Returns2:** Returns the decoded image of type BMImage. read\_ >>>>>>>> Gets an image from the specified video channel, usually used with BMImageArray. **Interface1:** .. code-block:: python def read_(self, channel_idx: int, image: bm_image, read_mode: int=0) -> int **Parameters1:** * channel_idx: int The specified video channel number. * image: bm_image The decoded image. * read_mode: int Mode of obtaining images. 0 indicates that one image is read directly from the cache \ without waiting, and will be returned whether it is read or not. \ Others representations wait until the image is retrieved and then return. **Returns1:** Return 0 on success and other values on failure. **Interface2:** .. code-block:: python def read_(self, channel_idx: int) -> bm_image: **Parameters2:** * channel_idx: int The specified video channel number. **Returns2:** Returns the decoded image of type bm_image. reconnect >>>>>>>>>>>>>> Reconnect the video of the corresponding channel. **Interface:** .. code-block:: python def reconnect(self, channel_idx: int) -> int **Parameters:** * channel_idx: int The channel index of the input image. **Returns** Return 0 on success and other values on failure. get_frame_shape >>>>>>>>>>>>>>>>>> Get the image shape of the corresponding channel. **Interface:** .. code-block:: python def get_frame_shape(self, channel_idx: int) -> list[int] **Parameters:** * channel_idx: int The channel index of the input image. **Returns** Returns a list:[1, number of channels, image height, image width]. set_local_flag >>>>>>>>>>>>>>>>>> Set whether the video is a local video. If it is not called, the video is represented \ as a network video stream. **Interface:** .. code-block:: python def set_local_flag(self, flag: bool) -> None: **Parameters:** * flag: bool Standard bit, if True, fixed decoding of 25 frames per second per video channel