maix.rtsp

maix.rtsp module

You can use maix.rtsp to access this module with MaixPy
This module is generated from MaixPy and MaixCDK

Module

No module

Enum

RtspStreamType

The stream type of rtsp

item describe
values RTSP_STREAM_NONE: format invalid
RTSP_STREAM_H265:

C++ defination code:

enum RtspStreamType
    {
        RTSP_STREAM_NONE = 0,  // format invalid
        RTSP_STREAM_H265,
    }

Variable

Function

Class

Region

Region class

C++ defination code:

class Region

__init__

def __init__(self, x: int, y: int, width: int, height: int, format: maix.image.Format, camera: maix.camera.Camera) -> None

Construct a new Region object

item description
type func
param x: region coordinate x
y: region coordinate y
width: region width
height: region height
format: region format
camera: bind region to camera
static False

C++ defination code:

Region(int x, int y, int width, int height, image::Format format, camera::Camera *camera)

get_canvas

def get_canvas(self) -> maix.image.Image

Return an image object from region

item description
type func
return image object
static False

C++ defination code:

image::Image *get_canvas()

update_canvas

def update_canvas(self) -> maix.err.Err

Update canvas

item description
type func
return error code
static False

C++ defination code:

err::Err update_canvas()

Rtsp

Rtsp class

C++ defination code:

class Rtsp

__init__

def __init__(self, ip: str = '', port: int = 8554, fps: int = 30, stream_type: RtspStreamType = ...) -> None

Construct a new Video object

item description
type func
param ip: rtsp ip
port: rtsp port
fps: rtsp fps
stream_type: rtsp stream type
static False

C++ defination code:

Rtsp(std::string ip = std::string(), int port = 8554, int fps = 30, rtsp::RtspStreamType stream_type = rtsp::RtspStreamType::RTSP_STREAM_H265)

start

def start(self) -> maix.err.Err

start rtsp

item description
type func
return error code, err::ERR_NONE means success, others means failed
static False

C++ defination code:

err::Err start()

start (overload 1)

stop rtsp

item description
type func
return error code, err::ERR_NONE means success, others means failed
static False

C++ defination code:

err::Err stop()

bind_camera

def bind_camera(self, camera: maix.camera.Camera) -> maix.err.Err

Bind camera

item description
type func
param camera: camera object
return error code, err::ERR_NONE means success, others means failed
static False

C++ defination code:

err::Err bind_camera(camera::Camera *camera)

write

def write(self, frame: ...) -> maix.err.Err

Write data to rtsp

item description
type func
param frame: video frame data
return error code, err::ERR_NONE means success, others means failed
static False

C++ defination code:

err::Err write(video::Frame &frame)

get_url

def get_url(self) -> str

Get url of rtsp

item description
type func
return url of rtsp
static False

C++ defination code:

std::string get_url()

get_urls

def get_urls(self) -> list[str]

Get url list of rtsp

item description
type func
return url list of rtsp
static False

C++ defination code:

std::vector<std::string> get_urls()

to_camera

def to_camera(self) -> maix.camera.Camera

Get camera object from rtsp

item description
type func
return camera object
static False

C++ defination code:

camera::Camera *to_camera()

rtsp_is_start

def rtsp_is_start(self) -> bool

return rtsp start status

item description
type func
return true means rtsp is start, false means rtsp is stop.
static False

C++ defination code:

bool rtsp_is_start()

add_region

def add_region(self, x: int, y: int, width: int, height: int, format: maix.image.Format = ...) -> Region

return a region object, you can draw image on the region.

item description
type func
param x: region coordinate x
y: region coordinate y
width: region width
height: region height
format: region format, support Format::FMT_BGRA8888 only
return the reigon object
static False

C++ defination code:

rtsp::Region *add_region(int x, int y, int width, int height, image::Format format = image::Format::FMT_BGRA8888)

update_region

def update_region(self, region: Region) -> maix.err.Err

update and show region

item description
type func
return error code
static False

C++ defination code:

err::Err update_region(rtsp::Region &region)

del_region

def del_region(self, region: Region) -> maix.err.Err

del region

item description
type func
return error code
static False

C++ defination code:

err::Err del_region(rtsp::Region *region)

draw_rect

def draw_rect(self, id: int, x: int, y: int, width: int, height: int, color: maix.image.Color, thickness: int = 1) -> maix.err.Err

Draw a rectangle on the canvas

item description
type func
param id: region id
x: rectangle coordinate x
y: rectangle coordinate y
width: rectangle width
height: rectangle height
color: rectangle color
thickness: rectangle thickness. If you set it to -1, the rectangle will be filled.
return error code
static False

C++ defination code:

err::Err draw_rect(int id, int x, int y, int width, int height, image::Color color, int thickness = 1)

draw_string

def draw_string(self, id: int, x: int, y: int, str: str, color: maix.image.Color, size: int = 16, thickness: int = 1) -> maix.err.Err

Draw a string on the canvas

item description
type func
param id: region id
x: string coordinate x
y: string coordinate y
str: string
color: string color
size: string size
thickness: string thickness
return error code
static False

C++ defination code:

err::Err draw_string(int id, int x, int y, const char *str, image::Color color, int size = 16, int thickness = 1)