Go to the documentation of this file.00001 #ifndef SHARED_H
00002 #define SHARED_H
00003
00004 #include "CaptureFactory.h"
00005
00006 using namespace alvar;
00007
00008 void outputEnumeratedPlugins(CaptureFactory::CapturePluginVector &plugins)
00009 {
00010 for (int i = 0; i < (int)plugins.size(); ++i) {
00011 if (i != 0) {
00012 std::cout << ", ";
00013 }
00014 std::cout << plugins.at(i);
00015 }
00016
00017 std::cout << std::endl;
00018 }
00019
00020 void outputEnumeratedDevices(CaptureFactory::CaptureDeviceVector &devices, int selectedDevice)
00021 {
00022 for (int i = 0; i < (int)devices.size(); ++i) {
00023 if (selectedDevice == i) {
00024 std::cout << "* ";
00025 }
00026 else {
00027 std::cout << " ";
00028 }
00029
00030 std::cout << i << ": " << devices.at(i).uniqueName();
00031
00032 if (devices[i].description().length() > 0) {
00033 std::cout << ", " << devices.at(i).description();
00034 }
00035
00036 std::cout << std::endl;
00037 }
00038 }
00039
00040 int defaultDevice(CaptureFactory::CaptureDeviceVector &devices)
00041 {
00042 for (int i = 0; i < (int)devices.size(); ++i) {
00043 if (devices.at(i).captureType() == "highgui") {
00044 return i;
00045 }
00046 }
00047
00048 return 0;
00049 }
00050
00051 #endif