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

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

Issue 941833004: VideoCaptureDevice: refactor Client::Buffer into an interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: perkj@ comment Created 5 years, 10 months 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
« no previous file with comments | « content/browser/renderer_host/media/video_capture_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 // Interface defining the methods that clients of VideoCapture must have. It 169 // Interface defining the methods that clients of VideoCapture must have. It
170 // is actually two-in-one: clients may implement OnIncomingCapturedData() or 170 // is actually two-in-one: clients may implement OnIncomingCapturedData() or
171 // ReserveOutputBuffer() + OnIncomingCapturedVideoFrame(), or all of them. 171 // ReserveOutputBuffer() + OnIncomingCapturedVideoFrame(), or all of them.
172 // All clients must implement OnError(). 172 // All clients must implement OnError().
173 class MEDIA_EXPORT Client { 173 class MEDIA_EXPORT Client {
174 public: 174 public:
175 // Memory buffer returned by Client::ReserveOutputBuffer(). 175 // Memory buffer returned by Client::ReserveOutputBuffer().
176 class Buffer : public base::RefCountedThreadSafe<Buffer> { 176 class Buffer : public base::RefCountedThreadSafe<Buffer> {
177 public: 177 public:
178 int id() const { return id_; } 178 virtual int id() const = 0;
179 void* data() const { return data_; } 179 virtual void* data() const = 0;
180 size_t size() const { return size_; } 180 virtual size_t size() const = 0;
181 181
182 protected: 182 protected:
183 friend class base::RefCountedThreadSafe<Buffer>; 183 friend class base::RefCountedThreadSafe<Buffer>;
184
185 Buffer(int id, void* data, size_t size)
186 : id_(id), data_(data), size_(size) {}
187 virtual ~Buffer() {} 184 virtual ~Buffer() {}
188
189 const int id_;
190 void* const data_;
191 const size_t size_;
192 }; 185 };
193 186
194 virtual ~Client() {} 187 virtual ~Client() {}
195 188
196 // Captured a new video frame, data for which is pointed to by |data|. 189 // Captured a new video frame, data for which is pointed to by |data|.
197 // 190 //
198 // The format of the frame is described by |frame_format|, and is assumed to 191 // The format of the frame is described by |frame_format|, and is assumed to
199 // be tightly packed. This method will try to reserve an output buffer and 192 // be tightly packed. This method will try to reserve an output buffer and
200 // copy from |data| into the output buffer. If no output buffer is 193 // copy from |data| into the output buffer. If no output buffer is
201 // available, the frame will be silently dropped. 194 // available, the frame will be silently dropped.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 virtual void CaptureImage() {} 318 virtual void CaptureImage() {}
326 319
327 protected: 320 protected:
328 static const int kPowerLine50Hz = 50; 321 static const int kPowerLine50Hz = 50;
329 static const int kPowerLine60Hz = 60; 322 static const int kPowerLine60Hz = 60;
330 }; 323 };
331 324
332 } // namespace media 325 } // namespace media
333 326
334 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ 327 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698