Chromium Code Reviews| 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 #ifndef MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_ | 5 #ifndef MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_ |
| 6 #define MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_ | 6 #define MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 // exceeding the maximum dimensions specified. | 48 // exceeding the maximum dimensions specified. |
| 49 RESOLUTION_POLICY_ANY_WITHIN_LIMIT, | 49 RESOLUTION_POLICY_ANY_WITHIN_LIMIT, |
| 50 | 50 |
| 51 // Must always be equal to largest entry in the enum. | 51 // Must always be equal to largest entry in the enum. |
| 52 RESOLUTION_POLICY_LAST = RESOLUTION_POLICY_ANY_WITHIN_LIMIT, | 52 RESOLUTION_POLICY_LAST = RESOLUTION_POLICY_ANY_WITHIN_LIMIT, |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 // Potential values of the googPowerLineFrequency optional constraint passed to | 55 // Potential values of the googPowerLineFrequency optional constraint passed to |
| 56 // getUserMedia. Note that the numeric values are currently significant, and are | 56 // getUserMedia. Note that the numeric values are currently significant, and are |
| 57 // used to map enum values to corresponding frequency values. | 57 // used to map enum values to corresponding frequency values. |
| 58 // TODO(ajose): http://crbug.com/525167 Consider making this a class. | 58 class MEDIA_EXPORT PowerLineFrequency { |
| 59 enum class PowerLineFrequency { | 59 private: |
|
wolenetz
2015/09/09 19:39:15
public before private: http://google-styleguide.go
suvanjanmukherjee
2015/09/13 15:33:46
Done.
| |
| 60 FREQUENCY_DEFAULT = 0, | 60 int freq_; |
| 61 FREQUENCY_50HZ = 50, | 61 |
| 62 FREQUENCY_60HZ = 60, | 62 void check(int freq); |
|
wolenetz
2015/09/09 19:39:15
methods before data members:
http://google-stylegu
suvanjanmukherjee
2015/09/13 15:33:46
Done.
| |
| 63 FREQUENCY_MAX = FREQUENCY_60HZ | 63 public: |
| 64 // Static members | |
| 65 static constexpr int FREQUENCY_DEFAULT = 0; | |
|
wolenetz
2015/09/09 19:39:15
constexpr usage is currently banned in Chromium (s
suvanjanmukherjee
2015/09/13 15:33:46
Done.
| |
| 66 static constexpr int FREQUENCY_50HZ = 50; | |
| 67 static constexpr int FREQUENCY_60HZ = 60; | |
| 68 static constexpr int FREQUENCY_MAX = FREQUENCY_60HZ; | |
| 69 | |
| 70 // Functions | |
| 71 PowerLineFrequency(int freq); | |
|
wolenetz
2015/09/09 19:39:15
use "explicit"
suvanjanmukherjee
2015/09/13 15:33:46
Done.
| |
| 72 PowerLineFrequency& operator = (int freq); | |
|
wolenetz
2015/09/09 19:39:15
For this and the next line, use consistent and cor
suvanjanmukherjee
2015/09/13 15:33:46
Done.
| |
| 73 PowerLineFrequency& operator =(const PowerLineFrequency& rhs); | |
| 74 | |
| 75 // Automatically cast to int | |
| 76 operator int() const; | |
| 64 }; | 77 }; |
| 65 // Assert that the int:frequency mapping is correct. | 78 // Assert that the int:frequency mapping is correct. |
| 66 static_assert(static_cast<int>(PowerLineFrequency::FREQUENCY_DEFAULT) == 0, | 79 static_assert(static_cast<int>(PowerLineFrequency::FREQUENCY_DEFAULT) == 0, |
|
ajose
2015/09/10 17:24:55
Remove static_casts?
suvanjanmukherjee
2015/09/13 15:33:46
Done.
| |
| 67 "static_cast<int>(FREQUENCY_DEFAULT) must equal 0."); | 80 "static_cast<int>(FREQUENCY_DEFAULT) must equal 0."); |
| 68 static_assert(static_cast<int>(PowerLineFrequency::FREQUENCY_50HZ) == 50, | 81 static_assert(static_cast<int>(PowerLineFrequency::FREQUENCY_50HZ) == 50, |
| 69 "static_cast<int>(FREQUENCY_DEFAULT) must equal 50."); | 82 "static_cast<int>(FREQUENCY_DEFAULT) must equal 50."); |
| 70 static_assert(static_cast<int>(PowerLineFrequency::FREQUENCY_60HZ) == 60, | 83 static_assert(static_cast<int>(PowerLineFrequency::FREQUENCY_60HZ) == 60, |
| 71 "static_cast<int>(FREQUENCY_DEFAULT) must equal 60."); | 84 "static_cast<int>(FREQUENCY_DEFAULT) must equal 60."); |
| 72 | 85 |
| 73 // Some drivers use rational time per frame instead of float frame rate, this | 86 // Some drivers use rational time per frame instead of float frame rate, this |
| 74 // constant k is used to convert between both: A fps -> [k/k*A] seconds/frame. | 87 // constant k is used to convert between both: A fps -> [k/k*A] seconds/frame. |
| 75 const int kFrameRatePrecision = 10000; | 88 const int kFrameRatePrecision = 10000; |
| 76 | 89 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 // Policy for resolution change. | 150 // Policy for resolution change. |
| 138 ResolutionChangePolicy resolution_change_policy; | 151 ResolutionChangePolicy resolution_change_policy; |
| 139 | 152 |
| 140 // User-specified power line frequency. | 153 // User-specified power line frequency. |
| 141 PowerLineFrequency power_line_frequency; | 154 PowerLineFrequency power_line_frequency; |
| 142 }; | 155 }; |
| 143 | 156 |
| 144 } // namespace media | 157 } // namespace media |
| 145 | 158 |
| 146 #endif // MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_ | 159 #endif // MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_ |
| OLD | NEW |