| 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_mf_win.h" | 5 #include "media/video/capture/win/video_capture_device_mf_win.h" |
| 6 | 6 |
| 7 #include <mfapi.h> | 7 #include <mfapi.h> |
| 8 #include <mferror.h> | 8 #include <mferror.h> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 HRESULT hr; | 261 HRESULT hr; |
| 262 for (UINT32 i = 0; i < count; ++i) { | 262 for (UINT32 i = 0; i < count; ++i) { |
| 263 UINT32 name_size, id_size; | 263 UINT32 name_size, id_size; |
| 264 ScopedCoMem<wchar_t> name, id; | 264 ScopedCoMem<wchar_t> name, id; |
| 265 if (SUCCEEDED(hr = devices[i]->GetAllocatedString( | 265 if (SUCCEEDED(hr = devices[i]->GetAllocatedString( |
| 266 MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME, &name, &name_size)) && | 266 MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME, &name, &name_size)) && |
| 267 SUCCEEDED(hr = devices[i]->GetAllocatedString( | 267 SUCCEEDED(hr = devices[i]->GetAllocatedString( |
| 268 MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK, &id, | 268 MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK, &id, |
| 269 &id_size))) { | 269 &id_size))) { |
| 270 std::wstring name_w(name, name_size), id_w(id, id_size); | 270 std::wstring name_w(name, name_size), id_w(id, id_size); |
| 271 Name device(base::SysWideToUTF8(name_w), base::SysWideToUTF8(id_w)); | 271 Name device(base::SysWideToUTF8(name_w), base::SysWideToUTF8(id_w), |
| 272 Name::MEDIA_FOUNDATION); |
| 272 device_names->push_back(device); | 273 device_names->push_back(device); |
| 273 } else { | 274 } else { |
| 274 DLOG(WARNING) << "GetAllocatedString failed: " << std::hex << hr; | 275 DLOG(WARNING) << "GetAllocatedString failed: " << std::hex << hr; |
| 275 } | 276 } |
| 276 devices[i]->Release(); | 277 devices[i]->Release(); |
| 277 } | 278 } |
| 278 } | 279 } |
| 279 | 280 |
| 280 VideoCaptureDeviceMFWin::VideoCaptureDeviceMFWin(const Name& device_name) | 281 VideoCaptureDeviceMFWin::VideoCaptureDeviceMFWin(const Name& device_name) |
| 281 : name_(device_name), observer_(NULL), capture_(0) { | 282 : name_(device_name), observer_(NULL), capture_(0) { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 } | 429 } |
| 429 } | 430 } |
| 430 | 431 |
| 431 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { | 432 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { |
| 432 DLOG(ERROR) << "VideoCaptureDeviceMFWin: " << std::hex << hr; | 433 DLOG(ERROR) << "VideoCaptureDeviceMFWin: " << std::hex << hr; |
| 433 if (observer_) | 434 if (observer_) |
| 434 observer_->OnError(); | 435 observer_->OnError(); |
| 435 } | 436 } |
| 436 | 437 |
| 437 } // namespace media | 438 } // namespace media |
| OLD | NEW |