18class StreamProfile :
public std::enable_shared_from_this<StreamProfile> {
20 const ob_stream_profile_t *
impl_ =
nullptr;
27 streamProfile.impl_ =
nullptr;
31 if(
this != &streamProfile) {
35 impl_ = streamProfile.impl_;
36 streamProfile.impl_ =
nullptr;
119 template <
typename T>
bool is()
const;
127 template <
typename T> std::shared_ptr<T>
as() {
129 throw std::runtime_error(
"Unsupported operation. Object's type is not the required type.");
132 return std::dynamic_pointer_cast<T>(shared_from_this());
141 template <
typename T> std::shared_ptr<const T>
as()
const {
143 throw std::runtime_error(
"Unsupported operation. Object's type is not the required type.");
146 return std::static_pointer_cast<const T>(shared_from_this());
404 static std::shared_ptr<StreamProfile>
create(
const ob_stream_profile_t *impl) {
416 return std::make_shared<VideoStreamProfile>(impl);
418 return std::make_shared<AccelStreamProfile>(impl);
420 return std::make_shared<GyroStreamProfile>(impl);
432 const ob_stream_profile_list_t *
impl_;
460 std::shared_ptr<StreamProfile>
getProfile(uint32_t index)
const {
Functions for handling errors, mainly used for obtaining error messages.
OB_EXPORT ob_error * ob_create_error(ob_status status, const char *message, const char *function, const char *args, ob_exception_type exception_type)
Create a new error object.
OBGyroFullScaleRange
Enumeration of gyroscope ranges.
struct ob_stream_profile_t ob_stream_profile
OBFormat
Enumeration value describing the pixel format.
OBStreamType
Enumeration value describing the type of data stream.
enum OBIMUSampleRate OBGyroSampleRate
@ OB_EXCEPTION_TYPE_INVALID_VALUE
OBAccelFullScaleRange
Enumeration of accelerometer ranges.
enum OBIMUSampleRate OBAccelSampleRate
struct OBD2CTransform OBExtrinsic
The stream profile related type is used to get information such as the width, height,...
OB_EXPORT ob_gyro_intrinsic ob_gyro_stream_get_intrinsic(const ob_stream_profile *profile, ob_error **error)
Get the intrinsic of the gyroscope stream.
OB_EXPORT ob_gyro_sample_rate ob_gyro_stream_profile_get_sample_rate(const ob_stream_profile *profile, ob_error **error)
Get the sampling frequency of the gyroscope stream.
OB_EXPORT ob_stream_profile * ob_stream_profile_list_get_video_stream_profile(const ob_stream_profile_list *profile_list, int width, int height, ob_format format, int fps, ob_error **error)
Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matche...
OB_EXPORT ob_stream_profile * ob_stream_profile_list_get_accel_stream_profile(const ob_stream_profile_list *profile_list, ob_accel_full_scale_range full_scale_range, ob_accel_sample_rate sample_rate, ob_error **error)
Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matche...
OB_EXPORT uint32_t ob_stream_profile_list_get_count(const ob_stream_profile_list *profile_list, ob_error **error)
Get the number of StreamProfile lists.
OB_EXPORT ob_stream_profile * ob_stream_profile_list_get_profile(const ob_stream_profile_list *profile_list, int index, ob_error **error)
Get the corresponding StreamProfile by subscripting.
OB_EXPORT ob_format ob_stream_profile_get_format(const ob_stream_profile *profile, ob_error **error)
Get stream profile format.
OB_EXPORT uint32_t ob_video_stream_profile_get_fps(const ob_stream_profile *profile, ob_error **error)
Get the frame rate of the video stream.
OB_EXPORT void ob_video_stream_profile_set_intrinsic(ob_stream_profile *profile, ob_camera_intrinsic intrinsic, ob_error **error)
Set the intrinsic of the video stream profile.
OB_EXPORT void ob_video_stream_profile_set_distortion(ob_stream_profile *profile, ob_camera_distortion distortion, ob_error **error)
Set the distortion of the video stream profile.
OB_EXPORT void ob_delete_stream_profile(const ob_stream_profile *profile, ob_error **error)
Delete the stream configuration.
OB_EXPORT void ob_delete_stream_profile_list(const ob_stream_profile_list *profile_list, ob_error **error)
Delete the stream profile list.
OB_EXPORT ob_accel_intrinsic ob_accel_stream_profile_get_intrinsic(const ob_stream_profile *profile, ob_error **error)
Get the intrinsic of the accelerometer stream.
OB_EXPORT uint32_t ob_video_stream_profile_get_width(const ob_stream_profile *profile, ob_error **error)
Get the width of the video stream.
OB_EXPORT ob_gyro_full_scale_range ob_gyro_stream_profile_get_full_scale_range(const ob_stream_profile *profile, ob_error **error)
Get the full-scale range of the gyroscope stream.
OB_EXPORT ob_accel_sample_rate ob_accel_stream_profile_get_sample_rate(const ob_stream_profile *profile, ob_error **error)
Get the sampling frequency of the accelerometer frame.
OB_EXPORT ob_stream_profile * ob_stream_profile_list_get_gyro_stream_profile(const ob_stream_profile_list *profile_list, ob_gyro_full_scale_range full_scale_range, ob_gyro_sample_rate sample_rate, ob_error **error)
Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matche...
OB_EXPORT void ob_stream_profile_set_extrinsic_to(ob_stream_profile *source, const ob_stream_profile *target, ob_extrinsic extrinsic, ob_error **error)
Set the extrinsic for source stream to target stream.
OB_EXPORT void ob_stream_profile_set_extrinsic_to_type(ob_stream_profile *source, const ob_stream_type type, ob_extrinsic extrinsic, ob_error **error)
Set the extrinsic for source stream to target stream type.
OB_EXPORT uint32_t ob_video_stream_profile_get_height(const ob_stream_profile *profile, ob_error **error)
Get the height of the video stream.
OB_EXPORT ob_camera_distortion ob_video_stream_profile_get_distortion(const ob_stream_profile *profile, ob_error **error)
Get the distortion of the video stream profile.
OB_EXPORT ob_camera_intrinsic ob_video_stream_profile_get_intrinsic(const ob_stream_profile *profile, ob_error **error)
Get the intrinsic of the video stream profile.
OB_EXPORT ob_accel_full_scale_range ob_accel_stream_profile_get_full_scale_range(const ob_stream_profile *profile, ob_error **error)
Get the full-scale range of the accelerometer stream.
OB_EXPORT ob_stream_type ob_stream_profile_get_type(const ob_stream_profile *profile, ob_error **error)
Get stream profile type.
OB_EXPORT ob_extrinsic ob_stream_profile_get_extrinsic_to(const ob_stream_profile *source, ob_stream_profile *target, ob_error **error)
Get the extrinsic for source stream to target stream.
Class representing an accelerometer stream profile.
AccelStreamProfile(const ob_stream_profile_t *impl)
OBAccelIntrinsic getIntrinsic() const
get the intrinsic parameters of the stream.
OBAccelSampleRate getSampleRate() const
Return the sampling frequency.
OBAccelFullScaleRange getFullScaleRange() const
Return the full scale range.
OBAccelSampleRate sampleRate() const
~AccelStreamProfile() noexcept override=default
OBAccelFullScaleRange fullScaleRange() const
static void handle(ob_error **error, bool throw_exception=true)
A static function to handle the ob_error and throw an exception if needed.
Class representing a gyroscope stream profile.
OBGyroFullScaleRange getFullScaleRange() const
Return the full scale range.
OBGyroSampleRate getSampleRate() const
Return the sampling frequency.
OBGyroIntrinsic getIntrinsic() const
get the intrinsic parameters of the stream.
GyroStreamProfile(const ob_stream_profile_t *impl)
~GyroStreamProfile() noexcept override=default
OBGyroSampleRate sampleRate() const
OBGyroFullScaleRange fullScaleRange() const
static std::shared_ptr< StreamProfile > create(const ob_stream_profile_t *impl)
StreamProfile(StreamProfile &&streamProfile) noexcept
const ob_stream_profile_t * impl_
std::shared_ptr< const T > as() const
Converts object type to target type (const version).
virtual ~StreamProfile() noexcept
OBStreamType type() const
bool is() const
Check if frame object is compatible with the given type.
StreamProfile & operator=(StreamProfile &streamProfile)=delete
OBExtrinsic getExtrinsicTo(std::shared_ptr< StreamProfile > target) const
Get the extrinsic parameters from current stream profile to the given target stream profile.
StreamProfile(StreamProfile &streamProfile)=delete
StreamProfile & operator=(StreamProfile &&streamProfile) noexcept
const ob_stream_profile * getImpl() const
void bindExtrinsicTo(const OBStreamType &targetStreamType, const OBExtrinsic &extrinsic)
Set the extrinsic parameters from current stream profile to the given target stream type.
std::shared_ptr< T > as()
Converts object type to target type.
void bindExtrinsicTo(std::shared_ptr< StreamProfile > target, const OBExtrinsic &extrinsic)
Set the extrinsic parameters from current stream profile to the given target stream profile.
OBStreamType getType() const
Get the type of stream.
OBFormat getFormat() const
Get the format of the stream.
StreamProfile(const ob_stream_profile_t *impl)
~StreamProfileList() noexcept
std::shared_ptr< GyroStreamProfile > getGyroStreamProfile(OBGyroFullScaleRange fullScaleRange, OBGyroSampleRate sampleRate) const
Match the corresponding gyroscope stream profile based on the passed-in parameters....
std::shared_ptr< StreamProfile > getProfile(uint32_t index) const
Return the StreamProfile object at the specified index.
uint32_t getCount() const
Return the number of StreamProfile objects.
const ob_stream_profile_list_t * impl_
std::shared_ptr< AccelStreamProfile > getAccelStreamProfile(OBAccelFullScaleRange fullScaleRange, OBAccelSampleRate sampleRate) const
Match the corresponding accelerometer stream profile based on the passed-in parameters....
std::shared_ptr< VideoStreamProfile > getVideoStreamProfile(int width=OB_WIDTH_ANY, int height=OB_HEIGHT_ANY, OBFormat format=OB_FORMAT_ANY, int fps=OB_FPS_ANY) const
Match the corresponding video stream profile based on the passed-in parameters. If multiple Match are...
StreamProfileList(ob_stream_profile_list_t *impl)
Class representing a video stream profile.
void setIntrinsic(const OBCameraIntrinsic &intrinsic)
Set the intrinsic parameters of the stream.
OBCameraDistortion getDistortion() const
Get the distortion parameters of the stream.
uint32_t getWidth() const
Return the width of the stream.
void setDistortion(const OBCameraDistortion &distortion)
Set the distortion parameters of the stream.
uint32_t getFps() const
Return the frame rate of the stream.
OBCameraIntrinsic getIntrinsic() const
Get the intrinsic parameters of the stream.
VideoStreamProfile(const ob_stream_profile_t *impl)
~VideoStreamProfile() noexcept override=default
uint32_t getHeight() const
Return the height of the stream.
Structure for accelerometer intrinsic parameters.
Structure for distortion parameters.
Structure for camera intrinsic parameters.
Structure for gyroscope intrinsic parameters.
The error class exposed by the SDK, users can get detailed error information according to the error.