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_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ | 12 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ |
13 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ | 13 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ |
14 | 14 |
15 #include <stddef.h> | 15 #include <stddef.h> |
16 #include <stdint.h> | 16 #include <stdint.h> |
17 | 17 |
18 #include <list> | 18 #include <list> |
19 #include <memory> | 19 #include <memory> |
20 #include <string> | 20 #include <string> |
21 | 21 |
22 #include "base/files/file.h" | 22 #include "base/files/file.h" |
23 #include "base/logging.h" | 23 #include "base/logging.h" |
24 #include "base/memory/ref_counted.h" | 24 #include "base/memory/ref_counted.h" |
25 #include "base/single_thread_task_runner.h" | 25 #include "base/single_thread_task_runner.h" |
26 #include "base/time/time.h" | 26 #include "base/time/time.h" |
27 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 28 #include "media/base/media_export.h" |
28 #include "media/base/video_capture_types.h" | 29 #include "media/base/video_capture_types.h" |
29 #include "media/base/video_frame.h" | 30 #include "media/base/video_frame.h" |
30 #include "media/capture/capture_export.h" | |
31 #include "media/capture/video/scoped_result_callback.h" | 31 #include "media/capture/video/scoped_result_callback.h" |
32 #include "mojo/public/cpp/bindings/array.h" | 32 #include "mojo/public/cpp/bindings/array.h" |
33 #include "mojo/public/cpp/bindings/callback.h" | 33 #include "mojo/public/cpp/bindings/callback.h" |
34 #include "ui/gfx/gpu_memory_buffer.h" | 34 #include "ui/gfx/gpu_memory_buffer.h" |
35 | 35 |
36 namespace tracked_objects { | 36 namespace tracked_objects { |
37 class Location; | 37 class Location; |
38 } // namespace tracked_objects | 38 } // namespace tracked_objects |
39 | 39 |
40 namespace media { | 40 namespace media { |
41 | 41 |
42 class CAPTURE_EXPORT VideoCaptureDevice { | 42 class MEDIA_EXPORT VideoCaptureDevice { |
43 public: | 43 public: |
44 // Represents a capture device name and ID. | 44 // Represents a capture device name and ID. |
45 // You should not create an instance of this class directly by e.g. setting | 45 // You should not create an instance of this class directly by e.g. setting |
46 // various properties directly. Instead use | 46 // various properties directly. Instead use |
47 // VideoCaptureDevice::GetDeviceNames to do this for you and if you need to | 47 // VideoCaptureDevice::GetDeviceNames to do this for you and if you need to |
48 // cache your own copy of a name, you can do so via the copy constructor. | 48 // cache your own copy of a name, you can do so via the copy constructor. |
49 // The reason for this is that a device name might contain platform specific | 49 // The reason for this is that a device name might contain platform specific |
50 // settings that are relevant only to the platform specific implementation of | 50 // settings that are relevant only to the platform specific implementation of |
51 // VideoCaptureDevice::Create. | 51 // VideoCaptureDevice::Create. |
52 class CAPTURE_EXPORT Name { | 52 class MEDIA_EXPORT Name { |
53 public: | 53 public: |
54 Name(); | 54 Name(); |
55 Name(const std::string& name, const std::string& id); | 55 Name(const std::string& name, const std::string& id); |
56 | 56 |
57 #if defined(OS_LINUX) | 57 #if defined(OS_LINUX) |
58 // Linux/CrOS targets Capture Api type: it can only be set on construction. | 58 // Linux/CrOS targets Capture Api type: it can only be set on construction. |
59 enum CaptureApiType { | 59 enum CaptureApiType { |
60 V4L2_SINGLE_PLANE, | 60 V4L2_SINGLE_PLANE, |
61 API_TYPE_UNKNOWN | 61 API_TYPE_UNKNOWN |
62 }; | 62 }; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // Allow generated copy constructor and assignment. | 172 // Allow generated copy constructor and assignment. |
173 }; | 173 }; |
174 | 174 |
175 // Manages a list of Name entries. | 175 // Manages a list of Name entries. |
176 typedef std::list<Name> Names; | 176 typedef std::list<Name> Names; |
177 | 177 |
178 // Interface defining the methods that clients of VideoCapture must have. It | 178 // Interface defining the methods that clients of VideoCapture must have. It |
179 // is actually two-in-one: clients may implement OnIncomingCapturedData() or | 179 // is actually two-in-one: clients may implement OnIncomingCapturedData() or |
180 // ReserveOutputBuffer() + OnIncomingCapturedVideoFrame(), or all of them. | 180 // ReserveOutputBuffer() + OnIncomingCapturedVideoFrame(), or all of them. |
181 // All clients must implement OnError(). | 181 // All clients must implement OnError(). |
182 class CAPTURE_EXPORT Client { | 182 class MEDIA_EXPORT Client { |
183 public: | 183 public: |
184 // Memory buffer returned by Client::ReserveOutputBuffer(). | 184 // Memory buffer returned by Client::ReserveOutputBuffer(). |
185 class CAPTURE_EXPORT Buffer { | 185 class MEDIA_EXPORT Buffer { |
186 public: | 186 public: |
187 virtual ~Buffer() = 0; | 187 virtual ~Buffer() = 0; |
188 virtual int id() const = 0; | 188 virtual int id() const = 0; |
189 virtual gfx::Size dimensions() const = 0; | 189 virtual gfx::Size dimensions() const = 0; |
190 virtual size_t mapped_size() const = 0; | 190 virtual size_t mapped_size() const = 0; |
191 virtual void* data(int plane) = 0; | 191 virtual void* data(int plane) = 0; |
192 void* data() { return data(0); } | 192 void* data() { return data(0); } |
193 virtual ClientBuffer AsClientBuffer(int plane) = 0; | 193 virtual ClientBuffer AsClientBuffer(int plane) = 0; |
194 #if defined(OS_POSIX) && !(defined(OS_MACOSX) && !defined(OS_IOS)) | 194 #if defined(OS_POSIX) && !(defined(OS_MACOSX) && !defined(OS_IOS)) |
195 virtual base::FileDescriptor AsPlatformFile() = 0; | 195 virtual base::FileDescriptor AsPlatformFile() = 0; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 326 |
327 private: | 327 private: |
328 // Gets the power line frequency from the current system time zone if this is | 328 // Gets the power line frequency from the current system time zone if this is |
329 // defined, otherwise returns 0. | 329 // defined, otherwise returns 0. |
330 PowerLineFrequency GetPowerLineFrequencyForLocation() const; | 330 PowerLineFrequency GetPowerLineFrequencyForLocation() const; |
331 }; | 331 }; |
332 | 332 |
333 } // namespace media | 333 } // namespace media |
334 | 334 |
335 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ | 335 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |