Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / media / video / capture / video_capture_device.cc
index c370d09..2efff7d 100644 (file)
@@ -3,6 +3,8 @@
 // found in the LICENSE file.
 
 #include "media/video/capture/video_capture_device.h"
+
+#include "base/i18n/timezone.h"
 #include "base/strings/string_util.h"
 
 namespace media {
@@ -19,4 +21,24 @@ const std::string VideoCaptureDevice::Name::GetNameAndModel() const {
 
 VideoCaptureDevice::~VideoCaptureDevice() {}
 
+int VideoCaptureDevice::GetPowerLineFrequencyForLocation() const {
+  std::string current_country = base::CountryCodeForCurrentTimezone();
+  if (current_country.empty())
+    return 0;
+  // Sorted out list of countries with 60Hz power line frequency, from
+  // http://en.wikipedia.org/wiki/Mains_electricity_by_country
+  const char* countries_using_60Hz[] = {
+      "AI", "AO", "AS", "AW", "AZ", "BM", "BR", "BS", "BZ", "CA", "CO",
+      "CR", "CU", "DO", "EC", "FM", "GT", "GU", "GY", "HN", "HT", "JP",
+      "KN", "KR", "KY", "MS", "MX", "NI", "PA", "PE", "PF", "PH", "PR",
+      "PW", "SA", "SR", "SV", "TT", "TW", "UM", "US", "VG", "VI", "VE"};
+  const char** countries_using_60Hz_end =
+      countries_using_60Hz + arraysize(countries_using_60Hz);
+  if (std::find(countries_using_60Hz, countries_using_60Hz_end,
+                current_country) == countries_using_60Hz_end) {
+    return kPowerLine50Hz;
+  }
+  return kPowerLine60Hz;
+}
+
 }  // namespace media