fix(api): remove enable LEFT/RIGHT stream code

This commit is contained in:
TinyOh 2019-03-02 12:46:17 +08:00
parent 469ffe5075
commit c9bfdbb4d6
12 changed files with 11 additions and 22 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -180,6 +180,9 @@ void Synthetic::EnableStreamData(
auto processor = getProcessorWithStream(stream);
iterate_processor_CtoP_before(processor,
[callback, try_tag](std::shared_ptr<Processor> 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<Processor> proce){
if (proce->Name() == "RootProcessor") {
return;
}
auto streams = proce->getTargetStreams();
int act_tag = 0;
for (unsigned int i = 0; i < proce->getStreamsSum() ; i++) {

View File

@ -138,7 +138,7 @@ class Synthetic {
API *api_;
std::shared_ptr<RootProcessor> processor_;
std::vector<std::shared_ptr<Processor>> processors_;
std::shared_ptr<Plugin> plugin_;
CalibrationModel calib_model_;
@ -148,8 +148,6 @@ class Synthetic {
std::shared_ptr<Extrinsics> extr_;
bool calib_default_tag_;
std::vector<std::shared_ptr<Processor>> processors_;
stream_data_listener_t stream_data_listener_;
};