So what I need is something like capture devices list.
And some function to get from user on which device he wants to stream.
How to do such thing with open
Not directly supported in opencv (AFAIK) but try http://www.muonics.net/school/spring05/videoInput/
Try using some OS functions to enumerate webcams. It might take some work, but this approach will guarantee that you get a list every time (unlike the OpenCV hack, which sometimes doesn't work, for some reason).
As Martin said it's not supported in OpenCV but you could use a little trick. If that satisfies your needs, you can find out the number of cameras by successively enumerating the cameras by calling cvCreateCameraCapture()
until it returns NULL.
Sth like this:
CvCapture *cap;
int n = 0;
while(1)
{
cap = cvCreateCameraCapture(n++);
if (cap == NULL) break;
cvReleaseCapture(&cap);
}
cvReleaseCapture(&cap);
return n-1;
Now you have a number of camera devices so you can let your user to select one by its index from i.e. list box.
Disadvantage is that OpenCV doesn't give you any information about device name so if you want to accomplish that too you should take a look at Microsoft DirectShow or the library Martin proposed.