how to enumerate video devices

Hey everyone! Thanks for reading my post and for all the help.

I’m trying to run a program that has two camera inputs (going into a port hub and then into my laptop). I believe my machine dynamically sets a device ID for each camera every time I compile/run the code. Because of this I don’t know in advance what device ID I need to be setting my cameras to.

Ideally it would be good if when the code runs, it finds all the devices and asks me to choose which ones I want to use.

I’ve started to make interface this by using the ofVideoGrabber.listDevices() method which outputs this (I think):

Setting alt to 0, (with packet-size = 0), return is 0
Checking pipe status, return is 0
Checking pipe properties, return is 0
pipe 1: IN 1 ISOC 0 1
a = 0, nextAlt = -1, PS[a] = 0
a = 1, nextAlt = -1, PS[a] = 0
a = 2, nextAlt = -1, PS[a] = 0
a = 3, nextAlt = -1, PS[a] = 0
a = 4, nextAlt = -1, PS[a] = 0
usbMaximizeBandwidth: no more interfaces to try!

I don’t get what this means or how to use this to make the interface that I want.

Any help would be greatly appreciated :slight_smile:

Thanks again

this is already planned for the next release, the idea is that every listDevices function/method returns a list of the available devices instead of just printing them to console but right now you need to start the application see what devices are available and then put that in your code or settings file.

Thanks for the quick response Arturo.

It’s good to hear that this will be taken care of in the next release. In the meantime, could you give me some advice on how to read the output. I can’t tell what’s what in the code.

For example, how do I know what number to set the Devices to looking at this code?

Setting alt to 0, (with packet-size = 0), return is 0
Checking pipe status, return is 0
Checking pipe properties, return is 0
pipe 1: IN 1 ISOC 0 1
a = 0, nextAlt = -1, PS[a] = 0
a = 1, nextAlt = -1, PS[a] = 0
a = 2, nextAlt = -1, PS[a] = 0
a = 3, nextAlt = -1, PS[a] = 0
a = 4, nextAlt = -1, PS[a] = 0
usbMaximizeBandwidth: no more interfaces to try!

Thanks again,

Eric

hi

don’t have a “nice” code snippet, but I have some C++ code that works,
and populates 2 CComboBoxes (1 for audio & 1 for video) and initializes
them to the DV device, if present. It’s part of a CDialog class, and
uses various member variables, etc, so it won’t just compile & run, and
you’ll have to figure out what the various parameters are, but it might
give you an idea. It also uses a template function, because you need to
iterate through two essentially identical classes – one that’s for
internal sources, and one that’s for external DV devices…

Thanks!

I actually got this issue resolved. I put the answer in another post though:

http://forum.openframeworks.cc/t/listing-devices—multi-cam-project/3311/0