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

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

Issue 83633008: Reland: Reorganize media::VideoCapture* types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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.
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/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "media/base/media_export.h" 22 #include "media/base/media_export.h"
23 #include "media/base/video_frame.h"
23 #include "media/video/capture/video_capture_types.h" 24 #include "media/video/capture/video_capture_types.h"
24 25
25 namespace media { 26 namespace media {
26 27
27 class MEDIA_EXPORT VideoCaptureDevice { 28 class MEDIA_EXPORT VideoCaptureDevice {
28 public: 29 public:
29 // Represents a capture device name and ID. 30 // Represents a capture device name and ID.
30 // You should not create an instance of this class directly by e.g. setting 31 // You should not create an instance of this class directly by e.g. setting
31 // various properties directly. Instead use 32 // various properties directly. Instead use
32 // VideoCaptureDevice::GetDeviceNames to do this for you and if you need to 33 // VideoCaptureDevice::GetDeviceNames to do this for you and if you need to
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // This method will try to reserve an output buffer and copy from |data| 166 // This method will try to reserve an output buffer and copy from |data|
166 // into the output buffer. If no output buffer is available, the frame will 167 // into the output buffer. If no output buffer is available, the frame will
167 // be silently dropped. 168 // be silently dropped.
168 virtual void OnIncomingCapturedFrame( 169 virtual void OnIncomingCapturedFrame(
169 const uint8* data, 170 const uint8* data,
170 int length, 171 int length,
171 base::Time timestamp, 172 base::Time timestamp,
172 int rotation, // Clockwise. 173 int rotation, // Clockwise.
173 bool flip_vert, 174 bool flip_vert,
174 bool flip_horiz, 175 bool flip_horiz,
175 const VideoCaptureCapability& frame_info) = 0; 176 const VideoCaptureFormat& frame_format) = 0;
176 177
177 // Captured a new video frame, held in |buffer|. 178 // Captured a new video frame, held in |buffer|.
178 // 179 //
179 // As the frame is backed by a reservation returned by 180 // As the frame is backed by a reservation returned by
180 // ReserveOutputBuffer(), delivery is guaranteed and will require no 181 // ReserveOutputBuffer(), delivery is guaranteed and will require no
181 // additional copies in the browser process. |dimensions| indicates the 182 // additional copies in the browser process. |dimensions| indicates the
182 // frame width and height of the buffer contents; this is assumed to be of 183 // frame width and height of the buffer contents; this is assumed to be of
183 // |format| format and tightly packed. 184 // |format| format and tightly packed.
184 virtual void OnIncomingCapturedBuffer(const scoped_refptr<Buffer>& buffer, 185 virtual void OnIncomingCapturedBuffer(const scoped_refptr<Buffer>& buffer,
185 media::VideoFrame::Format format, 186 media::VideoFrame::Format format,
(...skipping 15 matching lines...) Expand all
201 static void GetDeviceNames(Names* device_names); 202 static void GetDeviceNames(Names* device_names);
202 203
203 // Gets the capabilities of a particular device attached to the system. This 204 // Gets the capabilities of a particular device attached to the system. This
204 // method should be called before allocating or starting a device. In case 205 // method should be called before allocating or starting a device. In case
205 // format enumeration is not supported, or there was a problem, the formats 206 // format enumeration is not supported, or there was a problem, the formats
206 // array will be empty. 207 // array will be empty.
207 static void GetDeviceSupportedFormats(const Name& device, 208 static void GetDeviceSupportedFormats(const Name& device,
208 VideoCaptureCapabilities* formats); 209 VideoCaptureCapabilities* formats);
209 210
210 // Prepare the camera for use. After this function has been called no other 211 // Prepare the camera for use. After this function has been called no other
211 // applications can use the camera. On completion Client::OnFrameInfo() 212 // applications can use the camera. StopAndDeAllocate() must be called before
212 // is called informing of the resulting resolution and frame rate. 213 // the object is deleted.
213 // StopAndDeAllocate() must be called before the object is deleted. 214 virtual void AllocateAndStart(const VideoCaptureParams& params,
214 virtual void AllocateAndStart( 215 scoped_ptr<Client> client) = 0;
215 const VideoCaptureCapability& capture_format,
216 scoped_ptr<Client> client) = 0;
217 216
218 // Deallocates the camera, possibly asynchronously. 217 // Deallocates the camera, possibly asynchronously.
219 // 218 //
220 // This call requires the device to do the following things, eventually: put 219 // This call requires the device to do the following things, eventually: put
221 // camera hardware into a state where other applications could use it, free 220 // camera hardware into a state where other applications could use it, free
222 // the memory associated with capture, and delete the |client| pointer passed 221 // the memory associated with capture, and delete the |client| pointer passed
223 // into AllocateAndStart. 222 // into AllocateAndStart.
224 // 223 //
225 // If deallocation is done asynchronously, then the device implementation must 224 // If deallocation is done asynchronously, then the device implementation must
226 // ensure that a subsequent AllocateAndStart() operation targeting the same ID 225 // ensure that a subsequent AllocateAndStart() operation targeting the same ID
227 // would be sequenced through the same task runner, so that deallocation 226 // would be sequenced through the same task runner, so that deallocation
228 // happens first. 227 // happens first.
229 virtual void StopAndDeAllocate() = 0; 228 virtual void StopAndDeAllocate() = 0;
230 }; 229 };
231 230
232 } // namespace media 231 } // namespace media
233 232
234 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ 233 #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_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698