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 VideoCaptureDeviceMFWin::FillCapabilities( | 61 HRESULT FillCapabilities(IMFSourceReader* source, |
62 IMFSourceReader* source, | 62 CapabilityList* capabilities) { |
63 CapabilityList* capabilities) { | |
64 DWORD stream_index = 0; | 63 DWORD stream_index = 0; |
65 ScopedComPtr<IMFMediaType> type; | 64 ScopedComPtr<IMFMediaType> type; |
66 HRESULT hr; | 65 HRESULT hr; |
67 while (SUCCEEDED(hr = source->GetNativeMediaType( | 66 while (SUCCEEDED(hr = source->GetNativeMediaType( |
68 kFirstVideoStream, stream_index, type.Receive()))) { | 67 kFirstVideoStream, stream_index, type.Receive()))) { |
69 VideoCaptureFormat format; | 68 VideoCaptureFormat format; |
70 if (FillFormat(type, &format)) | 69 if (FillFormat(type, &format)) |
71 capabilities->emplace_back(stream_index, format); | 70 capabilities->emplace_back(stream_index, format); |
72 type.Release(); | 71 type.Release(); |
73 ++stream_index; | 72 ++stream_index; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 | 319 |
321 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { | 320 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { |
322 if (client_.get()) { | 321 if (client_.get()) { |
323 client_->OnError( | 322 client_->OnError( |
324 base::StringPrintf("VideoCaptureDeviceMFWin: %s", | 323 base::StringPrintf("VideoCaptureDeviceMFWin: %s", |
325 logging::SystemErrorCodeToString(hr).c_str())); | 324 logging::SystemErrorCodeToString(hr).c_str())); |
326 } | 325 } |
327 } | 326 } |
328 | 327 |
329 } // namespace media | 328 } // namespace media |
OLD | NEW |