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

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

Issue 229063003: Mac AVFoundation: use QTKit for cameras not working with AVF (Blackmagic). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: //static Created 6 years, 8 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 30 matching lines...) Expand all
41 Name(const std::string& name, const std::string& id) 41 Name(const std::string& name, const std::string& id)
42 : device_name_(name), unique_id_(id) {} 42 : device_name_(name), unique_id_(id) {}
43 43
44 #if defined(OS_WIN) 44 #if defined(OS_WIN)
45 // 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.
46 enum CaptureApiType { 46 enum CaptureApiType {
47 MEDIA_FOUNDATION, 47 MEDIA_FOUNDATION,
48 DIRECT_SHOW, 48 DIRECT_SHOW,
49 API_TYPE_UNKNOWN 49 API_TYPE_UNKNOWN
50 }; 50 };
51 51 #endif
52 #if defined(OS_MACOSX)
53 // Mac targets Capture Api type: it can only be set on construction.
54 enum CaptureApiType {
55 AVFOUNDATION,
56 QTKIT,
57 API_TYPE_UNKNOWN
58 };
59 #endif
60 #if defined(OS_WIN) || defined(OS_MACOSX)
52 Name(const std::string& name, 61 Name(const std::string& name,
53 const std::string& id, 62 const std::string& id,
54 const CaptureApiType api_type) 63 const CaptureApiType api_type)
55 : device_name_(name), unique_id_(id), capture_api_class_(api_type) {} 64 : device_name_(name), unique_id_(id), capture_api_class_(api_type) {}
56 #endif // if defined(OS_WIN) 65 #endif
57 ~Name() {} 66 ~Name() {}
58 67
59 // Friendly name of a device 68 // Friendly name of a device
60 const std::string& name() const { return device_name_; } 69 const std::string& name() const { return device_name_; }
61 70
62 // Unique name of a device. Even if there are multiple devices with the same 71 // Unique name of a device. Even if there are multiple devices with the same
63 // friendly name connected to the computer this will be unique. 72 // friendly name connected to the computer this will be unique.
64 const std::string& id() const { return unique_id_; } 73 const std::string& id() const { return unique_id_; }
65 74
66 // The unique hardware model identifier of the capture device. Returns 75 // The unique hardware model identifier of the capture device. Returns
67 // "[vid]:[pid]" when a USB device is detected, otherwise "". 76 // "[vid]:[pid]" when a USB device is detected, otherwise "".
68 // The implementation of this method is platform-dependent. 77 // The implementation of this method is platform-dependent.
69 const std::string GetModel() const; 78 const std::string GetModel() const;
70 79
71 // Friendly name of a device, plus the model identifier in parentheses. 80 // Friendly name of a device, plus the model identifier in parentheses.
72 const std::string GetNameAndModel() const; 81 const std::string GetNameAndModel() const;
73 82
74 // These operators are needed due to storing the name in an STL container. 83 // These operators are needed due to storing the name in an STL container.
75 // In the shared build, all methods from the STL container will be exported 84 // In the shared build, all methods from the STL container will be exported
76 // so even though they're not used, they're still depended upon. 85 // so even though they're not used, they're still depended upon.
77 bool operator==(const Name& other) const { 86 bool operator==(const Name& other) const {
78 return other.id() == unique_id_; 87 return other.id() == unique_id_;
79 } 88 }
80 bool operator<(const Name& other) const { 89 bool operator<(const Name& other) const {
81 return unique_id_ < other.id(); 90 return unique_id_ < other.id();
82 } 91 }
83 92
84 #if defined(OS_WIN) 93 #if defined(OS_WIN) || defined(OS_MACOSX)
85 CaptureApiType capture_api_type() const { 94 CaptureApiType capture_api_type() const {
86 return capture_api_class_.capture_api_type(); 95 return capture_api_class_.capture_api_type();
87 } 96 }
88 #endif // if defined(OS_WIN) 97 #endif // if defined(OS_WIN)
89 98
90 private: 99 private:
91 std::string device_name_; 100 std::string device_name_;
92 std::string unique_id_; 101 std::string unique_id_;
93 #if defined(OS_WIN) 102 #if defined(OS_WIN) || defined(OS_MACOSX)
94 // This class wraps the CaptureApiType, so it has a by default value if not 103 // This class wraps the CaptureApiType to give it a by default value if not
95 // inititalized, and I (mcasas) do a DCHECK on reading its value. 104 // initialized.
96 class CaptureApiClass { 105 class CaptureApiClass {
97 public: 106 public:
98 CaptureApiClass(): capture_api_type_(API_TYPE_UNKNOWN) {} 107 CaptureApiClass(): capture_api_type_(API_TYPE_UNKNOWN) {}
99 CaptureApiClass(const CaptureApiType api_type) 108 CaptureApiClass(const CaptureApiType api_type)
100 : capture_api_type_(api_type) {} 109 : capture_api_type_(api_type) {}
101 CaptureApiType capture_api_type() const { 110 CaptureApiType capture_api_type() const {
102 DCHECK_NE(capture_api_type_, API_TYPE_UNKNOWN); 111 DCHECK_NE(capture_api_type_, API_TYPE_UNKNOWN);
103 return capture_api_type_; 112 return capture_api_type_;
104 } 113 }
105 private: 114 private:
106 CaptureApiType capture_api_type_; 115 CaptureApiType capture_api_type_;
107 }; 116 };
108 117
109 CaptureApiClass capture_api_class_; 118 CaptureApiClass capture_api_class_;
110 #endif // if defined(OS_WIN) 119 #endif
111 // Allow generated copy constructor and assignment. 120 // Allow generated copy constructor and assignment.
112 }; 121 };
113 122
114 // Manages a list of Name entries. 123 // Manages a list of Name entries.
115 typedef std::list<Name> Names; 124 typedef std::list<Name> Names;
116 125
117 class MEDIA_EXPORT Client { 126 class MEDIA_EXPORT Client {
118 public: 127 public:
119 // Memory buffer returned by Client::ReserveOutputBuffer(). 128 // Memory buffer returned by Client::ReserveOutputBuffer().
120 class Buffer : public base::RefCountedThreadSafe<Buffer> { 129 class Buffer : public base::RefCountedThreadSafe<Buffer> {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 int GetPowerLineFrequencyForLocation() const; 227 int GetPowerLineFrequencyForLocation() const;
219 228
220 protected: 229 protected:
221 static const int kPowerLine50Hz = 50; 230 static const int kPowerLine50Hz = 50;
222 static const int kPowerLine60Hz = 60; 231 static const int kPowerLine60Hz = 60;
223 }; 232 };
224 233
225 } // namespace media 234 } // namespace media
226 235
227 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ 236 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698