std::shared_ptr<stream_profile_interface> software_sensor::add_video_stream(rs2_video_stream video_stream) { auto exist = (std::find_if(_profiles.begin(), _profiles.end(), [&](std::shared_ptr<stream_profile_interface> profile) { if (profile->get_unique_id() == video_stream.uid) { return true; } return false; } ) != _profiles.end()); if (exist) { LOG_WARNING("Stream unique ID already exist!"); throw rs2::error("Stream unique ID already exist!"); } auto profile = std::make_shared<video_stream_profile>( platform::stream_profile{ (uint32_t)video_stream.width, (uint32_t)video_stream.height, (uint32_t)video_stream.fps, 0 }); profile->set_dims(video_stream.width, video_stream.height); profile->set_format(video_stream.fmt); profile->set_framerate(video_stream.fps); profile->set_stream_index(video_stream.index); profile->set_stream_type(video_stream.type); profile->set_unique_id(video_stream.uid); profile->set_intrinsics([=]() {return video_stream.intrinsics; }); _profiles.push_back(profile); return profile; }
std::shared_ptr<stream_profile_interface> software_sensor::add_motion_stream(rs2_motion_stream motion_stream) { auto exist = (std::find_if(_profiles.begin(), _profiles.end(), [&](std::shared_ptr<stream_profile_interface> profile) { return profile->get_unique_id() == motion_stream.uid; }) != _profiles.end()); if (exist) { LOG_WARNING("Motion stream unique ID already exist!"); throw rs2::error("Stream unique ID already exist!"); } auto profile = std::make_shared<motion_stream_profile>( platform::stream_profile{ 0, 0, (uint32_t)motion_stream.fps, 0 }); profile->set_format(motion_stream.fmt); profile->set_framerate(motion_stream.fps); profile->set_stream_index(motion_stream.index); profile->set_stream_type(motion_stream.type); profile->set_unique_id(motion_stream.uid); profile->set_intrinsics([=]() {return motion_stream.intrinsics; }); _profiles.push_back(profile); return profile; }