| 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/base/video_capture_types.h" | 5 #include "device/capture/video/win/capability_list_win.h" |
| 6 #include "media/capture/video/win/capability_list_win.h" | |
| 7 | 6 |
| 8 #include <algorithm> | 7 #include <algorithm> |
| 9 #include <functional> | 8 #include <functional> |
| 10 | 9 |
| 11 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "media/base/video_capture_types.h" |
| 12 | 12 |
| 13 namespace media { | 13 namespace device { |
| 14 | 14 |
| 15 static bool CompareCapability(const VideoCaptureFormat& requested, | 15 static bool CompareCapability(const VideoCaptureFormat& requested, |
| 16 const CapabilityWin& capability_lhs, | 16 const CapabilityWin& capability_lhs, |
| 17 const CapabilityWin& capability_rhs) { | 17 const CapabilityWin& capability_rhs) { |
| 18 const VideoCaptureFormat& lhs = capability_lhs.supported_format; | 18 const VideoCaptureFormat& lhs = capability_lhs.supported_format; |
| 19 const VideoCaptureFormat& rhs = capability_rhs.supported_format; | 19 const VideoCaptureFormat& rhs = capability_rhs.supported_format; |
| 20 | 20 |
| 21 const int diff_height_lhs = | 21 const int diff_height_lhs = |
| 22 std::abs(lhs.frame_size.height() - requested.frame_size.height()); | 22 std::abs(lhs.frame_size.height() - requested.frame_size.height()); |
| 23 const int diff_height_rhs = | 23 const int diff_height_rhs = |
| (...skipping 22 matching lines...) Expand all Loading... |
| 46 const CapabilityList& capabilities) { | 46 const CapabilityList& capabilities) { |
| 47 DCHECK(!capabilities.empty()); | 47 DCHECK(!capabilities.empty()); |
| 48 const CapabilityWin* best_match = &(*capabilities.begin()); | 48 const CapabilityWin* best_match = &(*capabilities.begin()); |
| 49 for (const CapabilityWin& capability : capabilities) { | 49 for (const CapabilityWin& capability : capabilities) { |
| 50 if (CompareCapability(requested, capability, *best_match)) | 50 if (CompareCapability(requested, capability, *best_match)) |
| 51 best_match = &capability; | 51 best_match = &capability; |
| 52 } | 52 } |
| 53 return *best_match; | 53 return *best_match; |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // namespace media | 56 } // namespace device |
| OLD | NEW |