Cannot get reference to Pipeline for already started device

I am unable to get a reference to a pipeline for a device in my application. When my software loads it queries the Context for all cameras connected to the system. This causes the SDK to automatically create a Pipeline for the first connected Orbbec device.

Since a Pipeline has already been created for the first device, if I try and later use the camera I am unable to start the Pipeline again and it shows an error (“Trying to create a device that you’ve already created!”).

I am trying to find anywhere that I can get a reference to this already created Pipeline using the Context.QueryDeviceList or any Device or DeviceInfo derived from this list, but I have had little luck so far.

Can anyone help?

-Curt

You can create a global/private pipeline which will keep your program remain one pipeline instance.
You can initialize your pipeline as following.
std::shared_ptr ob::Pipeline pipeline = std::make_sharedob::Pipeline();

Hi Bruce,

Thanks for the reply.

My software needs a list of all cameras connected to the computer so that my users can select the correct camera before I start grabbing frames. There are also instances where multiple cameras can be used. Should I be iterating through all potential devices to create a reference to any pipelines ahead of using the Context to get a list of cameras on the system so that my users can select them?

It would be nice if when trying to create a Pipeline that already exists it would return a reference to the already created pipeline instead of just an error.

Thanks
-Curt

You can refer to our sample code - Sample-MultiDevice to query all the connected Orbbec cameras and use the same pipeline to open each one of them.