OLD | NEW |
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/video/capture/video_capture_device.h" | 5 #include "media/video/capture/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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 VideoCaptureDevice::Name::Name(const std::string& name, | 52 VideoCaptureDevice::Name::Name(const std::string& name, |
53 const std::string& id, | 53 const std::string& id, |
54 const CaptureApiType api_type, | 54 const CaptureApiType api_type, |
55 const TransportType transport_type) | 55 const TransportType transport_type) |
56 : device_name_(name), | 56 : device_name_(name), |
57 unique_id_(id), | 57 unique_id_(id), |
58 capture_api_class_(api_type), | 58 capture_api_class_(api_type), |
59 transport_type_(transport_type), | 59 transport_type_(transport_type), |
60 is_blacklisted_(false) {} | 60 is_blacklisted_(false) {} |
| 61 #elif defined(ANDROID) |
| 62 VideoCaptureDevice::Name::Name(const std::string& name, |
| 63 const std::string& id, |
| 64 const CaptureApiType api_type) |
| 65 : device_name_(name), |
| 66 unique_id_(id), |
| 67 capture_api_class_(api_type) {} |
61 #endif | 68 #endif |
62 | 69 |
63 VideoCaptureDevice::Name::~Name() {} | 70 VideoCaptureDevice::Name::~Name() {} |
64 | 71 |
65 #if defined(OS_LINUX) | 72 #if defined(OS_LINUX) |
66 const char* VideoCaptureDevice::Name::GetCaptureApiTypeString() const { | 73 const char* VideoCaptureDevice::Name::GetCaptureApiTypeString() const { |
67 switch (capture_api_type()) { | 74 switch (capture_api_type()) { |
68 case V4L2_SINGLE_PLANE: | 75 case V4L2_SINGLE_PLANE: |
69 return "V4L2 SPLANE"; | 76 return "V4L2 SPLANE"; |
70 case V4L2_MULTI_PLANE: | 77 case V4L2_MULTI_PLANE: |
(...skipping 24 matching lines...) Expand all Loading... |
95 return "AV Foundation"; | 102 return "AV Foundation"; |
96 case QTKIT: | 103 case QTKIT: |
97 return "QTKit"; | 104 return "QTKit"; |
98 case DECKLINK: | 105 case DECKLINK: |
99 return "DeckLink"; | 106 return "DeckLink"; |
100 default: | 107 default: |
101 NOTREACHED() << "Unknown Video Capture API type!"; | 108 NOTREACHED() << "Unknown Video Capture API type!"; |
102 return "Unknown API"; | 109 return "Unknown API"; |
103 } | 110 } |
104 } | 111 } |
| 112 #elif defined(OS_ANDROID) |
| 113 const char* VideoCaptureDevice::Name::GetCaptureApiTypeString() const { |
| 114 switch(capture_api_type()) { |
| 115 case API1: |
| 116 return "Camera API1"; |
| 117 case API2_LEGACY: |
| 118 return "Camera API2 Legacy"; |
| 119 case API2_FULL: |
| 120 return "Camera API2 Full"; |
| 121 case API2_LIMITED: |
| 122 return "Camera API2 Limited"; |
| 123 case TANGO: |
| 124 return "Tango API"; |
| 125 case API_TYPE_UNKNOWN: |
| 126 default: |
| 127 NOTREACHED() << "Unknown Video Capture API type!"; |
| 128 return "Unknown API"; |
| 129 } |
| 130 } |
105 #endif | 131 #endif |
106 | 132 |
107 VideoCaptureDevice::~VideoCaptureDevice() {} | 133 VideoCaptureDevice::~VideoCaptureDevice() {} |
108 | 134 |
109 int VideoCaptureDevice::GetPowerLineFrequencyForLocation() const { | 135 int VideoCaptureDevice::GetPowerLineFrequencyForLocation() const { |
110 std::string current_country = base::CountryCodeForCurrentTimezone(); | 136 std::string current_country = base::CountryCodeForCurrentTimezone(); |
111 if (current_country.empty()) | 137 if (current_country.empty()) |
112 return 0; | 138 return 0; |
113 // Sorted out list of countries with 60Hz power line frequency, from | 139 // Sorted out list of countries with 60Hz power line frequency, from |
114 // http://en.wikipedia.org/wiki/Mains_electricity_by_country | 140 // http://en.wikipedia.org/wiki/Mains_electricity_by_country |
115 const char* countries_using_60Hz[] = { | 141 const char* countries_using_60Hz[] = { |
116 "AI", "AO", "AS", "AW", "AZ", "BM", "BR", "BS", "BZ", "CA", "CO", | 142 "AI", "AO", "AS", "AW", "AZ", "BM", "BR", "BS", "BZ", "CA", "CO", |
117 "CR", "CU", "DO", "EC", "FM", "GT", "GU", "GY", "HN", "HT", "JP", | 143 "CR", "CU", "DO", "EC", "FM", "GT", "GU", "GY", "HN", "HT", "JP", |
118 "KN", "KR", "KY", "MS", "MX", "NI", "PA", "PE", "PF", "PH", "PR", | 144 "KN", "KR", "KY", "MS", "MX", "NI", "PA", "PE", "PF", "PH", "PR", |
119 "PW", "SA", "SR", "SV", "TT", "TW", "UM", "US", "VG", "VI", "VE"}; | 145 "PW", "SA", "SR", "SV", "TT", "TW", "UM", "US", "VG", "VI", "VE"}; |
120 const char** countries_using_60Hz_end = | 146 const char** countries_using_60Hz_end = |
121 countries_using_60Hz + arraysize(countries_using_60Hz); | 147 countries_using_60Hz + arraysize(countries_using_60Hz); |
122 if (std::find(countries_using_60Hz, countries_using_60Hz_end, | 148 if (std::find(countries_using_60Hz, countries_using_60Hz_end, |
123 current_country) == countries_using_60Hz_end) { | 149 current_country) == countries_using_60Hz_end) { |
124 return kPowerLine50Hz; | 150 return kPowerLine50Hz; |
125 } | 151 } |
126 return kPowerLine60Hz; | 152 return kPowerLine60Hz; |
127 } | 153 } |
128 | 154 |
129 } // namespace media | 155 } // namespace media |
OLD | NEW |