Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Side by Side Diff: media/capture/video/video_capture_device.cc

Issue 1345993002: Change the functions in video_capture_device to pass around PowerLineFrequency enums instead of int… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/video_capture_device.h" 5 #include "media/capture/video/video_capture_device.h"
6 6
7 #include "base/i18n/timezone.h" 7 #include "base/i18n/timezone.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 9
10 namespace media { 10 namespace media {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 } 132 }
133 #endif 133 #endif
134 134
135 VideoCaptureDevice::Client::Buffer::~Buffer() { 135 VideoCaptureDevice::Client::Buffer::~Buffer() {
136 } 136 }
137 137
138 VideoCaptureDevice::~VideoCaptureDevice() { 138 VideoCaptureDevice::~VideoCaptureDevice() {
139 } 139 }
140 140
141 int VideoCaptureDevice::GetPowerLineFrequencyForLocation() const { 141 PowerLineFrequency
142 VideoCaptureDevice::GetPowerLineFrequencyForLocation() const {
142 std::string current_country = base::CountryCodeForCurrentTimezone(); 143 std::string current_country = base::CountryCodeForCurrentTimezone();
mcasas 2015/09/21 15:30:06 Can be const, right?
143 if (current_country.empty()) 144 if (current_country.empty())
144 return 0; 145 return media::PowerLineFrequency::FREQUENCY_DEFAULT;
mcasas 2015/09/21 15:30:06 No need for media::
145 // Sorted out list of countries with 60Hz power line frequency, from 146 // Sorted out list of countries with 60Hz power line frequency, from
146 // http://en.wikipedia.org/wiki/Mains_electricity_by_country 147 // http://en.wikipedia.org/wiki/Mains_electricity_by_country
147 const char* countries_using_60Hz[] = { 148 const char* countries_using_60Hz[] = {
148 "AI", "AO", "AS", "AW", "AZ", "BM", "BR", "BS", "BZ", "CA", "CO", 149 "AI", "AO", "AS", "AW", "AZ", "BM", "BR", "BS", "BZ", "CA", "CO",
149 "CR", "CU", "DO", "EC", "FM", "GT", "GU", "GY", "HN", "HT", "JP", 150 "CR", "CU", "DO", "EC", "FM", "GT", "GU", "GY", "HN", "HT", "JP",
150 "KN", "KR", "KY", "MS", "MX", "NI", "PA", "PE", "PF", "PH", "PR", 151 "KN", "KR", "KY", "MS", "MX", "NI", "PA", "PE", "PF", "PH", "PR",
151 "PW", "SA", "SR", "SV", "TT", "TW", "UM", "US", "VG", "VI", "VE"}; 152 "PW", "SA", "SR", "SV", "TT", "TW", "UM", "US", "VG", "VI", "VE"};
152 const char** countries_using_60Hz_end = 153 const char** countries_using_60Hz_end =
153 countries_using_60Hz + arraysize(countries_using_60Hz); 154 countries_using_60Hz + arraysize(countries_using_60Hz);
154 if (std::find(countries_using_60Hz, countries_using_60Hz_end, 155 if (std::find(countries_using_60Hz, countries_using_60Hz_end,
155 current_country) == countries_using_60Hz_end) { 156 current_country) == countries_using_60Hz_end) {
156 return static_cast<int>(media::PowerLineFrequency::FREQUENCY_50HZ); 157 return media::PowerLineFrequency::FREQUENCY_50HZ;
157 } 158 }
158 return static_cast<int>(media::PowerLineFrequency::FREQUENCY_60HZ); 159 return media::PowerLineFrequency::FREQUENCY_60HZ;
159 } 160 }
160 161
161 int VideoCaptureDevice::GetPowerLineFrequency( 162 PowerLineFrequency VideoCaptureDevice::GetPowerLineFrequency(
162 const VideoCaptureParams& params) const { 163 const VideoCaptureParams& params) const {
163 switch (params.power_line_frequency) { 164 switch (params.power_line_frequency) {
164 case media::PowerLineFrequency::FREQUENCY_50HZ: // fall through 165 case media::PowerLineFrequency::FREQUENCY_50HZ: // fall through
165 case media::PowerLineFrequency::FREQUENCY_60HZ: 166 case media::PowerLineFrequency::FREQUENCY_60HZ:
166 return static_cast<int>(params.power_line_frequency); 167 return params.power_line_frequency;
167 default: 168 default:
168 return GetPowerLineFrequencyForLocation(); 169 return GetPowerLineFrequencyForLocation();
169 } 170 }
170 } 171 }
171 172
172 } // namespace media 173 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698