OLD | NEW |
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 |
11 #ifndef WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ | 11 #ifndef WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ |
12 #define WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ | 12 #define WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ |
13 | 13 |
| 14 #include <stdint.h> |
| 15 |
| 16 #include <memory> |
| 17 |
14 #include "webrtc/base/callback.h" | 18 #include "webrtc/base/callback.h" |
15 #include "webrtc/base/refcount.h" | 19 #include "webrtc/base/refcount.h" |
16 #include "webrtc/base/scoped_ptr.h" | |
17 #include "webrtc/base/scoped_ref_ptr.h" | 20 #include "webrtc/base/scoped_ref_ptr.h" |
18 #include "webrtc/system_wrappers/include/aligned_malloc.h" | 21 #include "webrtc/system_wrappers/include/aligned_malloc.h" |
19 | 22 |
20 namespace webrtc { | 23 namespace webrtc { |
21 | 24 |
22 enum PlaneType { | 25 enum PlaneType { |
23 kYPlane = 0, | 26 kYPlane = 0, |
24 kUPlane = 1, | 27 kUPlane = 1, |
25 kVPlane = 2, | 28 kVPlane = 2, |
26 kNumOfPlanes = 3, | 29 kNumOfPlanes = 3, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 83 |
81 protected: | 84 protected: |
82 ~I420Buffer() override; | 85 ~I420Buffer() override; |
83 | 86 |
84 private: | 87 private: |
85 const int width_; | 88 const int width_; |
86 const int height_; | 89 const int height_; |
87 const int stride_y_; | 90 const int stride_y_; |
88 const int stride_u_; | 91 const int stride_u_; |
89 const int stride_v_; | 92 const int stride_v_; |
90 const rtc::scoped_ptr<uint8_t, AlignedFreeDeleter> data_; | 93 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; |
91 }; | 94 }; |
92 | 95 |
93 // Base class for native-handle buffer is a wrapper around a |native_handle|. | 96 // Base class for native-handle buffer is a wrapper around a |native_handle|. |
94 // This is used for convenience as most native-handle implementations can share | 97 // This is used for convenience as most native-handle implementations can share |
95 // many VideoFrame implementations, but need to implement a few others (such | 98 // many VideoFrame implementations, but need to implement a few others (such |
96 // as their own destructors or conversion methods back to software I420). | 99 // as their own destructors or conversion methods back to software I420). |
97 class NativeHandleBuffer : public VideoFrameBuffer { | 100 class NativeHandleBuffer : public VideoFrameBuffer { |
98 public: | 101 public: |
99 NativeHandleBuffer(void* native_handle, int width, int height); | 102 NativeHandleBuffer(void* native_handle, int width, int height); |
100 | 103 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // Helper function to crop |buffer| without making a deep copy. May only be used | 152 // Helper function to crop |buffer| without making a deep copy. May only be used |
150 // for non-native frames. | 153 // for non-native frames. |
151 rtc::scoped_refptr<VideoFrameBuffer> ShallowCenterCrop( | 154 rtc::scoped_refptr<VideoFrameBuffer> ShallowCenterCrop( |
152 const rtc::scoped_refptr<VideoFrameBuffer>& buffer, | 155 const rtc::scoped_refptr<VideoFrameBuffer>& buffer, |
153 int cropped_width, | 156 int cropped_width, |
154 int cropped_height); | 157 int cropped_height); |
155 | 158 |
156 } // namespace webrtc | 159 } // namespace webrtc |
157 | 160 |
158 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ | 161 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ |
OLD | NEW |