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

Side by Side Diff: webrtc/api/video/i420_buffer.h

Issue 2847383002: Add support for multiple pixel formats in VideoFrameBuffer (Closed)
Patch Set: Created 3 years, 7 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) 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_API_VIDEO_I420_BUFFER_H_ 11 #ifndef WEBRTC_API_VIDEO_I420_BUFFER_H_
12 #define WEBRTC_API_VIDEO_I420_BUFFER_H_ 12 #define WEBRTC_API_VIDEO_I420_BUFFER_H_
13 13
14 #include <memory> 14 #include <memory>
15 15
16 #include "webrtc/api/video/video_rotation.h" 16 #include "webrtc/api/video/video_rotation.h"
17 #include "webrtc/api/video/video_frame_buffer.h" 17 #include "webrtc/api/video/video_frame_buffer.h"
18 #include "webrtc/system_wrappers/include/aligned_malloc.h" 18 #include "webrtc/system_wrappers/include/aligned_malloc.h"
19 19
20 namespace webrtc { 20 namespace webrtc {
21 21
22 // Plain I420 buffer in standard memory. 22 // Plain I420 buffer in standard memory.
23 class I420Buffer : public VideoFrameBuffer { 23 class I420Buffer : public I420BufferInterface {
24 public: 24 public:
25 static rtc::scoped_refptr<I420Buffer> Create(int width, int height); 25 static rtc::scoped_refptr<I420Buffer> Create(int width, int height);
26 static rtc::scoped_refptr<I420Buffer> Create(int width, 26 static rtc::scoped_refptr<I420Buffer> Create(int width,
27 int height, 27 int height,
28 int stride_y, 28 int stride_y,
29 int stride_u, 29 int stride_u,
30 int stride_v); 30 int stride_v);
31 31
32 // Create a new buffer and copy the pixel data. 32 // Create a new buffer and copy the pixel data.
33 static rtc::scoped_refptr<I420Buffer> Copy(const VideoFrameBuffer& buffer); 33 static rtc::scoped_refptr<I420Buffer> Copy(const VideoFrameBuffer& buffer);
(...skipping 25 matching lines...) Expand all
59 int width() const override; 59 int width() const override;
60 int height() const override; 60 int height() const override;
61 const uint8_t* DataY() const override; 61 const uint8_t* DataY() const override;
62 const uint8_t* DataU() const override; 62 const uint8_t* DataU() const override;
63 const uint8_t* DataV() const override; 63 const uint8_t* DataV() const override;
64 64
65 int StrideY() const override; 65 int StrideY() const override;
66 int StrideU() const override; 66 int StrideU() const override;
67 int StrideV() const override; 67 int StrideV() const override;
68 68
69 void* native_handle() const override;
70 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
71
72 uint8_t* MutableDataY(); 69 uint8_t* MutableDataY();
73 uint8_t* MutableDataU(); 70 uint8_t* MutableDataU();
74 uint8_t* MutableDataV(); 71 uint8_t* MutableDataV();
75 72
76 // Scale the cropped area of |src| to the size of |this| buffer, and 73 // Scale the cropped area of |src| to the size of |this| buffer, and
77 // write the result into |this|. 74 // write the result into |this|.
78 void CropAndScaleFrom(const VideoFrameBuffer& src, 75 void CropAndScaleFrom(const VideoFrameBuffer& src,
79 int offset_x, 76 int offset_x,
80 int offset_y, 77 int offset_y,
81 int crop_width, 78 int crop_width,
(...skipping 25 matching lines...) Expand all
107 const int height_; 104 const int height_;
108 const int stride_y_; 105 const int stride_y_;
109 const int stride_u_; 106 const int stride_u_;
110 const int stride_v_; 107 const int stride_v_;
111 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; 108 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_;
112 }; 109 };
113 110
114 } // namespace webrtc 111 } // namespace webrtc
115 112
116 #endif // WEBRTC_API_VIDEO_I420_BUFFER_H_ 113 #endif // WEBRTC_API_VIDEO_I420_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698