Cross platform access to video device info?

I’m creating a program to do automatic multi-camera, realtime documentation. A really nice feature I’ve got right now is the ability to detect an arbitrary number of cameras and use them all at once without changing the code to reflect the number of cameras plugged in. You just plug in your cameras and start the program.

I had to hack ofVideoGrabber in order to get access to the info because normally listDevices() just prints to the console.

I’m using linux with the gstreamer video grabber on Karmic, so I hacked the specific code for me: ofGstUtils. I simple moved ofGstCamData camData; to be public instead of protected and called gst.listDevices to populate the structure. Now camData has all of the devices and all of the info, names etc.

At the most basic level all I really need is a cross platform way of detecting the number of video devices. I don’t really need to know the names of each device for now.

As far as I can see there isn’t any existing way to do this. I was thinking maybe somehow hijacking the listDevices() output and counting the times i see a return character, But then there is the added problem that not all listDevices() are created equal; the info may be different on different platforms.

I’d like this program to be cross platform as I have a few people who would like to use it and they’re on windows and mac.

yes, we’ve been thinking about something like this, also for serial devices. will give it a try, perhaps we can implement it for the next version that is going to be released soon