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

Side by Side Diff: webrtc/modules/desktop_capture/desktop_frame.h

Issue 2759493002: Add DesktopCapturerId and attach it to DesktopFrame (Closed)
Patch Set: Remove dependency of webrtc/media:rtc_media_base Created 3 years, 9 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
OLDNEW
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"
17 #include "webrtc/modules/desktop_capture/desktop_geometry.h" 18 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
18 #include "webrtc/modules/desktop_capture/desktop_region.h" 19 #include "webrtc/modules/desktop_capture/desktop_region.h"
19 #include "webrtc/modules/desktop_capture/shared_memory.h" 20 #include "webrtc/modules/desktop_capture/shared_memory.h"
20 #include "webrtc/typedefs.h" 21 #include "webrtc/typedefs.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
24 // DesktopFrame represents a video frame captured from the screen. 25 // DesktopFrame represents a video frame captured from the screen.
25 class DesktopFrame { 26 class DesktopFrame {
26 public: 27 public:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void CopyPixelsFrom(const uint8_t* src_buffer, 62 void CopyPixelsFrom(const uint8_t* src_buffer,
62 int src_stride, 63 int src_stride,
63 const DesktopRect& dest_rect); 64 const DesktopRect& dest_rect);
64 void CopyPixelsFrom(const DesktopFrame& src_frame, 65 void CopyPixelsFrom(const DesktopFrame& src_frame,
65 const DesktopVector& src_pos, 66 const DesktopVector& src_pos,
66 const DesktopRect& dest_rect); 67 const DesktopRect& dest_rect);
67 68
68 // A helper to return the data pointer of a frame at the specified position. 69 // A helper to return the data pointer of a frame at the specified position.
69 uint8_t* GetFrameDataAtPos(const DesktopVector& pos) const; 70 uint8_t* GetFrameDataAtPos(const DesktopVector& pos) const;
70 71
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
71 protected: 80 protected:
72 DesktopFrame(DesktopSize size, 81 DesktopFrame(DesktopSize size,
73 int stride, 82 int stride,
74 uint8_t* data, 83 uint8_t* data,
75 SharedMemory* shared_memory); 84 SharedMemory* shared_memory);
76 85
77 // Ownership of the buffers is defined by the classes that inherit from this 86 // Ownership of the buffers is defined by the classes that inherit from this
78 // class. They must guarantee that the buffer is not deleted before the frame 87 // class. They must guarantee that the buffer is not deleted before the frame
79 // is deleted. 88 // is deleted.
80 uint8_t* const data_; 89 uint8_t* const data_;
81 SharedMemory* const shared_memory_; 90 SharedMemory* const shared_memory_;
82 91
83 private: 92 private:
84 const DesktopSize size_; 93 const DesktopSize size_;
85 const int stride_; 94 const int stride_;
86 95
87 DesktopRegion updated_region_; 96 DesktopRegion updated_region_;
88 DesktopVector dpi_; 97 DesktopVector dpi_;
89 int64_t capture_time_ms_; 98 int64_t capture_time_ms_;
99 uint32_t capturer_id_;
90 100
91 RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrame); 101 RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrame);
92 }; 102 };
93 103
94 // A DesktopFrame that stores data in the heap. 104 // A DesktopFrame that stores data in the heap.
95 class BasicDesktopFrame : public DesktopFrame { 105 class BasicDesktopFrame : public DesktopFrame {
96 public: 106 public:
97 explicit BasicDesktopFrame(DesktopSize size); 107 explicit BasicDesktopFrame(DesktopSize size);
98 ~BasicDesktopFrame() override; 108 ~BasicDesktopFrame() override;
99 109
(...skipping 24 matching lines...) Expand all
124 ~SharedMemoryDesktopFrame() override; 134 ~SharedMemoryDesktopFrame() override;
125 135
126 private: 136 private:
127 RTC_DISALLOW_COPY_AND_ASSIGN(SharedMemoryDesktopFrame); 137 RTC_DISALLOW_COPY_AND_ASSIGN(SharedMemoryDesktopFrame);
128 }; 138 };
129 139
130 } // namespace webrtc 140 } // namespace webrtc
131 141
132 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_ 142 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_
133 143
OLDNEW
« no previous file with comments | « webrtc/modules/desktop_capture/desktop_capture_types.h ('k') | webrtc/modules/desktop_capture/desktop_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698