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

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

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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // VideoCaptureDevice is the abstract base class for realizing video capture 5 // VideoCaptureDevice is the abstract base class for realizing video capture
6 // device support in Chromium. It provides the interface for OS dependent 6 // device support in Chromium. It provides the interface for OS dependent
7 // implementations. 7 // implementations.
8 // The class is created and functions are invoked on a thread owned by 8 // The class is created and functions are invoked on a thread owned by
9 // VideoCaptureManager. Capturing is done on other threads, depending on the OS 9 // VideoCaptureManager. Capturing is done on other threads, depending on the OS
10 // specific implementation. 10 // specific implementation.
(...skipping 20 matching lines...) Expand all
31 // Represents a capture device name and ID. 31 // Represents a capture device name and ID.
32 // You should not create an instance of this class directly by e.g. setting 32 // You should not create an instance of this class directly by e.g. setting
33 // various properties directly. Instead use 33 // various properties directly. Instead use
34 // VideoCaptureDevice::GetDeviceNames to do this for you and if you need to 34 // VideoCaptureDevice::GetDeviceNames to do this for you and if you need to
35 // cache your own copy of a name, you can do so via the copy constructor. 35 // cache your own copy of a name, you can do so via the copy constructor.
36 // The reason for this is that a device name might contain platform specific 36 // The reason for this is that a device name might contain platform specific
37 // settings that are relevant only to the platform specific implementation of 37 // settings that are relevant only to the platform specific implementation of
38 // VideoCaptureDevice::Create. 38 // VideoCaptureDevice::Create.
39 class MEDIA_EXPORT Name { 39 class MEDIA_EXPORT Name {
40 public: 40 public:
41 Name() {} 41 Name();
42 Name(const std::string& name, const std::string& id) 42 Name(const std::string& name, const std::string& id);
43 : device_name_(name), unique_id_(id) {}
44 43
45 #if defined(OS_WIN) 44 #if defined(OS_WIN)
46 // Windows targets Capture Api type: it can only be set on construction. 45 // Windows targets Capture Api type: it can only be set on construction.
47 enum CaptureApiType { 46 enum CaptureApiType {
48 MEDIA_FOUNDATION, 47 MEDIA_FOUNDATION,
49 DIRECT_SHOW, 48 DIRECT_SHOW,
50 API_TYPE_UNKNOWN 49 API_TYPE_UNKNOWN
51 }; 50 };
52 #endif 51 #endif
53 #if defined(OS_MACOSX) 52 #if defined(OS_MACOSX)
54 // Mac targets Capture Api type: it can only be set on construction. 53 // Mac targets Capture Api type: it can only be set on construction.
55 enum CaptureApiType { 54 enum CaptureApiType {
56 AVFOUNDATION, 55 AVFOUNDATION,
57 QTKIT, 56 QTKIT,
58 API_TYPE_UNKNOWN 57 API_TYPE_UNKNOWN
59 }; 58 };
59 // For AVFoundation Api, identify devices that are built-in or USB.
60 enum TransportType {
61 USB_OR_BUILT_IN,
62 OTHER_TRANSPORT
63 };
60 #endif 64 #endif
61 #if defined(OS_WIN) || defined(OS_MACOSX) 65 #if defined(OS_WIN) || defined(OS_MACOSX)
62 Name(const std::string& name, 66 Name(const std::string& name,
63 const std::string& id, 67 const std::string& id,
64 const CaptureApiType api_type) 68 const CaptureApiType api_type);
65 : device_name_(name), unique_id_(id), capture_api_class_(api_type) {}
66 #endif 69 #endif
67 ~Name() {} 70 #if defined(OS_MACOSX)
71 Name(const std::string& name,
72 const std::string& id,
73 const CaptureApiType api_type,
74 const TransportType transport_type);
75 #endif
76 ~Name();
68 77
69 // Friendly name of a device 78 // Friendly name of a device
70 const std::string& name() const { return device_name_; } 79 const std::string& name() const { return device_name_; }
71 80
72 // Unique name of a device. Even if there are multiple devices with the same 81 // Unique name of a device. Even if there are multiple devices with the same
73 // friendly name connected to the computer this will be unique. 82 // friendly name connected to the computer this will be unique.
74 const std::string& id() const { return unique_id_; } 83 const std::string& id() const { return unique_id_; }
75 84
76 // The unique hardware model identifier of the capture device. Returns 85 // The unique hardware model identifier of the capture device. Returns
77 // "[vid]:[pid]" when a USB device is detected, otherwise "". 86 // "[vid]:[pid]" when a USB device is detected, otherwise "".
(...skipping 10 matching lines...) Expand all
88 return other.id() == unique_id_; 97 return other.id() == unique_id_;
89 } 98 }
90 bool operator<(const Name& other) const { 99 bool operator<(const Name& other) const {
91 return unique_id_ < other.id(); 100 return unique_id_ < other.id();
92 } 101 }
93 102
94 #if defined(OS_WIN) || defined(OS_MACOSX) 103 #if defined(OS_WIN) || defined(OS_MACOSX)
95 CaptureApiType capture_api_type() const { 104 CaptureApiType capture_api_type() const {
96 return capture_api_class_.capture_api_type(); 105 return capture_api_class_.capture_api_type();
97 } 106 }
107 #endif
108 #if defined(OS_MACOSX)
109 TransportType transport_type() const {
110 return transport_type_;
111 }
98 #endif // if defined(OS_WIN) 112 #endif // if defined(OS_WIN)
99 113
100 private: 114 private:
101 std::string device_name_; 115 std::string device_name_;
102 std::string unique_id_; 116 std::string unique_id_;
103 #if defined(OS_WIN) || defined(OS_MACOSX) 117 #if defined(OS_WIN) || defined(OS_MACOSX)
104 // This class wraps the CaptureApiType to give it a by default value if not 118 // This class wraps the CaptureApiType to give it a by default value if not
105 // initialized. 119 // initialized.
106 class CaptureApiClass { 120 class CaptureApiClass {
107 public: 121 public:
108 CaptureApiClass(): capture_api_type_(API_TYPE_UNKNOWN) {} 122 CaptureApiClass(): capture_api_type_(API_TYPE_UNKNOWN) {}
109 CaptureApiClass(const CaptureApiType api_type) 123 CaptureApiClass(const CaptureApiType api_type)
110 : capture_api_type_(api_type) {} 124 : capture_api_type_(api_type) {}
111 CaptureApiType capture_api_type() const { 125 CaptureApiType capture_api_type() const {
112 DCHECK_NE(capture_api_type_, API_TYPE_UNKNOWN); 126 DCHECK_NE(capture_api_type_, API_TYPE_UNKNOWN);
113 return capture_api_type_; 127 return capture_api_type_;
114 } 128 }
115 private: 129 private:
116 CaptureApiType capture_api_type_; 130 CaptureApiType capture_api_type_;
117 }; 131 };
118 132
119 CaptureApiClass capture_api_class_; 133 CaptureApiClass capture_api_class_;
120 #endif 134 #endif
135 #if defined(OS_MACOSX)
136 TransportType transport_type_;
137 #endif
121 // Allow generated copy constructor and assignment. 138 // Allow generated copy constructor and assignment.
122 }; 139 };
123 140
124 // Manages a list of Name entries. 141 // Manages a list of Name entries.
125 typedef std::list<Name> Names; 142 typedef std::list<Name> Names;
126 143
127 class MEDIA_EXPORT Client { 144 class MEDIA_EXPORT Client {
128 public: 145 public:
129 // Memory buffer returned by Client::ReserveOutputBuffer(). 146 // Memory buffer returned by Client::ReserveOutputBuffer().
130 class Buffer : public base::RefCountedThreadSafe<Buffer> { 147 class Buffer : public base::RefCountedThreadSafe<Buffer> {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 int GetPowerLineFrequencyForLocation() const; 250 int GetPowerLineFrequencyForLocation() const;
234 251
235 protected: 252 protected:
236 static const int kPowerLine50Hz = 50; 253 static const int kPowerLine50Hz = 50;
237 static const int kPowerLine60Hz = 60; 254 static const int kPowerLine60Hz = 60;
238 }; 255 };
239 256
240 } // namespace media 257 } // namespace media
241 258
242 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ 259 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_
OLDNEW
« no previous file with comments | « media/video/capture/mac/video_capture_device_qtkit_mac.mm ('k') | media/video/capture/video_capture_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698