VideoStream Class

CameraSettingClass

Description
A class used to configure parameters for the camera sensor.

Syntax
class CameraSetting

Members

Public Constructors 
CameraSetting::CameraSettingConstructs a CameraSetting object and set the parameters needed for camera.

VideoSettingClass

Description
A class used to configure parameters for video streams.

Syntax
class VideoSetting

Members

Public Constructors 
VideoSetting::VideoSettingConstructs a VideoSetting object and set the parameters needed for video streams.

VideoSetting::VideoSetting

Description
Constructs a VideoSetting object and sets the parameters needed for video streams, such as resolution, frame rate per second (fps), bit rate per second (bps), encoder type.

Syntax
VideoSetting(uint8_t preset);
VideoSetting(uint8_t resolution, uint8_t fps, uint8_t encoder, uint8_t snapshot);

Parameters
preset: Select one out of 3 preset video stream settings. Default preset: 0.
resolution: Video resolution (Valid value: VIDEO_HD, VIDEO_FHD).
fps: Frame rate in frames per second.
encoder: Video encoder format to use. (Valid value: VIDEO_HEVC, VIDEO_H264, VIDEO_JPEG).
snapshot: Enable or disable snapshot function.

Returns
NA

Example Code
StreamRTSPVideoOnly
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/StreamRTSPVideoOnly/StreamRTSPVideoOnly.ino)

Notes and Warnings
“Video.h” must be included to use the class function.

Preset configurations:
Preset 0:
resolution: VIDEO_FHD
fps: 30
bps: 2*1024*1024
encoder: VIDEO_H264
snapshot: 0
Preset 1:
resolution: VIDEO_HD
fps: 30
bps: 2*1024*1024
encoder: VIDEO_H264
snapshot: 0

Preset 2:
resolution: VIDEO_FHD
fps: 30
bps: 2*1024*1024
encoder: VIDEO_JPEG
snapshot: 0

VideoClass

Description
A class used to configure and initialize the camera to generate video data streams.

Syntax
class Video

Members

Public Constructors 
Video::VideoConstruct a Video object.
Public Methods 
Video::configVideoChannelConfigure video stream channel.
Video::camInitInitialization of camera sensor using existing configurations.
Video::camDeinitDeinitialization of camera sensor.
Video::videoInitInitialization of video streams using existing configurations.
Video::videoDeinitDeinitialization of video stream module for a specific channel.
Video::channelBeginStart video streaming on a specific channel.
Video::channelEndStop video streaming on a specific channel.
Video::getStreamGet video data stream to provide as an input for other data stream consumers.
Video::setSnapshotCallbackSet channel for snapshot callback.
Video::snapshotCBGet snapshot info.
Video::getImageEnable snapshot function.
Video::setFPSSet camera video max FPS.
Video::printSnapshotInfoPrint out snapshot info in hexadecimal to convert it into an image using an online tool.
Video::printInfoPrint out current configuration of video channels.

Video::configVideoChannel

Description
Configure video stream channel parameters using VideoSetting class object.

Syntax
void configVideoChannel(int ch, VideoSetting& config);

Parameters
ch: Channel to configure (Valid value: 0,1,2)
config: VideoSetting object

Returns
NA

Example Code
StreamRTSPVideoOnly
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/StreamRTSPVideoOnly/StreamRTSPVideoOnly.ino)

Notes and Warnings
“Video.h” must be included to use the class function.

Video::camInit

Description
Initialize camera sensor using configuration from CameraSetting object.

Syntax
void cameraInit(CameraSetting& config);

Parameters
_config: CameraSetting object.

Returns
NA

Example Code
NA

Notes and Warnings
“Video.h” must be included to use the class function.

Video::camDeinit

Description
Deinitialize camera sensor.

Syntax
void cameraDeinit(void);

Parameters
NA

Returns
NA

Example Code
NA

Notes and Warnings
“Video.h” must be included to use the class function.

Video::videoInit

Description
Initialization of video streams from camera using existing configurations.

Syntax
void videoInit(void);

Parameters
NA

Returns
NA

Example Code
StreamRTSPVideoOnly
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/StreamRTSPVideoOnly/StreamRTSPVideoOnly.ino)

Notes and Warnings
“Video.h” must be included to use the class function.

Video::videoDeinit

Description
Deinitialization of all video streams.

Syntax
void videoDeinit(void);

Parameters
NA

Returns
NA

Example Code
NA

Notes and Warnings
“Video.h” must be included to use the class function.

Video::channelBegin

Description
Start video streaming on a specific channel.

Syntax
void channelBegin(int ch);

Parameters
ch: channel to start streaming. Default channel is 0.

Returns
NA

Example Code
StreamRTSPVideoOnly
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/StreamRTSPVideoOnly/StreamRTSPVideoOnly.ino)

Notes and Warnings
“Video.h” must be included to use the class function.

Video::channelEnd

Description
Stop video streaming on a specific channel.

Syntax
void channelEnd(int ch);

Parameters
ch: channel to stop streaming. Default channel is 0.

Returns
NA

Example Code
NA

Notes and Warnings
“Video.h” must be included to use the class function.

Video::getStream

Description
Get video data stream to provide as an input for other data stream consumers.

Syntax
MMFModule getStream(int ch);

Parameters
ch: channel to get data stream of. Default channel is 0.

Returns
This function returns the video data stream.

Example Code
StreamRTSPVideoOnly
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/StreamRTSPVideoOnly/StreamRTSPVideoOnly.ino)

Notes and Warnings
“Video.h” must be included to use the class function.

Video:: setSnapshotCallback

Description
Set channel for snapshot callback.

Syntax
void setSnapshotCallback(int ch);

Parameters
ch: channel to get data stream of. Default channel is 0.

Returns
This function returns the video data stream.

Example Code
NA

Notes and Warnings
“Video.h” must be included to use the class function.

Video:: snapshotCB

Description
Get video data stream to provide as an input for other data stream consumers.

Syntax
int snapshotCB(uint32_t jpeg_addr, uint32_t jpeg_len);

Parameters
jpeg_addr: image address.
jpeg_len : image length.

Returns
This function returns the video data stream.

Example Code
NA

Notes and Warnings
“Video.h” must be included to use the class function.

Video::getImage

Description
Enable snapshot function and take a snapshot.

Syntax
void getImage(void);

Parameters
NA

Returns
NA

Example Code
NA

Notes and Warnings
“Video.h” must be included to use the class function.

Video::setFPS

Description
Set camera video max FPS.

Syntax
void setFPS(int fps);

Parameters
fps: max frame rate in frames per second for camera.

Returns
NA

Example Code
NA

Notes and Warnings
“Video.h” must be included to use the class function.

Video::printSnapshotInfo

Description
Print out snapshot info in hexadecimal to convert it into an image using an online tool.

Syntax
void printSnapshotInfo(void);

Parameters
NA

Returns
NA

Example Code
NA

Notes and Warnings
“Video.h” must be included to use the class function.

Video::printInfo

Description
Print out current configuration of video channels.

Syntax
void printInfo(void);

Parameters
NA

Returns
NA

Example Code
StreamRTSPVideoOnly
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/StreamRTSPVideoOnly/StreamRTSPVideoOnly.ino)

Notes and Warnings
“Video.h” must be included to use the class function.

请先确认已安装QQ通讯软体