maix::webrtc

maix.webrtc module

This is maix::webrtc module of MaixCDK.
All of these elements are in namespace maix::webrtc.

For MaixCDK developer: DO NOT edit this doc file manually, this doc is auto generated!

Module

No module

Enum

WebRTCStreamType

The stream type of webrtc

item describe
values WEBRTC_STREAM_NONE: format invalid
WEBRTC_STREAM_H264:
WEBRTC_STREAM_H265:

C++ defination code:

enum class WebRTCStreamType
    {
        WEBRTC_STREAM_NONE = 0,  // format invalid
        WEBRTC_STREAM_H264,
        WEBRTC_STREAM_H265,
    }

WebRTCRCType

The rc type of webrtc

item describe
values WEBRTC_RC_NONE: format invalid
WEBRTC_RC_CBR:
WEBRTC_RC_VBR:

C++ defination code:

enum class WebRTCRCType
    {
        WEBRTC_RC_NONE = 0,  // format invalid
        WEBRTC_RC_CBR,
        WEBRTC_RC_VBR,
    }

Variable

Function

Class

Region

Region class

C++ defination code:

class Region

Region

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

Return an image object from region

item description
type func
return image object
static False

C++ defination code:

image::Image *get_canvas()

update_canvas

Update canvas

item description
type func
return error code
static False

C++ defination code:

err::Err update_canvas()

WebRTC

WebRTC class

C++ defination code:

class WebRTC

WebRTC

Construct a new WebRTC object

item description
type func
param ip: listen ip
port: listen port
stream_type: stream type
rc_type: rc type
bitrate: video bitrate
gop: video gop
signaling_ip: signaling server bind ip
signaling_port: signaling server bind port
stun_server: STUN server address
http_server: whether to enable the HTTP server
static False

C++ defination code:

WebRTC(std::string ip = std::string(), int port = 8000,
               webrtc::WebRTCStreamType stream_type = webrtc::WebRTCStreamType::WEBRTC_STREAM_H264,
               webrtc::WebRTCRCType rc_type = webrtc::WebRTCRCType::WEBRTC_RC_CBR,
               int bitrate = 3000 * 1000, int gop = 60, std::string signaling_ip = std::string(),
               int signaling_port = 8001, const std::string &stun_server = "stun:stun.l.google.com:19302",
               bool http_server = true)

start

start webrtc

item description
type func
return error code
static False

C++ defination code:

err::Err start()

stop

stop webrtc

item description
type func
return error code
static False

C++ defination code:

err::Err stop()

bind_camera

Bind camera

item description
type func
param camera: camera object
return error code
static False

C++ defination code:

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

bind_audio_recorder

Bind audio recorder

item description
type func
note If the audio_recorder object is bound, it cannot be used elsewhere.
param recorder: audio recorder object
return error code
static False

C++ defination code:

err::Err bind_audio_recorder(audio::Recorder *recorder)

write

Write encoded video (optional, reserved)

item description
type func
static False

C++ defination code:

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

get_url

Get signaling or play url

item description
type func
return url
static False

C++ defination code:

std::string get_url()

get_urls

Get url list

item description
type func
return url list
static False

C++ defination code:

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

to_camera

Get camera object

item description
type func
static False

C++ defination code:

camera::Camera *to_camera()

webrtc_is_start

webrtc is start

item description
type func
static False

C++ defination code:

bool webrtc_is_start()

add_region

return a region object, you can draw image on the region.(This function will be removed in the future)

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:

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

update_region

update and show region(This function will be removed in the future)

item description
type func
return error code
static False

C++ defination code:

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

del_region

del region(This function will be removed in the future)

item description
type func
return error code
static False

C++ defination code:

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

draw_rect

Draw a rectangle on the canvas(This function will be removed in the future)

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

Draw a string on the canvas(This function will be removed in the future)

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)