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
3 // found in the LICENSE file.
5 #include "media/video/capture/video_capture_device.h"
7 #include "base/i18n/timezone.h"
8 #include "base/strings/string_util.h"
12 const std::string
VideoCaptureDevice::Name::GetNameAndModel() const {
13 const std::string model_id
= GetModel();
16 const std::string suffix
= " (" + model_id
+ ")";
17 if (EndsWith(device_name_
, suffix
, true)) // |true| means case-sensitive.
19 return device_name_
+ suffix
;
22 VideoCaptureDevice::~VideoCaptureDevice() {}
24 int VideoCaptureDevice::GetPowerLineFrequencyForLocation() const {
25 std::string current_country
= base::CountryCodeForCurrentTimezone();
26 if (current_country
.empty())
28 // Sorted out list of countries with 60Hz power line frequency, from
29 // http://en.wikipedia.org/wiki/Mains_electricity_by_country
30 const char* countries_using_60Hz
[] = {
31 "AI", "AO", "AS", "AW", "AZ", "BM", "BR", "BS", "BZ", "CA", "CO",
32 "CR", "CU", "DO", "EC", "FM", "GT", "GU", "GY", "HN", "HT", "JP",
33 "KN", "KR", "KY", "MS", "MX", "NI", "PA", "PE", "PF", "PH", "PR",
34 "PW", "SA", "SR", "SV", "TT", "TW", "UM", "US", "VG", "VI", "VE"};
35 const char** countries_using_60Hz_end
=
36 countries_using_60Hz
+ arraysize(countries_using_60Hz
);
37 if (std::find(countries_using_60Hz
, countries_using_60Hz_end
,
38 current_country
) == countries_using_60Hz_end
) {
39 return kPowerLine50Hz
;
41 return kPowerLine60Hz
;