Liveview

2024-04-07
No Rating

Catalog

Definition, Enum and Struct

typedef enum CameraSource

Source of Payload Camera's Stream

enum CameraSource {
/*! Wide-angle lens */
kCameraSourceWide = 1,

/*! Zoom lens */
kCameraSourceZoom = 2,

/*! Infrared lens */
kCameraSourceIR = 3,
};

typedef enum CameraType

Type of Stream Camera

enum CameraType {
/*! FPV Camera */
kCameraTypeFpv = 0,

/*! Payload Camera */
kCameraTypePayload = 1,
};

typedef enum StreamQuality

Quality of the Stream

enum StreamQuality {
/*! Stream Quality 540p: 30fps, 960*540, bps 512*1024 */
kStreamQuality540p = 1,

/*! Stream Quality 720p: 30fps, 1280*720, bps 1024*1024 */
kStreamQuality720p = 2,

/*! Stream Quality 720pHigh: 30fps, 1280*720, bps 1024*1024 + 512*1024 */
kStreamQuality720pHigh = 3,

/*! Stream Quality 1080p: 30fps, 1920*1080, bps 3*1024*1024 */
kStreamQuality1080p = 4,

/*! Stream Quality 1080pHigh: 30fps, 1920*1080, bps 8*1024*1024 */
kStreamQuality1080pHigh = 5,
};

typedef struct Options

Initialization Parameters for Live Stream

struct Options {
/*! Type of camera for subscribing stream */
CameraType camera;

/*! Quality of subscribed stream. Note: The actual quality of the subscribed stream may vary; the dock will return the closest matching stream quality based on current conditions. */
StreamQuality quality;

/*! Processing function for received stream */
H264Callback callback;
};

Function

function H264Callback

Function: Callback for the liveview camera's h264 streamproduct:all
using H264Callback = std::function<ErrorCode(const uint8_t* buf, uint32_t len)>;
Parameter
len:Length of the received h264 stream data
buf:Received h264 stream data

function LiveviewStatus

Live stream status. Each bit represents the validity of different stream qualities: bit0 represents the validity of the adaptive stream; bit1 represents the 540p stream's validity; bit2 represents the 720p stream's validity; bit3 represents the 720pHigh stream's validity; bit4 represents the 1080p stream's validity;bit5 represents the 1080pHigh stream's validity.product:all
using LiveviewStatus = uint32_t;

function LiveviewStatusCallback

Function: Prototype for stream status processingproduct:all
using LiveviewStatusCallback = std::function<void(const LiveviewStatus& status)>;
Parameter
status:Stream's status

function Init

Function: Initialize live stream subscription. Note: For a specific camera, you can initialize only onceproduct:all
virtual ErrorCode Init(const Options& option) = 0;
Parameter
option:Stream initialization configuration
Return
Execution result

function DeInit

Function: Deinitialize stream subscriptionproduct:all
virtual ErrorCode DeInit() = 0;
Return
Execution result

function SetCameraSource

Function: Set camera stream sourceproduct:all
virtual ErrorCode SetCameraSource(CameraSource source) = 0;
Return
Execution result

function SubscribeLiveviewStatus

Function: Subscribe to live stream statusproduct:all
virtual ErrorCode SubscribeLiveviewStatus(
const LiveviewStatusCallback& callback) = 0;
Parameter
callback:Stream processing callback
Return
Execution result

function StartH264Stream

Function: Start live H264 streamproduct:all
virtual ErrorCode StartH264Stream() = 0;
Return
Execution result

function StopH264Stream

Function: Stop live H264 streamproduct:all
virtual ErrorCode StopH264Stream() = 0;
Return
Execution result

function CreateLiveview

Function: Get liveview module instanceproduct:all
std::shared_ptr<Liveview> CreateLiveview();
Return
Execution result