Selecting Camera
Is it possible to enlist all the camera's connected to the System along with their physical address?
I am not inclined to a开发者_JAVA技巧ny particular language, though I prefer C#.
Thanks for help.
Since you mention C#, I'm going to assume you mean on Windows.
From Windows viewpoint, still cameras are almost completely different sorts of things from video cameras (but, interestingly enough, still cameras and scanners are almost the same).
Since you don't mention video, I'm going to also guess you mean still cameras. You normally deal with still cameras (and scanners) via Windows Image Acquisition (WIA). To list cameras, you'd normally use IStillImage::GetDeviceList
. This will return a STI_DEVICE_INFORMATION
structure, which includes a dwHardwareConfiguration
member to tell you the type of interface used (e.g., USB) and pszPortName
to identify the specific port to which the camera is attached.
If you want to trace back from that port name to something more "physical", such as the bus number and such, you should (probably) be able to use WMI_USBControllerDevice to map from the device back to the controller.
If you want to deal with video cameras, you'd use capGetDriverDescription
to get a description of each video capture device that's installed. In this case, getting something closer to a "physical" address is considerably more difficult. capGetDriverDescription
will give you a driver name. I suppose you can do the usual Windows "stuff" to enumerate drivers and match up names to find out something about the driver in question, but I haven't played with that to be sure (for example) which name it gives you (the internal driver name, the display name, or what).
Also note that MS has developed about a half dozen different multimedia interfaces over time, so almost any multimedia cat can be skinned at least a half dozen different ways.
精彩评论