refactor(*): change stream request and params interfaces
This commit is contained in:
@@ -32,8 +32,8 @@ namespace device {
|
||||
|
||||
typedef struct ImgParams {
|
||||
bool ok;
|
||||
std::map<Resolution, Intrinsics> in_left_map;
|
||||
std::map<Resolution, Intrinsics> in_right_map;
|
||||
Intrinsics in_left;
|
||||
Intrinsics in_right;
|
||||
Extrinsics ex_right_to_left;
|
||||
} img_params_t;
|
||||
|
||||
|
||||
@@ -104,14 +104,7 @@ class MYNTEYE_API Device {
|
||||
* Supports the addon or not.
|
||||
*/
|
||||
bool Supports(const AddOns &addon) const;
|
||||
/**
|
||||
* Init device resolution.
|
||||
*/
|
||||
void InitResolution(const Resolution &res);
|
||||
/**
|
||||
* set the stream request.
|
||||
*/
|
||||
void SetStreamRequest(const Format &format, const FrameRate &rate);
|
||||
|
||||
/**
|
||||
* Get all stream requests of the capability.
|
||||
*/
|
||||
@@ -122,6 +115,23 @@ class MYNTEYE_API Device {
|
||||
*/
|
||||
void ConfigStreamRequest(
|
||||
const Capabilities &capability, const StreamRequest &request);
|
||||
/**
|
||||
* Get the config stream requests of the capability.
|
||||
*/
|
||||
const StreamRequest &GetStreamRequest(const Capabilities &capability) const;
|
||||
|
||||
/**
|
||||
* Get all stream requests of the key stream capability.
|
||||
*/
|
||||
const std::vector<StreamRequest> &GetStreamRequests() const;
|
||||
/**
|
||||
* Config the stream request to the key stream capability.
|
||||
*/
|
||||
void ConfigStreamRequest(const StreamRequest &request);
|
||||
/**
|
||||
* Get the config stream requests of the key stream capability.
|
||||
*/
|
||||
const StreamRequest &GetStreamRequest() const;
|
||||
|
||||
/**
|
||||
* Get the device info.
|
||||
@@ -241,15 +251,15 @@ class MYNTEYE_API Device {
|
||||
*/
|
||||
void WaitForStreams();
|
||||
|
||||
/**
|
||||
* Get the latest data of stream.
|
||||
*/
|
||||
device::StreamData GetStreamData(const Stream &stream);
|
||||
/**
|
||||
* Get the datas of stream.
|
||||
* @note default cache 4 datas at most.
|
||||
*/
|
||||
std::vector<device::StreamData> GetStreamDatas(const Stream &stream);
|
||||
/**
|
||||
* Get the latest data of stream.
|
||||
*/
|
||||
device::StreamData GetLatestStreamData(const Stream &stream);
|
||||
|
||||
/**
|
||||
* Enable cache motion datas.
|
||||
@@ -263,10 +273,6 @@ class MYNTEYE_API Device {
|
||||
* Get the motion datas.
|
||||
*/
|
||||
std::vector<device::MotionData> GetMotionDatas();
|
||||
/**
|
||||
* Get the device img params
|
||||
*/
|
||||
img_params_t GetImgParams();
|
||||
|
||||
protected:
|
||||
std::shared_ptr<uvc::device> device() const {
|
||||
@@ -285,8 +291,6 @@ class MYNTEYE_API Device {
|
||||
return motions_;
|
||||
}
|
||||
|
||||
const StreamRequest &GetStreamRequest(const Capabilities &capability);
|
||||
|
||||
virtual void StartVideoStreaming();
|
||||
virtual void StopVideoStreaming();
|
||||
|
||||
@@ -295,25 +299,33 @@ class MYNTEYE_API Device {
|
||||
|
||||
virtual void OnStereoStreamUpdate();
|
||||
|
||||
virtual Capabilities GetKeyStreamCapability() const = 0;
|
||||
virtual std::vector<Stream> GetKeyStreams() const = 0;
|
||||
|
||||
std::map<Resolution, device::img_params_t> GetImgParams() const {
|
||||
return all_img_params_;
|
||||
}
|
||||
device::imu_params_t GetImuParams() const {
|
||||
return imu_params_;
|
||||
}
|
||||
|
||||
bool video_streaming_;
|
||||
bool motion_tracking_;
|
||||
|
||||
private:
|
||||
Model model_;
|
||||
Resolution res_ = Resolution::RES_752x480;
|
||||
StreamRequest request_;
|
||||
std::shared_ptr<uvc::device> device_;
|
||||
std::shared_ptr<DeviceInfo> device_info_;
|
||||
|
||||
std::map<Resolution, device::img_params_t> all_img_params_;
|
||||
device::imu_params_t imu_params_;
|
||||
|
||||
std::map<Stream, Intrinsics> stream_intrinsics_;
|
||||
std::map<Stream, std::map<Stream, Extrinsics>> stream_from_extrinsics_;
|
||||
|
||||
std::shared_ptr<MotionIntrinsics> motion_intrinsics_;
|
||||
std::map<Stream, Extrinsics> motion_from_extrinsics_;
|
||||
|
||||
img_params_t img_params_;
|
||||
stream_callbacks_t stream_callbacks_;
|
||||
motion_callback_t motion_callback_;
|
||||
|
||||
@@ -331,8 +343,8 @@ class MYNTEYE_API Device {
|
||||
std::shared_ptr<Motions> motions_;
|
||||
|
||||
void ReadAllInfos();
|
||||
|
||||
void ConfigIntrinsics(const Resolution &res);
|
||||
void UpdateStreamIntrinsics(
|
||||
const Capabilities &capability, const StreamRequest &request);
|
||||
|
||||
void CallbackPushedStreamData(const Stream &stream);
|
||||
void CallbackMotionData(const device::MotionData &data);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "mynteye/mynteye.h"
|
||||
#include "mynteye/types.h"
|
||||
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
@@ -39,6 +40,16 @@ namespace device {
|
||||
*/
|
||||
MYNTEYE_API std::shared_ptr<Device> select();
|
||||
|
||||
/**
|
||||
* @ingroup utils
|
||||
*
|
||||
* List stream requests and prompt user to select one.
|
||||
*
|
||||
* @return the selected request.
|
||||
*/
|
||||
MYNTEYE_API MYNTEYE_NAMESPACE::StreamRequest select_request(
|
||||
const std::shared_ptr<Device> &device, bool *ok);
|
||||
|
||||
} // namespace device
|
||||
|
||||
namespace utils {
|
||||
@@ -58,14 +69,14 @@ MYNTEYE_API float get_real_exposure_time(
|
||||
|
||||
/**
|
||||
* @ingroup utils
|
||||
*
|
||||
*
|
||||
* Get sdk root dir.
|
||||
*/
|
||||
MYNTEYE_API std::string get_sdk_root_dir();
|
||||
|
||||
/**
|
||||
* @ingroup utils
|
||||
*
|
||||
*
|
||||
* Get sdk install dir.
|
||||
*/
|
||||
MYNTEYE_API std::string get_sdk_install_dir();
|
||||
|
||||
Reference in New Issue
Block a user