| 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. |
| 11 | 11 |
| 12 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 12 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
| 13 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 13 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
| 14 | 14 |
| 15 #include <list> | 15 #include <list> |
| 16 #include <string> | 16 #include <string> |
| 17 | 17 |
| 18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "media/base/media_export.h" | 20 #include "media/base/media_export.h" |
| 21 #include "media/base/video_frame.h" | |
| 22 #include "media/video/capture/video_capture_types.h" | 21 #include "media/video/capture/video_capture_types.h" |
| 23 | 22 |
| 24 namespace media { | 23 namespace media { |
| 25 | 24 |
| 26 class MEDIA_EXPORT VideoCaptureDevice { | 25 class MEDIA_EXPORT VideoCaptureDevice { |
| 27 public: | 26 public: |
| 28 // Represents a capture device name and ID. | 27 // Represents a capture device name and ID. |
| 29 // You should not create an instance of this class directly by e.g. setting | 28 // You should not create an instance of this class directly by e.g. setting |
| 30 // various properties directly. Instead use | 29 // various properties directly. Instead use |
| 31 // VideoCaptureDevice::GetDeviceNames to do this for you and if you need to | 30 // VideoCaptureDevice::GetDeviceNames to do this for you and if you need to |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 private: | 102 private: |
| 104 CaptureApiType capture_api_type_; | 103 CaptureApiType capture_api_type_; |
| 105 }; | 104 }; |
| 106 | 105 |
| 107 CaptureApiClass capture_api_class_; | 106 CaptureApiClass capture_api_class_; |
| 108 #endif // if defined(OS_WIN) | 107 #endif // if defined(OS_WIN) |
| 109 // Allow generated copy constructor and assignment. | 108 // Allow generated copy constructor and assignment. |
| 110 }; | 109 }; |
| 111 | 110 |
| 112 // Manages a list of Name entries. | 111 // Manages a list of Name entries. |
| 113 typedef std::list<Name> Names; | 112 class MEDIA_EXPORT Names |
| 113 : public NON_EXPORTED_BASE(std::list<Name>) { |
| 114 public: |
| 115 // Returns NULL if no entry was found by that ID. |
| 116 Name* FindById(const std::string& id); |
| 117 |
| 118 // Allow generated copy constructor and assignment. |
| 119 }; |
| 114 | 120 |
| 115 class MEDIA_EXPORT Client { | 121 class MEDIA_EXPORT Client { |
| 116 public: | 122 public: |
| 117 virtual ~Client() {} | 123 virtual ~Client() {} |
| 118 | 124 |
| 119 // Reserve an output buffer into which a video frame can be captured | 125 // Reserve an output buffer into which a video frame can be captured |
| 120 // directly. If all buffers are currently busy, returns NULL. | 126 // directly. If all buffers are currently busy, returns NULL. |
| 121 // | 127 // |
| 122 // The returned VideoFrames will always be allocated with a YV12 format and | 128 // The returned VideoFrames will always be allocated with a YV12 format and |
| 123 // have dimensions matching |size|. It is the VideoCaptureDevice's | 129 // have dimensions matching |size|. It is the VideoCaptureDevice's |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 // If deallocation is done asynchronously, then the device implementation must | 212 // If deallocation is done asynchronously, then the device implementation must |
| 207 // ensure that a subsequent AllocateAndStart() operation targeting the same ID | 213 // ensure that a subsequent AllocateAndStart() operation targeting the same ID |
| 208 // would be sequenced through the same task runner, so that deallocation | 214 // would be sequenced through the same task runner, so that deallocation |
| 209 // happens first. | 215 // happens first. |
| 210 virtual void StopAndDeAllocate() = 0; | 216 virtual void StopAndDeAllocate() = 0; |
| 211 }; | 217 }; |
| 212 | 218 |
| 213 } // namespace media | 219 } // namespace media |
| 214 | 220 |
| 215 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 221 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
| OLD | NEW |