| 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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 !GetFrameSize(type, &format->frame_size) || | 51 !GetFrameSize(type, &format->frame_size) || |
| 52 !GetFrameRate(type, &format->frame_rate) || | 52 !GetFrameRate(type, &format->frame_rate) || |
| 53 !VideoCaptureDeviceMFWin::FormatFromGuid(type_guid, | 53 !VideoCaptureDeviceMFWin::FormatFromGuid(type_guid, |
| 54 &format->pixel_format)) { | 54 &format->pixel_format)) { |
| 55 return false; | 55 return false; |
| 56 } | 56 } |
| 57 | 57 |
| 58 return true; | 58 return true; |
| 59 } | 59 } |
| 60 | 60 |
| 61 HRESULT FillCapabilities(IMFSourceReader* source, | 61 HRESULT VideoCaptureDeviceMFWin::FillCapabilities( |
| 62 CapabilityList* capabilities) { | 62 IMFSourceReader* source, |
| 63 CapabilityList* capabilities) { |
| 63 DWORD stream_index = 0; | 64 DWORD stream_index = 0; |
| 64 ScopedComPtr<IMFMediaType> type; | 65 ScopedComPtr<IMFMediaType> type; |
| 65 HRESULT hr; | 66 HRESULT hr; |
| 66 while (SUCCEEDED(hr = source->GetNativeMediaType( | 67 while (SUCCEEDED(hr = source->GetNativeMediaType( |
| 67 kFirstVideoStream, stream_index, type.Receive()))) { | 68 kFirstVideoStream, stream_index, type.Receive()))) { |
| 68 VideoCaptureFormat format; | 69 VideoCaptureFormat format; |
| 69 if (FillFormat(type, &format)) | 70 if (FillFormat(type, &format)) |
| 70 capabilities->emplace_back(stream_index, format); | 71 capabilities->emplace_back(stream_index, format); |
| 71 type.Release(); | 72 type.Release(); |
| 72 ++stream_index; | 73 ++stream_index; |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 | 320 |
| 320 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { | 321 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { |
| 321 if (client_.get()) { | 322 if (client_.get()) { |
| 322 client_->OnError( | 323 client_->OnError( |
| 323 base::StringPrintf("VideoCaptureDeviceMFWin: %s", | 324 base::StringPrintf("VideoCaptureDeviceMFWin: %s", |
| 324 logging::SystemErrorCodeToString(hr).c_str())); | 325 logging::SystemErrorCodeToString(hr).c_str())); |
| 325 } | 326 } |
| 326 } | 327 } |
| 327 | 328 |
| 328 } // namespace media | 329 } // namespace media |
| OLD | NEW |