| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 ScopedComPtr<IMFMediaType> type; | 131 ScopedComPtr<IMFMediaType> type; |
| 132 HRESULT hr; | 132 HRESULT hr; |
| 133 while (SUCCEEDED(hr = source->GetNativeMediaType( | 133 while (SUCCEEDED(hr = source->GetNativeMediaType( |
| 134 MF_SOURCE_READER_FIRST_VIDEO_STREAM, stream_index, type.Receive()))) { | 134 MF_SOURCE_READER_FIRST_VIDEO_STREAM, stream_index, type.Receive()))) { |
| 135 VideoCaptureCapabilityWin capability(stream_index++); | 135 VideoCaptureCapabilityWin capability(stream_index++); |
| 136 if (FillCapabilitiesFromType(type, &capability)) | 136 if (FillCapabilitiesFromType(type, &capability)) |
| 137 capabilities->Add(capability); | 137 capabilities->Add(capability); |
| 138 type.Release(); | 138 type.Release(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 if (SUCCEEDED(hr) && capabilities->empty()) | 141 if (capabilities->empty() && (SUCCEEDED(hr) || hr == MF_E_NO_MORE_TYPES)) |
| 142 hr = HRESULT_FROM_WIN32(ERROR_EMPTY); | 142 hr = HRESULT_FROM_WIN32(ERROR_EMPTY); |
| 143 | 143 |
| 144 return (hr == MF_E_NO_MORE_TYPES) ? S_OK : hr; | 144 return (hr == MF_E_NO_MORE_TYPES) ? S_OK : hr; |
| 145 } | 145 } |
| 146 | 146 |
| 147 bool LoadMediaFoundationDlls() { | 147 bool LoadMediaFoundationDlls() { |
| 148 static const wchar_t* const kMfDLLs[] = { | 148 static const wchar_t* const kMfDLLs[] = { |
| 149 L"%WINDIR%\\system32\\mf.dll", | 149 L"%WINDIR%\\system32\\mf.dll", |
| 150 L"%WINDIR%\\system32\\mfplat.dll", | 150 L"%WINDIR%\\system32\\mfplat.dll", |
| 151 L"%WINDIR%\\system32\\mfreadwrite.dll", | 151 L"%WINDIR%\\system32\\mfreadwrite.dll", |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 } | 419 } |
| 420 } | 420 } |
| 421 | 421 |
| 422 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { | 422 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { |
| 423 DLOG(ERROR) << "VideoCaptureDeviceMFWin: " << std::hex << hr; | 423 DLOG(ERROR) << "VideoCaptureDeviceMFWin: " << std::hex << hr; |
| 424 if (observer_) | 424 if (observer_) |
| 425 observer_->OnError(); | 425 observer_->OnError(); |
| 426 } | 426 } |
| 427 | 427 |
| 428 } // namespace media | 428 } // namespace media |
| OLD | NEW |