| 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 |
| 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_ | 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_ |
| 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_ | 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_ |
| 13 | 13 |
| 14 #include <memory> | 14 #include <memory> |
| 15 | 15 |
| 16 #include "webrtc/base/constructormagic.h" | 16 #include "webrtc/base/constructormagic.h" |
| 17 #include "webrtc/modules/desktop_capture/desktop_capture_types.h" | |
| 18 #include "webrtc/modules/desktop_capture/desktop_geometry.h" | 17 #include "webrtc/modules/desktop_capture/desktop_geometry.h" |
| 19 #include "webrtc/modules/desktop_capture/desktop_region.h" | 18 #include "webrtc/modules/desktop_capture/desktop_region.h" |
| 20 #include "webrtc/modules/desktop_capture/shared_memory.h" | 19 #include "webrtc/modules/desktop_capture/shared_memory.h" |
| 21 #include "webrtc/typedefs.h" | 20 #include "webrtc/typedefs.h" |
| 22 | 21 |
| 23 namespace webrtc { | 22 namespace webrtc { |
| 24 | 23 |
| 25 // DesktopFrame represents a video frame captured from the screen. | 24 // DesktopFrame represents a video frame captured from the screen. |
| 26 class DesktopFrame { | 25 class DesktopFrame { |
| 27 public: | 26 public: |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 void CopyPixelsFrom(const uint8_t* src_buffer, | 61 void CopyPixelsFrom(const uint8_t* src_buffer, |
| 63 int src_stride, | 62 int src_stride, |
| 64 const DesktopRect& dest_rect); | 63 const DesktopRect& dest_rect); |
| 65 void CopyPixelsFrom(const DesktopFrame& src_frame, | 64 void CopyPixelsFrom(const DesktopFrame& src_frame, |
| 66 const DesktopVector& src_pos, | 65 const DesktopVector& src_pos, |
| 67 const DesktopRect& dest_rect); | 66 const DesktopRect& dest_rect); |
| 68 | 67 |
| 69 // A helper to return the data pointer of a frame at the specified position. | 68 // A helper to return the data pointer of a frame at the specified position. |
| 70 uint8_t* GetFrameDataAtPos(const DesktopVector& pos) const; | 69 uint8_t* GetFrameDataAtPos(const DesktopVector& pos) const; |
| 71 | 70 |
| 72 // The DesktopCapturer implementation which generates current DesktopFrame. | |
| 73 // Not all DesktopCapturer implementations set this field; it's set to | |
| 74 // kUnknown by default. | |
| 75 uint32_t capturer_id() const { return capturer_id_; } | |
| 76 void set_capturer_id(uint32_t capturer_id) { | |
| 77 capturer_id_ = capturer_id; | |
| 78 } | |
| 79 | |
| 80 protected: | 71 protected: |
| 81 DesktopFrame(DesktopSize size, | 72 DesktopFrame(DesktopSize size, |
| 82 int stride, | 73 int stride, |
| 83 uint8_t* data, | 74 uint8_t* data, |
| 84 SharedMemory* shared_memory); | 75 SharedMemory* shared_memory); |
| 85 | 76 |
| 86 // Ownership of the buffers is defined by the classes that inherit from this | 77 // Ownership of the buffers is defined by the classes that inherit from this |
| 87 // class. They must guarantee that the buffer is not deleted before the frame | 78 // class. They must guarantee that the buffer is not deleted before the frame |
| 88 // is deleted. | 79 // is deleted. |
| 89 uint8_t* const data_; | 80 uint8_t* const data_; |
| 90 SharedMemory* const shared_memory_; | 81 SharedMemory* const shared_memory_; |
| 91 | 82 |
| 92 private: | 83 private: |
| 93 const DesktopSize size_; | 84 const DesktopSize size_; |
| 94 const int stride_; | 85 const int stride_; |
| 95 | 86 |
| 96 DesktopRegion updated_region_; | 87 DesktopRegion updated_region_; |
| 97 DesktopVector dpi_; | 88 DesktopVector dpi_; |
| 98 int64_t capture_time_ms_; | 89 int64_t capture_time_ms_; |
| 99 uint32_t capturer_id_; | |
| 100 | 90 |
| 101 RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrame); | 91 RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrame); |
| 102 }; | 92 }; |
| 103 | 93 |
| 104 // A DesktopFrame that stores data in the heap. | 94 // A DesktopFrame that stores data in the heap. |
| 105 class BasicDesktopFrame : public DesktopFrame { | 95 class BasicDesktopFrame : public DesktopFrame { |
| 106 public: | 96 public: |
| 107 explicit BasicDesktopFrame(DesktopSize size); | 97 explicit BasicDesktopFrame(DesktopSize size); |
| 108 ~BasicDesktopFrame() override; | 98 ~BasicDesktopFrame() override; |
| 109 | 99 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 134 ~SharedMemoryDesktopFrame() override; | 124 ~SharedMemoryDesktopFrame() override; |
| 135 | 125 |
| 136 private: | 126 private: |
| 137 RTC_DISALLOW_COPY_AND_ASSIGN(SharedMemoryDesktopFrame); | 127 RTC_DISALLOW_COPY_AND_ASSIGN(SharedMemoryDesktopFrame); |
| 138 }; | 128 }; |
| 139 | 129 |
| 140 } // namespace webrtc | 130 } // namespace webrtc |
| 141 | 131 |
| 142 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_ | 132 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_ |
| 143 | 133 |
| OLD | NEW |