Find cam by device name instead of id when using ofVideoGrabber

ofxApp.cpp:

string deviceName = "Logitech Camera";
vector<ofVideoDevice> devices = vidGrabber.listDevices();

for(vector<ofVideoDevice>::iterator it = devices.begin(); it != devices.end(); ++it) {
    if(it->deviceName == deviceName) {
        vidGrabber.setDeviceID(it->id);
        break;
    }
}

Tested with openFrameworks 0.8.0

Reference

Date: 2013-08-15 | Tags: openFrameworks, Video