Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/video/capture/win/video_capture_device_win.h" | 5 #include "media/video/capture/win/video_capture_device_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 | 170 |
| 171 } // namespace | 171 } // namespace |
| 172 | 172 |
| 173 namespace media { | 173 namespace media { |
| 174 | 174 |
| 175 // Name of a fake DirectShow filter that exist on computers with | 175 // Name of a fake DirectShow filter that exist on computers with |
| 176 // GTalk installed. | 176 // GTalk installed. |
| 177 static const char kGoogleCameraAdapter[] = "google camera adapter"; | 177 static const char kGoogleCameraAdapter[] = "google camera adapter"; |
| 178 | 178 |
| 179 // Gets the names of all video capture devices connected to this computer. | 179 // Gets the names of all video capture devices connected to this computer. |
| 180 // This API can only be run on a COM thread. | |
|
mflodman_chromium_OOO
2012/06/29 14:46:04
'a COM thread.' -> 'a COM initialized thread.' ?
| |
| 180 void VideoCaptureDevice::GetDeviceNames(Names* device_names) { | 181 void VideoCaptureDevice::GetDeviceNames(Names* device_names) { |
| 181 DCHECK(device_names); | 182 DCHECK(device_names); |
| 182 | 183 |
| 183 base::win::ScopedCOMInitializer coinit; | |
| 184 ScopedComPtr<ICreateDevEnum> dev_enum; | 184 ScopedComPtr<ICreateDevEnum> dev_enum; |
| 185 HRESULT hr = dev_enum.CreateInstance(CLSID_SystemDeviceEnum, NULL, | 185 HRESULT hr = dev_enum.CreateInstance(CLSID_SystemDeviceEnum, NULL, |
| 186 CLSCTX_INPROC); | 186 CLSCTX_INPROC); |
| 187 if (FAILED(hr)) | 187 if (FAILED(hr)) |
| 188 return; | 188 return; |
| 189 | 189 |
| 190 ScopedComPtr<IEnumMoniker> enum_moniker; | 190 ScopedComPtr<IEnumMoniker> enum_moniker; |
| 191 hr = dev_enum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, | 191 hr = dev_enum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, |
| 192 enum_moniker.Receive(), 0); | 192 enum_moniker.Receive(), 0); |
| 193 // CreateClassEnumerator returns S_FALSE on some Windows OS | 193 // CreateClassEnumerator returns S_FALSE on some Windows OS |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 return diff_list.front().capability_index; | 652 return diff_list.front().capability_index; |
| 653 } | 653 } |
| 654 | 654 |
| 655 void VideoCaptureDeviceWin::SetErrorState(const char* reason) { | 655 void VideoCaptureDeviceWin::SetErrorState(const char* reason) { |
| 656 DVLOG(1) << reason; | 656 DVLOG(1) << reason; |
| 657 state_ = kError; | 657 state_ = kError; |
| 658 observer_->OnError(); | 658 observer_->OnError(); |
| 659 } | 659 } |
| 660 | 660 |
| 661 } // namespace media | 661 } // namespace media |
| OLD | NEW |