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

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

Issue 2169013002: Change class VideoCaptureDevice::Name to struct VideoCaptureDeviceDescriptor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build errors Created 4 years, 4 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
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/capture/video/video_capture_device.h" 5 #include "media/capture/video/video_capture_device.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/i18n/timezone.h" 8 #include "base/i18n/timezone.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "media/base/media_switches.h" 12 #include "media/base/media_switches.h"
13 13
14 namespace media { 14 namespace media {
15 15
16 // TODO(msu.koo): http://crbug.com/532272, remove checking the switch in favour
17 // of deferring GetModel() call to the actual VideoCaptureDevice object.
18 const std::string VideoCaptureDevice::Name::GetNameAndModel() const {
19 const std::string model_id = GetModel();
20 if (model_id.empty())
21 return device_name_;
22 const std::string suffix = " (" + model_id + ")";
23 if (base::EndsWith(device_name_, suffix, base::CompareCase::SENSITIVE) ||
24 base::CommandLine::ForCurrentProcess()->HasSwitch(
25 switches::kUseFakeDeviceForMediaStream))
26 // Ignore |model_id| if |kUseFakeDeviceForMediaStream| flag is present.
27 return device_name_;
28 return device_name_ + suffix;
29 }
30
31 VideoCaptureDevice::Name::Name() {
32 }
33
34 VideoCaptureDevice::Name::Name(const std::string& name, const std::string& id)
35 : device_name_(name), unique_id_(id) {
36 }
37
38 #if defined(OS_LINUX)
39 VideoCaptureDevice::Name::Name(const std::string& name,
40 const std::string& id,
41 const CaptureApiType api_type)
42 : device_name_(name), unique_id_(id), capture_api_class_(api_type) {
43 }
44 #elif defined(OS_WIN)
45 VideoCaptureDevice::Name::Name(const std::string& name,
46 const std::string& id,
47 const CaptureApiType api_type)
48 : device_name_(name),
49 unique_id_(id),
50 capture_api_class_(api_type),
51 capabilities_id_(id) {
52 }
53 #elif defined(OS_MACOSX)
54 VideoCaptureDevice::Name::Name(const std::string& name,
55 const std::string& id,
56 const CaptureApiType api_type)
57 : device_name_(name),
58 unique_id_(id),
59 capture_api_class_(api_type),
60 transport_type_(OTHER_TRANSPORT) {}
61
62 VideoCaptureDevice::Name::Name(const std::string& name,
63 const std::string& id,
64 const CaptureApiType api_type,
65 const TransportType transport_type)
66 : device_name_(name),
67 unique_id_(id),
68 capture_api_class_(api_type),
69 transport_type_(transport_type) {}
70 #elif defined(ANDROID)
71 VideoCaptureDevice::Name::Name(const std::string& name,
72 const std::string& id,
73 const CaptureApiType api_type)
74 : device_name_(name), unique_id_(id), capture_api_class_(api_type) {
75 }
76 #endif
77
78 VideoCaptureDevice::Name::Name(const Name& other) = default;
79
80 VideoCaptureDevice::Name::~Name() {
81 }
82
83 #if defined(OS_LINUX)
84 const char* VideoCaptureDevice::Name::GetCaptureApiTypeString() const {
85 switch (capture_api_type()) {
86 case V4L2_SINGLE_PLANE:
87 return "V4L2 SPLANE";
88 default:
89 NOTREACHED() << "Unknown Video Capture API type!";
90 return "Unknown API";
91 }
92 }
93 #elif defined(OS_WIN)
94 const char* VideoCaptureDevice::Name::GetCaptureApiTypeString() const {
95 switch (capture_api_type()) {
96 case MEDIA_FOUNDATION:
97 return "Media Foundation";
98 case DIRECT_SHOW:
99 return "Direct Show";
100 default:
101 NOTREACHED() << "Unknown Video Capture API type!";
102 return "Unknown API";
103 }
104 }
105 #elif defined(OS_MACOSX)
106 const char* VideoCaptureDevice::Name::GetCaptureApiTypeString() const {
107 switch (capture_api_type()) {
108 case AVFOUNDATION:
109 return "AV Foundation";
110 case DECKLINK:
111 return "DeckLink";
112 default:
113 NOTREACHED() << "Unknown Video Capture API type!";
114 return "Unknown API";
115 }
116 }
117 #elif defined(OS_ANDROID)
118 const char* VideoCaptureDevice::Name::GetCaptureApiTypeString() const {
119 switch (capture_api_type()) {
120 case API1:
121 return "Camera API1";
122 case API2_LEGACY:
123 return "Camera API2 Legacy";
124 case API2_FULL:
125 return "Camera API2 Full";
126 case API2_LIMITED:
127 return "Camera API2 Limited";
128 case TANGO:
129 return "Tango API";
130 case API_TYPE_UNKNOWN:
131 default:
132 NOTREACHED() << "Unknown Video Capture API type!";
133 return "Unknown API";
134 }
135 }
136 #endif
137
138 VideoCaptureDevice::Client::Buffer::~Buffer() { 16 VideoCaptureDevice::Client::Buffer::~Buffer() {
139 } 17 }
140 18
141 VideoCaptureDevice::~VideoCaptureDevice() { 19 VideoCaptureDevice::~VideoCaptureDevice() {
142 } 20 }
143 21
144 void VideoCaptureDevice::GetPhotoCapabilities( 22 void VideoCaptureDevice::GetPhotoCapabilities(
145 GetPhotoCapabilitiesCallback callback) {} 23 GetPhotoCapabilitiesCallback callback) {}
146 24
147 void VideoCaptureDevice::SetPhotoOptions(mojom::PhotoSettingsPtr settings, 25 void VideoCaptureDevice::SetPhotoOptions(mojom::PhotoSettingsPtr settings,
(...skipping 27 matching lines...) Expand all
175 switch (params.power_line_frequency) { 53 switch (params.power_line_frequency) {
176 case media::PowerLineFrequency::FREQUENCY_50HZ: // fall through 54 case media::PowerLineFrequency::FREQUENCY_50HZ: // fall through
177 case media::PowerLineFrequency::FREQUENCY_60HZ: 55 case media::PowerLineFrequency::FREQUENCY_60HZ:
178 return params.power_line_frequency; 56 return params.power_line_frequency;
179 default: 57 default:
180 return GetPowerLineFrequencyForLocation(); 58 return GetPowerLineFrequencyForLocation();
181 } 59 }
182 } 60 }
183 61
184 } // namespace media 62 } // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/video_capture_device.h ('k') | media/capture/video/video_capture_device_descriptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698