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