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

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

Issue 967793002: Linux Video Capture: Add V4L2VideoCaptureDelegate{Single,Multi}Plane. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: magjed@ comments 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_WIN) 27 #if defined(OS_LINUX)
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)
31 : device_name_(name), 38 : device_name_(name),
32 unique_id_(id), 39 unique_id_(id),
33 capture_api_class_(api_type), 40 capture_api_class_(api_type),
34 capabilities_id_(id) {} 41 capabilities_id_(id) {}
35 #endif 42 #elif defined(OS_MACOSX)
36
37 #if defined(OS_MACOSX)
38 VideoCaptureDevice::Name::Name(const std::string& name, 43 VideoCaptureDevice::Name::Name(const std::string& name,
39 const std::string& id, 44 const std::string& id,
40 const CaptureApiType api_type) 45 const CaptureApiType api_type)
41 : device_name_(name), 46 : device_name_(name),
42 unique_id_(id), 47 unique_id_(id),
43 capture_api_class_(api_type), 48 capture_api_class_(api_type),
44 transport_type_(OTHER_TRANSPORT), 49 transport_type_(OTHER_TRANSPORT),
45 is_blacklisted_(false) {} 50 is_blacklisted_(false) {}
46 51
47 VideoCaptureDevice::Name::Name(const std::string& name, 52 VideoCaptureDevice::Name::Name(const std::string& name,
48 const std::string& id, 53 const std::string& id,
49 const CaptureApiType api_type, 54 const CaptureApiType api_type,
50 const TransportType transport_type) 55 const TransportType transport_type)
51 : device_name_(name), 56 : device_name_(name),
52 unique_id_(id), 57 unique_id_(id),
53 capture_api_class_(api_type), 58 capture_api_class_(api_type),
54 transport_type_(transport_type), 59 transport_type_(transport_type),
55 is_blacklisted_(false) {} 60 is_blacklisted_(false) {}
56 #endif 61 #endif
57 62
58 VideoCaptureDevice::Name::~Name() {} 63 VideoCaptureDevice::Name::~Name() {}
59 64
60 #if defined(OS_WIN) 65 #if defined(OS_LINUX)
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)
61 const char* VideoCaptureDevice::Name::GetCaptureApiTypeString() const { 78 const char* VideoCaptureDevice::Name::GetCaptureApiTypeString() const {
62 switch(capture_api_type()) { 79 switch(capture_api_type()) {
63 case MEDIA_FOUNDATION: 80 case MEDIA_FOUNDATION:
64 return "Media Foundation"; 81 return "Media Foundation";
65 case DIRECT_SHOW: 82 case DIRECT_SHOW:
66 return "Direct Show"; 83 return "Direct Show";
67 case DIRECT_SHOW_WDM_CROSSBAR: 84 case DIRECT_SHOW_WDM_CROSSBAR:
68 return "Direct Show WDM Crossbar"; 85 return "Direct Show WDM Crossbar";
69 default: 86 default:
70 NOTREACHED() << "Unknown Video Capture API type!"; 87 NOTREACHED() << "Unknown Video Capture API type!";
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 const char** countries_using_60Hz_end = 120 const char** countries_using_60Hz_end =
104 countries_using_60Hz + arraysize(countries_using_60Hz); 121 countries_using_60Hz + arraysize(countries_using_60Hz);
105 if (std::find(countries_using_60Hz, countries_using_60Hz_end, 122 if (std::find(countries_using_60Hz, countries_using_60Hz_end,
106 current_country) == countries_using_60Hz_end) { 123 current_country) == countries_using_60Hz_end) {
107 return kPowerLine50Hz; 124 return kPowerLine50Hz;
108 } 125 }
109 return kPowerLine60Hz; 126 return kPowerLine60Hz;
110 } 127 }
111 128
112 } // namespace media 129 } // 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