void depthstream::on_get_parameter(astra_streamconnection_t connection, astra_parameter_id id, astra_parameter_bin_t& parameterBin) { PROFILE_FUNC(); switch (id) { case ASTRA_PARAMETER_DEPTH_CONVERSION_CACHE: { std::size_t resultByteLength = sizeof(conversion_cache_t); astra_parameter_data_t parameterData; astra_status_t rc = pluginService().get_parameter_bin(resultByteLength, ¶meterBin, ¶meterData); if (rc == ASTRA_STATUS_SUCCESS) { std::memcpy(parameterData, &conversionCache_, resultByteLength); } break; } case ASTRA_PARAMETER_DEPTH_REGISTRATION: { std::size_t resultByteLength = sizeof(bool); astra_parameter_data_t parameterData; astra_status_t rc = pluginService().get_parameter_bin(resultByteLength, ¶meterBin, ¶meterData); if (rc == ASTRA_STATUS_SUCCESS) { bool* enable = static_cast<bool*>(parameterData); openni::ImageRegistrationMode mode = oniDevice_.getImageRegistrationMode(); switch (mode) { case openni::ImageRegistrationMode::IMAGE_REGISTRATION_DEPTH_TO_COLOR: *enable = true; break; case openni::ImageRegistrationMode::IMAGE_REGISTRATION_OFF: default: *enable = false; break; } } } default: devicestream::on_get_parameter(connection, id, parameterBin); break; } }
void register_for_stream_events() { pluginService(). register_stream_registered_callback(&plugin_base::stream_added_handler_thunk, this, &streamAddedCallbackId_); pluginService(). register_stream_unregistering_callback(&plugin_base::stream_removing_handler_thunk, this, &streamRemovingCallbackId_); }
void register_for_host_events() { pluginService(). register_host_event_callback(&plugin_base::host_event_handler_thunk, this, &hostEventCallbackId_); }
void handstream::get_include_candidates(astra_parameter_bin_t& parameterBin) { size_t resultByteLength = sizeof(bool); astra_parameter_data_t parameterData; astra_status_t rc = pluginService().get_parameter_bin(resultByteLength, ¶meterBin, ¶meterData); if (rc == ASTRA_STATUS_SUCCESS) { memcpy(parameterData, &includeCandidatePoints_, resultByteLength); } }
void device_stream<TFrameWrapper>::on_get_parameter(astra_streamconnection_t connection, astra_parameter_id id, astra_parameter_bin_t& parameterBin) { size_t resultByteLength; deviceStream_->get_property_size(id, &resultByteLength); astra_parameter_data_t parameterData; astra_status_t rc = pluginService().get_parameter_bin(resultByteLength, ¶meterBin, ¶meterData); if (rc == astra_status_t::ASTRA_STATUS_SUCCESS) { deviceStream_->get_property(id, parameterData, resultByteLength); } }
void XSPlugin::on_stream_added(astra_streamset_t setHandle, astra_stream_t streamHandle, astra_stream_desc_t streamDesc) { if (streamDesc.type == ASTRA_STREAM_DEPTH && m_pointProcessorMap.find(streamHandle) == m_pointProcessorMap.end()) { LOG_INFO("astra.plugins.xs.XSPlugin", "creating point processor"); StreamDescription depthDescription = streamDesc; auto pointProcessorPtr = std::make_unique<PointProcessor>(pluginService(), setHandle, depthDescription); m_pointProcessorMap[streamHandle] = std::move(pointProcessorPtr); } }
device_streamset* oni_adapter_plugin::add_or_get_device(const char* oniUri) { device_streamset* device = find_device(oniUri); if (device) return device; std::stringstream sstream; sstream << "device/sensor" << streamsets_.size(); streamset_ptr streamSet = std::make_unique<device_streamset>(sstream.str(), pluginService(), oniUri); streamSet->open(); device = streamSet.get(); streamsets_.push_back(std::move(streamSet)); return device; }
void device_stream<TFrameWrapper>::set_mode(const astra::ImageStreamMode& mode) { assert(mode.pixelFormat() != 0); bufferLength_ = mode.width() * mode.height() * mode.bytesPerPixel(); LOG_INFO("orbbec.mocks.device_stream", "bin change: %ux%ux%u len: %u", mode.width(), mode.height(), mode.bytesPerPixel(), bufferLength_); bin_ = std::make_unique<bin_type>(pluginService(), get_handle(), bufferLength_); for(auto& conn : connections_) { bin_->link_connection(conn); }; }
void unregister_for_host_events() { pluginService().unregister_host_event_callback(hostEventCallbackId_); }
void unregister_for_stream_events() { pluginService().unregister_stream_registered_callback(streamAddedCallbackId_); pluginService().unregister_stream_unregistering_callback(streamRemovingCallbackId_); }