61 std::vector<std::string> result;
64 IBaseFilter *p_base_filter = NULL;
65 IMoniker *p_moniker = NULL;
70 ICreateDevEnum *p_dev_enum = NULL;
72 hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC, IID_ICreateDevEnum, (
void **)&p_dev_enum);
80 IEnumMoniker *p_class_enum = NULL;
81 hr = p_dev_enum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &p_class_enum, 0);
83 p_dev_enum->Release();
91 if (p_class_enum == NULL)
104 while (p_class_enum->Next(1, &p_moniker, &i_fetched) == S_OK)
108 hr = p_moniker->BindToStorage(0, 0, IID_IPropertyBag, (
void **)&p_bag);
113 hr = p_bag->Read(L
"FriendlyName", &var, NULL);
118 int i_convert = WideCharToMultiByte(CP_ACP, 0, var.bstrVal, SysStringLen(var.bstrVal), NULL, 0, NULL, NULL);
119 char *p_buf = (
char *)malloc(i_convert + 1);
122 WideCharToMultiByte(CP_ACP, 0, var.bstrVal, SysStringLen(var.bstrVal), p_buf, i_convert, NULL, NULL);
123 SysFreeString(var.bstrVal);
124 p_buf[i_convert] =
'\0';
126 result.push_back(std::string(p_buf));
132 p_moniker->Release();
135 p_class_enum->Release();
137#elif SCOL_CAMERA_OPENCV
139 int cameraNumber = 0;
140 cv::VideoCapture temp_camera;
142 for (
int i = 0; i < 128; i++)
144 cv::VideoCapture temp_camera(i);
145 if (temp_camera.isOpened())
148 sprintf(buffer,
"cam%d", cameraNumber);
149 result.push_back(buffer);
152 else if (temp_camera.open(i))
155 sprintf(buffer,
"cam%d", cameraNumber);
156 result.push_back(buffer);
158 temp_camera.release();
166 int cameraNumber = 0;
167 android_app* app = (
struct android_app*)SCgetExtra(
"this_inst");
169 app->activity->vm->AttachCurrentThread(&env, NULL);
171 jclass camera_class = env->FindClass(
"android/hardware/Camera");
172 jmethodID getNumberOfCameras_method = env->GetStaticMethodID(camera_class,
"getNumberOfCameras",
"()I");
173 cameraNumber = env->CallStaticIntMethod(camera_class, getNumberOfCameras_method);
175 if (cameraNumber <= 0)
177 result.push_back(
"no camera available on this device");
181 for (
int i = 0; i < cameraNumber; i++)
184 sprintf(buffer,
"cam%d", i);
185 result.push_back(buffer);
189 env->DeleteLocalRef(camera_class);
190 app->activity->vm->DetachCurrentThread();