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

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

Issue 1031583002: Revert of Linux Video Capture: Add V4L2VideoCaptureDelegate{Single,Multi}Plane. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/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() {} 22 VideoCaptureDevice::Name::Name() {}
23 23
24 VideoCaptureDevice::Name::Name(const std::string& name, const std::string& id) 24 VideoCaptureDevice::Name::Name(const std::string& name, const std::string& id)
25 : device_name_(name), unique_id_(id) {} 25 : device_name_(name), unique_id_(id) {}
26 26
27 #if defined(OS_LINUX) 27 #if defined(OS_WIN)
28 VideoCaptureDevice::Name::Name(const std::string& name, 28 VideoCaptureDevice::Name::Name(const std::string& name,
29 const std::string& id, 29 const std::string& id,
30 const CaptureApiType api_type) 30 const CaptureApiType api_type)
31 : device_name_(name),
32 unique_id_(id),
33 capture_api_class_(api_type) {}
34 #elif defined(OS_WIN)
35 VideoCaptureDevice::Name::Name(const std::string& name,
36 const std::string& id,
37 const CaptureApiType api_type)
38 : device_name_(name), 31 : device_name_(name),
39 unique_id_(id), 32 unique_id_(id),
40 capture_api_class_(api_type), 33 capture_api_class_(api_type),
41 capabilities_id_(id) {} 34 capabilities_id_(id) {}
42 #elif defined(OS_MACOSX) 35 #endif
36
37 #if defined(OS_MACOSX)
43 VideoCaptureDevice::Name::Name(const std::string& name, 38 VideoCaptureDevice::Name::Name(const std::string& name,
44 const std::string& id, 39 const std::string& id,
45 const CaptureApiType api_type) 40 const CaptureApiType api_type)
46 : device_name_(name), 41 : device_name_(name),
47 unique_id_(id), 42 unique_id_(id),
48 capture_api_class_(api_type), 43 capture_api_class_(api_type),
49 transport_type_(OTHER_TRANSPORT), 44 transport_type_(OTHER_TRANSPORT),
50 is_blacklisted_(false) {} 45 is_blacklisted_(false) {}
51 46
52 VideoCaptureDevice::Name::Name(const std::string& name, 47 VideoCaptureDevice::Name::Name(const std::string& name,
53 const std::string& id, 48 const std::string& id,
54 const CaptureApiType api_type, 49 const CaptureApiType api_type,
55 const TransportType transport_type) 50 const TransportType transport_type)
56 : device_name_(name), 51 : device_name_(name),
57 unique_id_(id), 52 unique_id_(id),
58 capture_api_class_(api_type), 53 capture_api_class_(api_type),
59 transport_type_(transport_type), 54 transport_type_(transport_type),
60 is_blacklisted_(false) {} 55 is_blacklisted_(false) {}
61 #endif 56 #endif
62 57
63 VideoCaptureDevice::Name::~Name() {} 58 VideoCaptureDevice::Name::~Name() {}
64 59
65 #if defined(OS_LINUX) 60 #if defined(OS_WIN)
66 const char* VideoCaptureDevice::Name::GetCaptureApiTypeString() const {
67 switch (capture_api_type()) {
68 case V4L2_SINGLE_PLANE:
69 return "V4L2 SPLANE";
70 case V4L2_MULTI_PLANE:
71 return "V4L2 MPLANE";
72 default:
73 NOTREACHED() << "Unknown Video Capture API type!";
74 return "Unknown API";
75 }
76 }
77 #elif defined(OS_WIN)
78 const char* VideoCaptureDevice::Name::GetCaptureApiTypeString() const { 61 const char* VideoCaptureDevice::Name::GetCaptureApiTypeString() const {
79 switch(capture_api_type()) { 62 switch(capture_api_type()) {
80 case MEDIA_FOUNDATION: 63 case MEDIA_FOUNDATION:
81 return "Media Foundation"; 64 return "Media Foundation";
82 case DIRECT_SHOW: 65 case DIRECT_SHOW:
83 return "Direct Show"; 66 return "Direct Show";
84 case DIRECT_SHOW_WDM_CROSSBAR: 67 case DIRECT_SHOW_WDM_CROSSBAR:
85 return "Direct Show WDM Crossbar"; 68 return "Direct Show WDM Crossbar";
86 default: 69 default:
87 NOTREACHED() << "Unknown Video Capture API type!"; 70 NOTREACHED() << "Unknown Video Capture API type!";
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 const char** countries_using_60Hz_end = 103 const char** countries_using_60Hz_end =
121 countries_using_60Hz + arraysize(countries_using_60Hz); 104 countries_using_60Hz + arraysize(countries_using_60Hz);
122 if (std::find(countries_using_60Hz, countries_using_60Hz_end, 105 if (std::find(countries_using_60Hz, countries_using_60Hz_end,
123 current_country) == countries_using_60Hz_end) { 106 current_country) == countries_using_60Hz_end) {
124 return kPowerLine50Hz; 107 return kPowerLine50Hz;
125 } 108 }
126 return kPowerLine60Hz; 109 return kPowerLine60Hz;
127 } 110 }
128 111
129 } // namespace media 112 } // namespace media
OLDNEW
« no previous file with comments | « media/video/capture/video_capture_device.h ('k') | media/video/capture/video_capture_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698