From c9bfdbb4d642e24acdeedca195684267122dfec6 Mon Sep 17 00:00:00 2001 From: TinyOh Date: Sat, 2 Mar 2019 12:46:17 +0800 Subject: [PATCH] fix(api): remove enable LEFT/RIGHT stream code --- samples/tutorials/control/auto_exposure.cc | 2 -- samples/tutorials/control/framerate.cc | 2 -- samples/tutorials/control/imu_low_pass_filter.cc | 2 -- samples/tutorials/control/imu_range.cc | 2 -- samples/tutorials/control/infrared.cc | 2 -- samples/tutorials/control/manual_exposure.cc | 2 -- samples/tutorials/data/get_imu.cc | 2 -- samples/tutorials/data/get_imu_correspondence.cc | 2 -- samples/tutorials/data/get_stereo.cc | 2 -- src/mynteye/api/processor/root_camera_processor.cc | 5 ++++- src/mynteye/api/synthetic.cc | 6 ++++++ src/mynteye/api/synthetic.h | 4 +--- 12 files changed, 11 insertions(+), 22 deletions(-) diff --git a/samples/tutorials/control/auto_exposure.cc b/samples/tutorials/control/auto_exposure.cc index 258504f..cabe6ad 100644 --- a/samples/tutorials/control/auto_exposure.cc +++ b/samples/tutorials/control/auto_exposure.cc @@ -28,8 +28,6 @@ int main(int argc, char *argv[]) { bool ok; auto &&request = api->SelectStreamRequest(&ok); if (!ok) return 1; - api->EnableStreamData(Stream::LEFT); - api->EnableStreamData(Stream::RIGHT); api->ConfigStreamRequest(request); Model model = api->GetModel(); diff --git a/samples/tutorials/control/framerate.cc b/samples/tutorials/control/framerate.cc index faa1aec..41f1e5d 100644 --- a/samples/tutorials/control/framerate.cc +++ b/samples/tutorials/control/framerate.cc @@ -28,8 +28,6 @@ int main(int argc, char *argv[]) { bool ok; auto &&request = api->SelectStreamRequest(&ok); if (!ok) return 1; - api->EnableStreamData(Stream::LEFT); - api->EnableStreamData(Stream::RIGHT); api->ConfigStreamRequest(request); Model model = api->GetModel(); diff --git a/samples/tutorials/control/imu_low_pass_filter.cc b/samples/tutorials/control/imu_low_pass_filter.cc index f0119f2..88e71b8 100644 --- a/samples/tutorials/control/imu_low_pass_filter.cc +++ b/samples/tutorials/control/imu_low_pass_filter.cc @@ -28,8 +28,6 @@ int main(int argc, char *argv[]) { bool ok; auto &&request = api->SelectStreamRequest(&ok); if (!ok) return 1; - api->EnableStreamData(Stream::LEFT); - api->EnableStreamData(Stream::RIGHT); api->ConfigStreamRequest(request); Model model = api->GetModel(); diff --git a/samples/tutorials/control/imu_range.cc b/samples/tutorials/control/imu_range.cc index e6edecf..1431b20 100644 --- a/samples/tutorials/control/imu_range.cc +++ b/samples/tutorials/control/imu_range.cc @@ -28,8 +28,6 @@ int main(int argc, char *argv[]) { bool ok; auto &&request = api->SelectStreamRequest(&ok); if (!ok) return 1; - api->EnableStreamData(Stream::LEFT); - api->EnableStreamData(Stream::RIGHT); api->ConfigStreamRequest(request); Model model = api->GetModel(); diff --git a/samples/tutorials/control/infrared.cc b/samples/tutorials/control/infrared.cc index b44d49d..c261e7a 100644 --- a/samples/tutorials/control/infrared.cc +++ b/samples/tutorials/control/infrared.cc @@ -25,8 +25,6 @@ int main(int argc, char *argv[]) { bool ok; auto &&request = api->SelectStreamRequest(&ok); if (!ok) return 1; - api->EnableStreamData(Stream::LEFT); - api->EnableStreamData(Stream::RIGHT); api->ConfigStreamRequest(request); Model model = api->GetModel(); diff --git a/samples/tutorials/control/manual_exposure.cc b/samples/tutorials/control/manual_exposure.cc index b1ca5c5..2761f58 100644 --- a/samples/tutorials/control/manual_exposure.cc +++ b/samples/tutorials/control/manual_exposure.cc @@ -28,8 +28,6 @@ int main(int argc, char *argv[]) { bool ok; auto &&request = api->SelectStreamRequest(&ok); if (!ok) return 1; - api->EnableStreamData(Stream::LEFT); - api->EnableStreamData(Stream::RIGHT); api->ConfigStreamRequest(request); Model model = api->GetModel(); diff --git a/samples/tutorials/data/get_imu.cc b/samples/tutorials/data/get_imu.cc index 26d4653..c09d225 100644 --- a/samples/tutorials/data/get_imu.cc +++ b/samples/tutorials/data/get_imu.cc @@ -28,8 +28,6 @@ int main(int argc, char *argv[]) { auto &&request = api->SelectStreamRequest(&ok); if (!ok) return 1; api->ConfigStreamRequest(request); - api->EnableStreamData(Stream::LEFT); - api->EnableStreamData(Stream::RIGHT); // Enable this will cache the motion datas until you get them. api->EnableMotionDatas(); diff --git a/samples/tutorials/data/get_imu_correspondence.cc b/samples/tutorials/data/get_imu_correspondence.cc index def7ba8..9cec957 100644 --- a/samples/tutorials/data/get_imu_correspondence.cc +++ b/samples/tutorials/data/get_imu_correspondence.cc @@ -30,8 +30,6 @@ int main(int argc, char *argv[]) { api->ConfigStreamRequest(request); // Enable motion datas with timestamp correspondence of some stream - api->EnableStreamData(Stream::LEFT); - api->EnableStreamData(Stream::RIGHT); api->EnableTimestampCorrespondence(Stream::LEFT); api->Start(Source::ALL); diff --git a/samples/tutorials/data/get_stereo.cc b/samples/tutorials/data/get_stereo.cc index 5f114c0..1dd024a 100644 --- a/samples/tutorials/data/get_stereo.cc +++ b/samples/tutorials/data/get_stereo.cc @@ -25,8 +25,6 @@ int main(int argc, char *argv[]) { auto &&request = api->SelectStreamRequest(&ok); if (!ok) return 1; api->ConfigStreamRequest(request); - api->EnableStreamData(Stream::LEFT); - api->EnableStreamData(Stream::RIGHT); api->Start(Source::VIDEO_STREAMING); diff --git a/src/mynteye/api/processor/root_camera_processor.cc b/src/mynteye/api/processor/root_camera_processor.cc index 75fca23..a802b3a 100644 --- a/src/mynteye/api/processor/root_camera_processor.cc +++ b/src/mynteye/api/processor/root_camera_processor.cc @@ -79,10 +79,12 @@ void s1s2Processor::ProcessNativeStream( } void s1s2Processor::StartVideoStreaming() { + Activate(); auto streams = getTargetStreams(); for (unsigned int j =0; j< streams.size(); j++) { auto stream = streams[j].stream; auto callback = streams[j].stream_callback; + target_streams_[j].enabled_mode_ = Synthetic::MODE_ON; device_->SetStreamCallback( stream, [this, stream, callback](const device::StreamData &data) { @@ -99,14 +101,15 @@ void s1s2Processor::StartVideoStreaming() { } void s1s2Processor::StopVideoStreaming() { + Deactivate(); auto streams = getTargetStreams(); for (unsigned int j =0; j< streams.size(); j++) { auto stream = streams[j].stream; + target_streams_[j].enabled_mode_ = Synthetic::MODE_OFF; device_->SetStreamCallback(stream, nullptr); } device_->Stop(Source::VIDEO_STREAMING); } - api::StreamData s1s2Processor::GetStreamData(const Stream &stream) { Synthetic::Mode enable_mode = Synthetic::MODE_OFF; auto streams = getTargetStreams(); diff --git a/src/mynteye/api/synthetic.cc b/src/mynteye/api/synthetic.cc index c34fe4b..b9a5401 100644 --- a/src/mynteye/api/synthetic.cc +++ b/src/mynteye/api/synthetic.cc @@ -180,6 +180,9 @@ void Synthetic::EnableStreamData( auto processor = getProcessorWithStream(stream); iterate_processor_CtoP_before(processor, [callback, try_tag](std::shared_ptr proce){ + if (proce->Name() == "RootProcessor") { + return; + } auto streams = proce->getTargetStreams(); int act_tag = 0; for (unsigned int i = 0; i < proce->getStreamsSum() ; i++) { @@ -203,6 +206,9 @@ void Synthetic::DisableStreamData( auto processor = getProcessorWithStream(stream); iterate_processor_PtoC_before(processor, [callback, try_tag](std::shared_ptr proce){ + if (proce->Name() == "RootProcessor") { + return; + } auto streams = proce->getTargetStreams(); int act_tag = 0; for (unsigned int i = 0; i < proce->getStreamsSum() ; i++) { diff --git a/src/mynteye/api/synthetic.h b/src/mynteye/api/synthetic.h index bb2d86c..dc44a4e 100644 --- a/src/mynteye/api/synthetic.h +++ b/src/mynteye/api/synthetic.h @@ -138,7 +138,7 @@ class Synthetic { API *api_; std::shared_ptr processor_; - + std::vector> processors_; std::shared_ptr plugin_; CalibrationModel calib_model_; @@ -148,8 +148,6 @@ class Synthetic { std::shared_ptr extr_; bool calib_default_tag_; - std::vector> processors_; - stream_data_listener_t stream_data_listener_; };