Changeset 48600 in vbox for trunk/src/VBox/Main
- Timestamp:
- Sep 20, 2013 2:30:46 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 89166
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Makefile.kmk
r48578 r48600 304 304 $(PATH_STAGE_LIB)/SSMStandalone$(VBOX_SUFF_LIB) \ 305 305 $(LIB_DDU) 306 VBoxSVC_LIBS.win += strmiids.lib 306 307 VBoxSVC_SDKS = VBOX_LIBPNG VBOX_ZLIB 307 308 VBoxSVC_LIBS.solaris = \ -
trunk/src/VBox/Main/include/HostVideoCaptureDeviceImpl.h
r48589 r48600 40 40 41 41 /* Public initializer/uninitializer for internal purposes only. */ 42 HRESULT init(co m::Utf8Str name, com::Utf8Str path, com::Utf8Stralias);42 HRESULT init(const com::Utf8Str &name, const com::Utf8Str &path, const com::Utf8Str &alias); 43 43 void uninit(); 44 44 -
trunk/src/VBox/Main/src-server/HostVideoCaptureDeviceImpl.cpp
r48578 r48600 20 20 #include "Logging.h" 21 21 22 #ifdef RT_OS_WINDOWS 23 #include <dshow.h> 24 #endif 25 22 26 /* 23 27 * HostVideoCaptureDevice implementation. … … 40 44 * Initializes the instance. 41 45 */ 42 HRESULT HostVideoCaptureDevice::init(co m::Utf8Str name, com::Utf8Str path, com::Utf8Stralias)46 HRESULT HostVideoCaptureDevice::init(const com::Utf8Str &name, const com::Utf8Str &path, const com::Utf8Str &alias) 43 47 { 44 48 LogFlowThisFunc(("\n")); … … 76 80 } 77 81 82 static HRESULT hostVideoCaptureDeviceAdd(HostVideoCaptureDeviceList *pList, 83 const com::Utf8Str &name, 84 const com::Utf8Str &path, 85 const com::Utf8Str &alias) 86 { 87 ComObjPtr<HostVideoCaptureDevice> obj; 88 HRESULT hr = obj.createObject(); 89 if (SUCCEEDED(hr)) 90 { 91 hr = obj->init(name, path, alias); 92 if (SUCCEEDED(hr)) 93 pList->push_back(obj); 94 } 95 return hr; 96 } 97 98 #ifdef RT_OS_WINDOWS 99 static HRESULT hvcdCreateEnumerator(IEnumMoniker **ppEnumMoniker) 100 { 101 ICreateDevEnum *pCreateDevEnum = NULL; 102 HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, 103 IID_PPV_ARGS(&pCreateDevEnum)); 104 if (SUCCEEDED(hr)) 105 { 106 hr = pCreateDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, ppEnumMoniker, 0); 107 pCreateDevEnum->Release(); 108 } 109 return hr; 110 } 111 112 static HRESULT hvcdFillList(HostVideoCaptureDeviceList *pList, IEnumMoniker *pEnumMoniker) 113 { 114 int iDevice = 0; 115 IMoniker *pMoniker = NULL; 116 while (pEnumMoniker->Next(1, &pMoniker, NULL) == S_OK) 117 { 118 IPropertyBag *pPropBag = NULL; 119 HRESULT hr = pMoniker->BindToStorage(0, 0, IID_PPV_ARGS(&pPropBag)); 120 if (FAILED(hr)) 121 { 122 pMoniker->Release(); 123 continue; 124 } 125 126 VARIANT var; 127 VariantInit(&var); 128 129 hr = pPropBag->Read(L"DevicePath", &var, 0); 130 if (FAILED(hr)) 131 { 132 /* Can't use a device without path. */ 133 pMoniker->Release(); 134 continue; 135 } 136 137 ++iDevice; 138 139 com::Utf8Str path = var.bstrVal; 140 VariantClear(&var); 141 142 hr = pPropBag->Read(L"FriendlyName", &var, 0); 143 if (FAILED(hr)) 144 { 145 hr = pPropBag->Read(L"Description", &var, 0); 146 } 147 148 com::Utf8Str name; 149 if (SUCCEEDED(hr)) 150 { 151 name = var.bstrVal; 152 VariantClear(&var); 153 } 154 else 155 { 156 name = com::Utf8StrFmt("Video Input Device #%d", iDevice); 157 } 158 159 com::Utf8Str alias = com::Utf8StrFmt(".%d", iDevice); 160 161 hr = hostVideoCaptureDeviceAdd(pList, name, path, alias); 162 163 pPropBag->Release(); 164 pMoniker->Release(); 165 166 if (FAILED(hr)) 167 return hr; 168 } 169 170 return S_OK; 171 } 172 173 static HRESULT fillDeviceList(HostVideoCaptureDeviceList *pList) 174 { 175 IEnumMoniker *pEnumMoniker = NULL; 176 HRESULT hr = hvcdCreateEnumerator(&pEnumMoniker); 177 if (SUCCEEDED(hr)) 178 { 179 if (hr != S_FALSE) 180 { 181 /* List not empty */ 182 hr = hvcdFillList(pList, pEnumMoniker); 183 pEnumMoniker->Release(); 184 } 185 else 186 { 187 hr = S_OK; /* Return empty list. */ 188 } 189 } 190 return hr; 191 } 192 #else 193 static HRESULT fillDeviceList(HostVideoCaptureDeviceList *pList) 194 { 195 NOREF(pList); 196 return E_NOTIMPL; 197 } 198 #endif /* RT_OS_WINDOWS */ 199 78 200 /* static */ HRESULT HostVideoCaptureDevice::queryHostDevices(HostVideoCaptureDeviceList *pList) 79 201 { 80 HRESULT hr = S_OK; 81 #if 0 82 PDARWINETHERNIC pEtherNICs = DarwinGetEthernetControllers(); 83 while (pEtherNICs) 84 { 85 ComObjPtr<HostNetworkInterface> IfObj; 86 IfObj.createObject(); 87 if (SUCCEEDED(IfObj->init(Bstr(pEtherNICs->szName), Guid(pEtherNICs->Uuid), HostNetworkInterfaceType_Bridged))) 88 list.push_back(IfObj); 89 90 /* next, free current */ 91 void *pvFree = pEtherNICs; 92 pEtherNICs = pEtherNICs->pNext; 93 RTMemFree(pvFree); 94 } 95 #endif 202 HRESULT hr = fillDeviceList(pList); 203 204 if (FAILED(hr)) 205 { 206 pList->clear(); 207 } 208 96 209 return hr; 97 210 }
Note:
See TracChangeset
for help on using the changeset viewer.