mDepthCallback(nullptr),
mPointcloudCallback(nullptr),
mDfsIsLive(false),
- mDfsAsyncQueue(nullptr)
+ mDfsAsyncQueue(nullptr),
+ mInternalSource(nullptr)
{
LOGI("ENTER");
#ifdef MV_3D_POINTCLOUD_IS_AVAILABLE
delete mDfsAdaptor;
}
+ if (mInternalSource) {
+ mv_destroy_source(mInternalSource);
+ mInternalSource = nullptr;
+ }
+
LOGI("LEAVE");
}
mDfsAsyncQueue = nullptr;
}
+ if (mInternalSource) {
+ int ret = mv_destroy_source(mInternalSource);
+ if (ret != MEDIA_VISION_ERROR_NONE) {
+ LOGE("Fail to destroy intern source. But keep going..");
+ }
+ mInternalSource = nullptr;
+ }
+
GetDfsDataFromSources(baseSource, extraSource, input);
mDfsAdaptor->run(input);
std::shared_ptr<DfsInputData> input(new DfsInputData);
GetDfsDataFromSources(baseSource, extraSource, *input);
+ if (!mInternalSource) {
+ int ret = mv_create_source(&mInternalSource);
+ if (ret != MEDIA_VISION_ERROR_NONE) {
+ LOGE("Fail to create internal source");
+ return MEDIA_VISION_ERROR_INTERNAL;
+ }
+ }
g_async_queue_push(mDfsAsyncQueue, static_cast<void*>(
new std::shared_ptr<DfsInputData>(
std::move(input))));
handle->mDfsAdaptor->run(*input);
auto depthData = handle->mDfsAdaptor->getOutputData();
+ auto leftData = handle->mDfsAdaptor->getLeftData();
+ mv_source_fill_by_buffer(handle->mInternalSource,
+ static_cast<unsigned char*>(leftData.data),
+ leftData.width,
+ leftData.height,
+ leftData.stride * leftData.height,
+ leftData.type == DFS_DATA_TYPE_UINT8C3 ? MEDIA_VISION_COLORSPACE_RGB888 :
+ MEDIA_VISION_COLORSPACE_Y800);
handle->mDepthCallback(
- static_cast<mv_source_h>(base),
+ static_cast<mv_source_h>(handle->mInternalSource),
static_cast<DepthTypePtr>(depthData.data),
depthData.width, depthData.height,
handle->mDepthUserData);
handle->GetPointcloudFromSource(*input, depthData, p);
mv_3d_pointcloud_h pcd = &p;
- handle->mPointcloudCallback(static_cast<mv_source_h>(base),
+ handle->mPointcloudCallback(static_cast<mv_source_h>(mInternalSource),
pcd,
handle->mPointcloudUserData);
auto pPcd = static_cast<std::shared_ptr<open3d::geometry::PointCloud>*>(p.pointcloud);
#endif
delete [] static_cast<unsigned char*>(input->data);
delete [] static_cast<unsigned char*>(input->extraData);
+ mv_source_clear(handle->mInternalSource);
input.reset();
}