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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 const TransportType transport_type) | 50 const TransportType transport_type) |
51 : device_name_(name), | 51 : device_name_(name), |
52 unique_id_(id), | 52 unique_id_(id), |
53 capture_api_class_(api_type), | 53 capture_api_class_(api_type), |
54 transport_type_(transport_type), | 54 transport_type_(transport_type), |
55 is_blacklisted_(false) {} | 55 is_blacklisted_(false) {} |
56 #endif | 56 #endif |
57 | 57 |
58 VideoCaptureDevice::Name::~Name() {} | 58 VideoCaptureDevice::Name::~Name() {} |
59 | 59 |
60 #if defined(OS_WIN) | |
61 const char* VideoCaptureDevice::Name::GetCaptureApiTypeString() const { | |
62 switch(capture_api_type()) { | |
63 case MEDIA_FOUNDATION: | |
64 return "MEDIA_FOUNDATION"; | |
65 case DIRECT_SHOW: | |
66 return "DIRECT_SHOW"; | |
67 case DIRECT_SHOW_WDM_CROSSBAR: | |
68 return "DIRECT_SHOW_WDM_CROSSBAR"; | |
69 default: | |
70 NOTREACHED() << "Unknown Video Capture API type!"; | |
71 return "API_TYPE_UNKNOWN"; | |
xhwang
2014/10/21 19:07:49
ditto about readable names.
burnik
2014/10/21 19:37:11
Done.
| |
72 } | |
73 } | |
74 #elif defined(OS_MACOSX) | |
75 const char* VideoCaptureDevice::Name::GetCaptureApiTypeString() const { | |
76 switch(capture_api_type()) { | |
77 case AVFOUNDATION: | |
78 return "AVFOUNDATION"; | |
79 case QTKIT: | |
80 return "QTKIT"; | |
81 case DECKLINK: | |
82 return "DECKLINK"; | |
83 default: | |
84 NOTREACHED() << "Unknown Video Capture API type!"; | |
85 return "API_TYPE_UNKNOWN"; | |
86 } | |
87 } | |
88 #endif | |
89 | |
60 VideoCaptureDevice::~VideoCaptureDevice() {} | 90 VideoCaptureDevice::~VideoCaptureDevice() {} |
61 | 91 |
62 int VideoCaptureDevice::GetPowerLineFrequencyForLocation() const { | 92 int VideoCaptureDevice::GetPowerLineFrequencyForLocation() const { |
63 std::string current_country = base::CountryCodeForCurrentTimezone(); | 93 std::string current_country = base::CountryCodeForCurrentTimezone(); |
64 if (current_country.empty()) | 94 if (current_country.empty()) |
65 return 0; | 95 return 0; |
66 // Sorted out list of countries with 60Hz power line frequency, from | 96 // Sorted out list of countries with 60Hz power line frequency, from |
67 // http://en.wikipedia.org/wiki/Mains_electricity_by_country | 97 // http://en.wikipedia.org/wiki/Mains_electricity_by_country |
68 const char* countries_using_60Hz[] = { | 98 const char* countries_using_60Hz[] = { |
69 "AI", "AO", "AS", "AW", "AZ", "BM", "BR", "BS", "BZ", "CA", "CO", | 99 "AI", "AO", "AS", "AW", "AZ", "BM", "BR", "BS", "BZ", "CA", "CO", |
70 "CR", "CU", "DO", "EC", "FM", "GT", "GU", "GY", "HN", "HT", "JP", | 100 "CR", "CU", "DO", "EC", "FM", "GT", "GU", "GY", "HN", "HT", "JP", |
71 "KN", "KR", "KY", "MS", "MX", "NI", "PA", "PE", "PF", "PH", "PR", | 101 "KN", "KR", "KY", "MS", "MX", "NI", "PA", "PE", "PF", "PH", "PR", |
72 "PW", "SA", "SR", "SV", "TT", "TW", "UM", "US", "VG", "VI", "VE"}; | 102 "PW", "SA", "SR", "SV", "TT", "TW", "UM", "US", "VG", "VI", "VE"}; |
73 const char** countries_using_60Hz_end = | 103 const char** countries_using_60Hz_end = |
74 countries_using_60Hz + arraysize(countries_using_60Hz); | 104 countries_using_60Hz + arraysize(countries_using_60Hz); |
75 if (std::find(countries_using_60Hz, countries_using_60Hz_end, | 105 if (std::find(countries_using_60Hz, countries_using_60Hz_end, |
76 current_country) == countries_using_60Hz_end) { | 106 current_country) == countries_using_60Hz_end) { |
77 return kPowerLine50Hz; | 107 return kPowerLine50Hz; |
78 } | 108 } |
79 return kPowerLine60Hz; | 109 return kPowerLine60Hz; |
80 } | 110 } |
81 | 111 |
82 bool VideoCaptureDevice::InitializeImageCapture( | 112 bool VideoCaptureDevice::InitializeImageCapture( |
83 const ImageCaptureFormat& image_format, | 113 const ImageCaptureFormat& image_format, |
84 scoped_ptr<ImageClient> client) { | 114 scoped_ptr<ImageClient> client) { |
85 return false; | 115 return false; |
86 } | 116 } |
87 | 117 |
88 } // namespace media | 118 } // namespace media |
OLD | NEW |