From fc0e8afb25c6fa32f299e8c7318c3bd2411673c9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 31 May 2015 18:58:14 +0200 Subject: put camera name list in header, don't copy-paste --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 73 +-------------------------- 1 file changed, 1 insertion(+), 72 deletions(-) (limited to 'ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index d7ceb8a6..a6394b71 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -15,78 +15,7 @@ #include "opentrack/plugin-api.hpp" #include #include - -#if defined(_WIN32) -# undef NOMINMAX -# define NOMINMAX -# define NO_DSHOW_STRSAFE -# include -#else -# include -#endif - -// delicious copypasta -static QList get_camera_names(void) { - QList ret; -#if defined(_WIN32) - // Create the System Device Enumerator. - HRESULT hr; - ICreateDevEnum *pSysDevEnum = NULL; - hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum); - if (FAILED(hr)) - { - return ret; - } - // Obtain a class enumerator for the video compressor category. - IEnumMoniker *pEnumCat = NULL; - hr = pSysDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnumCat, 0); - - if (hr == S_OK) { - // Enumerate the monikers. - IMoniker *pMoniker = NULL; - ULONG cFetched; - while (pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK) { - IPropertyBag *pPropBag; - hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropBag); - if (SUCCEEDED(hr)) { - // To retrieve the filter's friendly name, do the following: - VARIANT varName; - VariantInit(&varName); - hr = pPropBag->Read(L"FriendlyName", &varName, 0); - if (SUCCEEDED(hr)) - { - // Display the name in your UI somehow. - QString str((QChar*)varName.bstrVal, wcslen(varName.bstrVal)); - ret.append(str); - } - VariantClear(&varName); - - ////// To create an instance of the filter, do the following: - ////IBaseFilter *pFilter; - ////hr = pMoniker->BindToObject(NULL, NULL, IID_IBaseFilter, - //// (void**)&pFilter); - // Now add the filter to the graph. - //Remember to release pFilter later. - pPropBag->Release(); - } - pMoniker->Release(); - } - pEnumCat->Release(); - } - pSysDevEnum->Release(); -#else - for (int i = 0; i < 16; i++) { - char buf[128]; - sprintf(buf, "/dev/video%d", i); - if (access(buf, R_OK | W_OK) == 0) { - ret.append(buf); - } else { - continue; - } - } -#endif - return ret; -} +#include "opentrack/camera-names.hpp" typedef struct { int width; -- cgit v1.2.3