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

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

Issue 366593003: Mac VideoCapture: return empty GetModel() for non-USB non-built-in cameras. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: FakeVCD and FileVCD specify AVFoundation API type. Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « media/video/capture/video_capture_device.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 {
11 11
12 const std::string VideoCaptureDevice::Name::GetNameAndModel() const { 12 const std::string VideoCaptureDevice::Name::GetNameAndModel() const {
13 const std::string model_id = GetModel(); 13 const std::string model_id = GetModel();
14 if (model_id.empty()) 14 if (model_id.empty())
15 return device_name_; 15 return device_name_;
16 const std::string suffix = " (" + model_id + ")"; 16 const std::string suffix = " (" + model_id + ")";
17 if (EndsWith(device_name_, suffix, true)) // |true| means case-sensitive. 17 if (EndsWith(device_name_, suffix, true)) // |true| means case-sensitive.
18 return device_name_; 18 return device_name_;
19 return device_name_ + suffix; 19 return device_name_ + suffix;
20 } 20 }
21 21
22 VideoCaptureDevice::Name::Name() {}
23
24 VideoCaptureDevice::Name::Name(const std::string& name, const std::string& id)
25 : device_name_(name), unique_id_(id) {}
26
27 #if defined(OS_WIN)
28 VideoCaptureDevice::Name::Name(const std::string& name,
29 const std::string& id,
30 const CaptureApiType api_type)
31 : device_name_(name), unique_id_(id), capture_api_class_(api_type) {}
32 #endif
33
34 #if defined(OS_MACOSX)
35 VideoCaptureDevice::Name::Name(const std::string& name,
36 const std::string& id,
37 const CaptureApiType api_type)
38 : device_name_(name),
39 unique_id_(id),
40 capture_api_class_(api_type),
41 transport_type_(OTHER_TRANSPORT) {}
42
43 VideoCaptureDevice::Name::Name(const std::string& name,
44 const std::string& id,
45 const CaptureApiType api_type,
46 const TransportType transport_type)
47 : device_name_(name),
48 unique_id_(id),
49 capture_api_class_(api_type),
50 transport_type_(transport_type) {}
51 #endif
52
53 VideoCaptureDevice::Name::~Name() {}
54
22 VideoCaptureDevice::~VideoCaptureDevice() {} 55 VideoCaptureDevice::~VideoCaptureDevice() {}
23 56
24 int VideoCaptureDevice::GetPowerLineFrequencyForLocation() const { 57 int VideoCaptureDevice::GetPowerLineFrequencyForLocation() const {
25 std::string current_country = base::CountryCodeForCurrentTimezone(); 58 std::string current_country = base::CountryCodeForCurrentTimezone();
26 if (current_country.empty()) 59 if (current_country.empty())
27 return 0; 60 return 0;
28 // Sorted out list of countries with 60Hz power line frequency, from 61 // Sorted out list of countries with 60Hz power line frequency, from
29 // http://en.wikipedia.org/wiki/Mains_electricity_by_country 62 // http://en.wikipedia.org/wiki/Mains_electricity_by_country
30 const char* countries_using_60Hz[] = { 63 const char* countries_using_60Hz[] = {
31 "AI", "AO", "AS", "AW", "AZ", "BM", "BR", "BS", "BZ", "CA", "CO", 64 "AI", "AO", "AS", "AW", "AZ", "BM", "BR", "BS", "BZ", "CA", "CO",
32 "CR", "CU", "DO", "EC", "FM", "GT", "GU", "GY", "HN", "HT", "JP", 65 "CR", "CU", "DO", "EC", "FM", "GT", "GU", "GY", "HN", "HT", "JP",
33 "KN", "KR", "KY", "MS", "MX", "NI", "PA", "PE", "PF", "PH", "PR", 66 "KN", "KR", "KY", "MS", "MX", "NI", "PA", "PE", "PF", "PH", "PR",
34 "PW", "SA", "SR", "SV", "TT", "TW", "UM", "US", "VG", "VI", "VE"}; 67 "PW", "SA", "SR", "SV", "TT", "TW", "UM", "US", "VG", "VI", "VE"};
35 const char** countries_using_60Hz_end = 68 const char** countries_using_60Hz_end =
36 countries_using_60Hz + arraysize(countries_using_60Hz); 69 countries_using_60Hz + arraysize(countries_using_60Hz);
37 if (std::find(countries_using_60Hz, countries_using_60Hz_end, 70 if (std::find(countries_using_60Hz, countries_using_60Hz_end,
38 current_country) == countries_using_60Hz_end) { 71 current_country) == countries_using_60Hz_end) {
39 return kPowerLine50Hz; 72 return kPowerLine50Hz;
40 } 73 }
41 return kPowerLine60Hz; 74 return kPowerLine60Hz;
42 } 75 }
43 76
44 } // namespace media 77 } // namespace media
OLDNEW
« no previous file with comments | « media/video/capture/video_capture_device.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698