| 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 <ks.h> | 7 #include <ks.h> |
| 8 #include <ksmedia.h> | 8 #include <ksmedia.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // available first. | 86 // available first. |
| 87 static const wchar_t* kPropertyNames[] = { | 87 static const wchar_t* kPropertyNames[] = { |
| 88 L"DevicePath", L"Description", L"FriendlyName" | 88 L"DevicePath", L"Description", L"FriendlyName" |
| 89 }; | 89 }; |
| 90 ScopedVariant name; | 90 ScopedVariant name; |
| 91 for (size_t i = 0; | 91 for (size_t i = 0; |
| 92 i < arraysize(kPropertyNames) && name.type() != VT_BSTR; ++i) { | 92 i < arraysize(kPropertyNames) && name.type() != VT_BSTR; ++i) { |
| 93 prop_bag->Read(kPropertyNames[i], name.Receive(), 0); | 93 prop_bag->Read(kPropertyNames[i], name.Receive(), 0); |
| 94 } | 94 } |
| 95 if (name.type() == VT_BSTR) { | 95 if (name.type() == VT_BSTR) { |
| 96 std::string device_path(base::SysWideToUTF8(V_BSTR(&name))); | 96 std::string device_path(base::SysWideToUTF8(V_BSTR(name.ptr()))); |
| 97 if (device_path.compare(device_id) == 0) { | 97 if (device_path.compare(device_id) == 0) { |
| 98 // We have found the requested device | 98 // We have found the requested device |
| 99 hr = moniker->BindToObject(0, 0, IID_IBaseFilter, | 99 hr = moniker->BindToObject(0, 0, IID_IBaseFilter, |
| 100 capture_filter.ReceiveVoid()); | 100 capture_filter.ReceiveVoid()); |
| 101 DLOG_IF(ERROR, FAILED(hr)) << "Failed to bind camera filter: " | 101 DLOG_IF(ERROR, FAILED(hr)) << "Failed to bind camera filter: " |
| 102 << logging::SystemErrorCodeToString(hr); | 102 << logging::SystemErrorCodeToString(hr); |
| 103 break; | 103 break; |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 moniker.Release(); | 106 moniker.Release(); |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 return E_FAIL; | 612 return E_FAIL; |
| 613 return S_OK; | 613 return S_OK; |
| 614 } | 614 } |
| 615 | 615 |
| 616 void VideoCaptureDeviceWin::SetErrorState(const std::string& reason) { | 616 void VideoCaptureDeviceWin::SetErrorState(const std::string& reason) { |
| 617 DCHECK(CalledOnValidThread()); | 617 DCHECK(CalledOnValidThread()); |
| 618 state_ = kError; | 618 state_ = kError; |
| 619 client_->OnError(reason); | 619 client_->OnError(reason); |
| 620 } | 620 } |
| 621 } // namespace media | 621 } // namespace media |
| OLD | NEW |