| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURE_FRAME_H_ | |
| 6 #define MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURE_FRAME_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "media/base/media_export.h" | |
| 12 #include "media/video/capture/screen/shared_buffer.h" | |
| 13 #include "third_party/skia/include/core/SkSize.h" | |
| 14 #include "third_party/skia/include/core/SkTypes.h" | |
| 15 | |
| 16 namespace media { | |
| 17 | |
| 18 // Represents a video frame. | |
| 19 class MEDIA_EXPORT ScreenCaptureFrame { | |
| 20 public: | |
| 21 virtual ~ScreenCaptureFrame(); | |
| 22 | |
| 23 int bytes_per_row() const { return bytes_per_row_; } | |
| 24 const SkISize& dimensions() const { return dimensions_; } | |
| 25 uint8* pixels() const { return pixels_; } | |
| 26 const scoped_refptr<SharedBuffer>& shared_buffer() const { | |
| 27 return shared_buffer_; | |
| 28 } | |
| 29 | |
| 30 protected: | |
| 31 // Initializes an empty video frame. Derived classes are expected to allocate | |
| 32 // memory for the frame in a platform-specific way and set the properties of | |
| 33 // the allocated frame. | |
| 34 ScreenCaptureFrame(); | |
| 35 | |
| 36 void set_bytes_per_row(int bytes_per_row) { | |
| 37 bytes_per_row_ = bytes_per_row; | |
| 38 } | |
| 39 | |
| 40 void set_dimensions(const SkISize& dimensions) { dimensions_ = dimensions; } | |
| 41 void set_pixels(uint8* ptr) { pixels_ = ptr; } | |
| 42 void set_shared_buffer(scoped_refptr<SharedBuffer> shared_buffer) { | |
| 43 shared_buffer_ = shared_buffer; | |
| 44 } | |
| 45 | |
| 46 private: | |
| 47 // Bytes per row of pixels including necessary padding. | |
| 48 int bytes_per_row_; | |
| 49 | |
| 50 // Dimensions of the buffer in pixels. | |
| 51 SkISize dimensions_; | |
| 52 | |
| 53 // Points to the pixel buffer. | |
| 54 uint8* pixels_; | |
| 55 | |
| 56 // Points to an optional shared memory buffer that backs up |pixels_| buffer. | |
| 57 scoped_refptr<SharedBuffer> shared_buffer_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureFrame); | |
| 60 }; | |
| 61 | |
| 62 } // namespace media | |
| 63 | |
| 64 #endif // MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURE_FRAME_H_ | |
| OLD | NEW |