| OLD | NEW |
| 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 13 matching lines...) Expand all Loading... |
| 24 class MEDIA_EXPORT VideoCaptureDevice { | 24 class MEDIA_EXPORT VideoCaptureDevice { |
| 25 public: | 25 public: |
| 26 | 26 |
| 27 struct Name { | 27 struct Name { |
| 28 // Friendly name of a device | 28 // Friendly name of a device |
| 29 std::string device_name; | 29 std::string device_name; |
| 30 | 30 |
| 31 // Unique name of a device. Even if there are multiple devices with the same | 31 // Unique name of a device. Even if there are multiple devices with the same |
| 32 // friendly name connected to the computer this will be unique. | 32 // friendly name connected to the computer this will be unique. |
| 33 std::string unique_id; | 33 std::string unique_id; |
| 34 |
| 35 #if defined(OS_WIN) |
| 36 enum CaptureApiType { |
| 37 DIRECT_SHOW, |
| 38 MEDIA_FOUNDATION, |
| 39 }; |
| 40 CaptureApiType capture_api_type; |
| 41 // Following operators are needed to call std::list methods merge() and |
| 42 // unique(). These are used when creating the Windows device names list. |
| 43 bool operator==(const Name& other) { |
| 44 return (unique_id == other.unique_id); |
| 45 } |
| 46 bool operator<(const Name& other) { |
| 47 return (unique_id < other.unique_id); |
| 48 } |
| 49 #endif //if defined(OS_WIN) |
| 34 }; | 50 }; |
| 35 typedef std::list<Name> Names; | 51 typedef std::list<Name> Names; |
| 36 | 52 |
| 37 class MEDIA_EXPORT EventHandler { | 53 class MEDIA_EXPORT EventHandler { |
| 38 public: | 54 public: |
| 39 | 55 |
| 40 // Reserve an output buffer into which a video frame can be captured | 56 // Reserve an output buffer into which a video frame can be captured |
| 41 // directly. If all buffers are currently busy, returns NULL. | 57 // directly. If all buffers are currently busy, returns NULL. |
| 42 // | 58 // |
| 43 // The returned VideoFrames will always be allocated with a YV12 format. The | 59 // The returned VideoFrames will always be allocated with a YV12 format. The |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // not permitted to make any additional calls to its EventHandler. | 149 // not permitted to make any additional calls to its EventHandler. |
| 134 virtual void DeAllocate() = 0; | 150 virtual void DeAllocate() = 0; |
| 135 | 151 |
| 136 // Get the name of the capture device. | 152 // Get the name of the capture device. |
| 137 virtual const Name& device_name() = 0; | 153 virtual const Name& device_name() = 0; |
| 138 }; | 154 }; |
| 139 | 155 |
| 140 } // namespace media | 156 } // namespace media |
| 141 | 157 |
| 142 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 158 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
| OLD | NEW |