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

Side by Side Diff: webrtc/common_video/include/video_frame_buffer.h

Issue 2084893002: Implement scoped_const_refptr template. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « webrtc/base/scoped_ref_ptr.h ('k') | webrtc/common_video/video_frame_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 uint8_t* MutableDataV() override; 117 uint8_t* MutableDataV() override;
118 int StrideY() const override; 118 int StrideY() const override;
119 int StrideU() const override; 119 int StrideU() const override;
120 int StrideV() const override; 120 int StrideV() const override;
121 121
122 void* native_handle() const override; 122 void* native_handle() const override;
123 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; 123 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
124 124
125 // Create a new buffer and copy the pixel data. 125 // Create a new buffer and copy the pixel data.
126 static rtc::scoped_refptr<I420Buffer> Copy( 126 static rtc::scoped_refptr<I420Buffer> Copy(
127 const rtc::scoped_refptr<VideoFrameBuffer>& buffer); 127 const rtc::scoped_const_refptr<VideoFrameBuffer>& buffer);
128 128
129 // Scale the cropped area of |src| to the size of |this| buffer, and 129 // Scale the cropped area of |src| to the size of |this| buffer, and
130 // write the result into |this|. 130 // write the result into |this|.
131 void CropAndScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src, 131 void CropAndScaleFrom(const rtc::scoped_const_refptr<VideoFrameBuffer>& src,
132 int offset_x, 132 int offset_x,
133 int offset_y, 133 int offset_y,
134 int crop_width, 134 int crop_width,
135 int crop_height); 135 int crop_height);
136 136
137 // The common case of a center crop, when needed to adjust the 137 // The common case of a center crop, when needed to adjust the
138 // aspect ratio without distorting the image. 138 // aspect ratio without distorting the image.
139 void CropAndScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src); 139 void CropAndScaleFrom(const rtc::scoped_const_refptr<VideoFrameBuffer>& src);
140 140
141 // Scale all of |src| to the size of |this| buffer, with no cropping. 141 // Scale all of |src| to the size of |this| buffer, with no cropping.
142 void ScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src); 142 void ScaleFrom(const rtc::scoped_const_refptr<VideoFrameBuffer>& src);
143 143
144 // Create a new buffer with identical strides, and copy the pixel data. 144 // Create a new buffer with identical strides, and copy the pixel data.
145 static rtc::scoped_refptr<I420Buffer> CopyKeepStride( 145 static rtc::scoped_refptr<I420Buffer> CopyKeepStride(
146 const rtc::scoped_refptr<VideoFrameBuffer>& buffer); 146 const rtc::scoped_const_refptr<VideoFrameBuffer>& buffer);
147 147
148 protected: 148 protected:
149 ~I420Buffer() override; 149 ~I420Buffer() override;
150 150
151 private: 151 private:
152 const int width_; 152 const int width_;
153 const int height_; 153 const int height_;
154 const int stride_y_; 154 const int stride_y_;
155 const int stride_u_; 155 const int stride_u_;
156 const int stride_v_; 156 const int stride_v_;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 const uint8_t* const v_plane_; 218 const uint8_t* const v_plane_;
219 const int y_stride_; 219 const int y_stride_;
220 const int u_stride_; 220 const int u_stride_;
221 const int v_stride_; 221 const int v_stride_;
222 rtc::Callback0<void> no_longer_used_cb_; 222 rtc::Callback0<void> no_longer_used_cb_;
223 }; 223 };
224 224
225 } // namespace webrtc 225 } // namespace webrtc
226 226
227 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ 227 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_
OLDNEW
« no previous file with comments | « webrtc/base/scoped_ref_ptr.h ('k') | webrtc/common_video/video_frame_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698