| 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/capture/video/win/video_capture_device_mf_win.h" | 5 #include "media/capture/video/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 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 HRESULT FillCapabilities(IMFSourceReader* source, | 60 HRESULT FillCapabilities(IMFSourceReader* source, |
| 61 CapabilityList* capabilities) { | 61 CapabilityList* capabilities) { |
| 62 DWORD stream_index = 0; | 62 DWORD stream_index = 0; |
| 63 ScopedComPtr<IMFMediaType> type; | 63 ScopedComPtr<IMFMediaType> type; |
| 64 HRESULT hr; | 64 HRESULT hr; |
| 65 while (SUCCEEDED(hr = source->GetNativeMediaType( | 65 while (SUCCEEDED(hr = source->GetNativeMediaType( |
| 66 kFirstVideoStream, stream_index, type.Receive()))) { | 66 kFirstVideoStream, stream_index, type.Receive()))) { |
| 67 VideoCaptureFormat format; | 67 VideoCaptureFormat format; |
| 68 if (FillFormat(type.get(), &format)) | 68 if (FillFormat(type.get(), &format)) |
| 69 capabilities->emplace_back(stream_index, format); | 69 capabilities->emplace_back(stream_index, format); |
| 70 type.Release(); | 70 type.Reset(); |
| 71 ++stream_index; | 71 ++stream_index; |
| 72 } | 72 } |
| 73 | 73 |
| 74 if (capabilities->empty() && (SUCCEEDED(hr) || hr == MF_E_NO_MORE_TYPES)) | 74 if (capabilities->empty() && (SUCCEEDED(hr) || hr == MF_E_NO_MORE_TYPES)) |
| 75 hr = HRESULT_FROM_WIN32(ERROR_EMPTY); | 75 hr = HRESULT_FROM_WIN32(ERROR_EMPTY); |
| 76 | 76 |
| 77 return (hr == MF_E_NO_MORE_TYPES) ? S_OK : hr; | 77 return (hr == MF_E_NO_MORE_TYPES) ? S_OK : hr; |
| 78 } | 78 } |
| 79 | 79 |
| 80 class MFReaderCallback final | 80 class MFReaderCallback final |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 HRESULT hr) { | 311 HRESULT hr) { |
| 312 if (client_.get()) { | 312 if (client_.get()) { |
| 313 client_->OnError( | 313 client_->OnError( |
| 314 from_here, | 314 from_here, |
| 315 base::StringPrintf("VideoCaptureDeviceMFWin: %s", | 315 base::StringPrintf("VideoCaptureDeviceMFWin: %s", |
| 316 logging::SystemErrorCodeToString(hr).c_str())); | 316 logging::SystemErrorCodeToString(hr).c_str())); |
| 317 } | 317 } |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace media | 320 } // namespace media |
| OLD | NEW |