| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 // DPI of the screen being captured. May be set to zero, e.g. if DPI is | 50 // DPI of the screen being captured. May be set to zero, e.g. if DPI is |
| 51 // unknown. | 51 // unknown. |
| 52 const DesktopVector& dpi() const { return dpi_; } | 52 const DesktopVector& dpi() const { return dpi_; } |
| 53 void set_dpi(const DesktopVector& dpi) { dpi_ = dpi; } | 53 void set_dpi(const DesktopVector& dpi) { dpi_ = dpi; } |
| 54 | 54 |
| 55 // Time taken to capture the frame in milliseconds. | 55 // Time taken to capture the frame in milliseconds. |
| 56 int64_t capture_time_ms() const { return capture_time_ms_; } | 56 int64_t capture_time_ms() const { return capture_time_ms_; } |
| 57 void set_capture_time_ms(int64_t time_ms) { capture_time_ms_ = time_ms; } | 57 void set_capture_time_ms(int64_t time_ms) { capture_time_ms_ = time_ms; } |
| 58 | 58 |
| 59 // Optional shape for the frame. Frames may be shaped e.g. if | |
| 60 // capturing the contents of a shaped window. | |
| 61 const DesktopRegion* shape() const { return shape_.get(); } | |
| 62 void set_shape(DesktopRegion* shape) { shape_.reset(shape); } | |
| 63 | |
| 64 // Copies pixels from a buffer or another frame. |dest_rect| rect must lay | 59 // Copies pixels from a buffer or another frame. |dest_rect| rect must lay |
| 65 // within bounds of this frame. | 60 // within bounds of this frame. |
| 66 void CopyPixelsFrom(uint8_t* src_buffer, int src_stride, | 61 void CopyPixelsFrom(uint8_t* src_buffer, int src_stride, |
| 67 const DesktopRect& dest_rect); | 62 const DesktopRect& dest_rect); |
| 68 void CopyPixelsFrom(const DesktopFrame& src_frame, | 63 void CopyPixelsFrom(const DesktopFrame& src_frame, |
| 69 const DesktopVector& src_pos, | 64 const DesktopVector& src_pos, |
| 70 const DesktopRect& dest_rect); | 65 const DesktopRect& dest_rect); |
| 71 | 66 |
| 72 // A helper to return the data pointer of a frame at the specified position. | 67 // A helper to return the data pointer of a frame at the specified position. |
| 73 uint8_t* GetFrameDataAtPos(const DesktopVector& pos) const; | 68 uint8_t* GetFrameDataAtPos(const DesktopVector& pos) const; |
| 74 | 69 |
| 75 protected: | 70 protected: |
| 76 DesktopFrame(DesktopSize size, | 71 DesktopFrame(DesktopSize size, |
| 77 int stride, | 72 int stride, |
| 78 uint8_t* data, | 73 uint8_t* data, |
| 79 SharedMemory* shared_memory); | 74 SharedMemory* shared_memory); |
| 80 | 75 |
| 81 const DesktopSize size_; | 76 const DesktopSize size_; |
| 82 const int stride_; | 77 const int stride_; |
| 83 | 78 |
| 84 // Ownership of the buffers is defined by the classes that inherit from this | 79 // Ownership of the buffers is defined by the classes that inherit from this |
| 85 // class. They must guarantee that the buffer is not deleted before the frame | 80 // class. They must guarantee that the buffer is not deleted before the frame |
| 86 // is deleted. | 81 // is deleted. |
| 87 uint8_t* const data_; | 82 uint8_t* const data_; |
| 88 SharedMemory* const shared_memory_; | 83 SharedMemory* const shared_memory_; |
| 89 | 84 |
| 90 DesktopRegion updated_region_; | 85 DesktopRegion updated_region_; |
| 91 DesktopVector dpi_; | 86 DesktopVector dpi_; |
| 92 int64_t capture_time_ms_; | 87 int64_t capture_time_ms_; |
| 93 std::unique_ptr<DesktopRegion> shape_; | |
| 94 | 88 |
| 95 private: | 89 private: |
| 96 RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrame); | 90 RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrame); |
| 97 }; | 91 }; |
| 98 | 92 |
| 99 // A DesktopFrame that stores data in the heap. | 93 // A DesktopFrame that stores data in the heap. |
| 100 class BasicDesktopFrame : public DesktopFrame { | 94 class BasicDesktopFrame : public DesktopFrame { |
| 101 public: | 95 public: |
| 102 explicit BasicDesktopFrame(DesktopSize size); | 96 explicit BasicDesktopFrame(DesktopSize size); |
| 103 ~BasicDesktopFrame() override; | 97 ~BasicDesktopFrame() override; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 127 ~SharedMemoryDesktopFrame() override; | 121 ~SharedMemoryDesktopFrame() override; |
| 128 | 122 |
| 129 private: | 123 private: |
| 130 RTC_DISALLOW_COPY_AND_ASSIGN(SharedMemoryDesktopFrame); | 124 RTC_DISALLOW_COPY_AND_ASSIGN(SharedMemoryDesktopFrame); |
| 131 }; | 125 }; |
| 132 | 126 |
| 133 } // namespace webrtc | 127 } // namespace webrtc |
| 134 | 128 |
| 135 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_ | 129 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_ |
| 136 | 130 |
| OLD | NEW |