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

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

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

Powered by Google App Engine
This is Rietveld 408576698