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

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

Issue 2847383002: Add support for multiple pixel formats in VideoFrameBuffer (Closed)
Patch Set: Add common interface for I420 and I444 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
(...skipping 12 matching lines...) Expand all
23 namespace webrtc { 23 namespace webrtc {
24 24
25 // Base class for native-handle buffer is a wrapper around a |native_handle|. 25 // Base class for native-handle buffer is a wrapper around a |native_handle|.
26 // This is used for convenience as most native-handle implementations can share 26 // This is used for convenience as most native-handle implementations can share
27 // many VideoFrame implementations, but need to implement a few others (such 27 // many VideoFrame implementations, but need to implement a few others (such
28 // as their own destructors or conversion methods back to software I420). 28 // as their own destructors or conversion methods back to software I420).
29 class NativeHandleBuffer : public VideoFrameBuffer { 29 class NativeHandleBuffer : public VideoFrameBuffer {
30 public: 30 public:
31 NativeHandleBuffer(void* native_handle, int width, int height); 31 NativeHandleBuffer(void* native_handle, int width, int height);
32 32
33 PixelFormat Format() const override;
33 int width() const override; 34 int width() const override;
34 int height() const override; 35 int height() const override;
35 const uint8_t* DataY() const override; 36 const uint8_t* DataY() const override;
36 const uint8_t* DataU() const override; 37 const uint8_t* DataU() const override;
37 const uint8_t* DataV() const override; 38 const uint8_t* DataV() const override;
38 int StrideY() const override; 39 int StrideY() const override;
39 int StrideU() const override; 40 int StrideU() const override;
40 int StrideV() const override; 41 int StrideV() const override;
41 42
42 void* native_handle() const override; 43 void* native_handle() const override;
43 44
44 protected: 45 protected:
45 void* native_handle_; 46 void* native_handle_;
46 const int width_; 47 const int width_;
47 const int height_; 48 const int height_;
48 }; 49 };
49 50
50 class WrappedI420Buffer : public webrtc::VideoFrameBuffer { 51 class WrappedI420Buffer : public PlanarYuvBuffer {
51 public: 52 public:
52 WrappedI420Buffer(int width, 53 WrappedI420Buffer(int width,
53 int height, 54 int height,
54 const uint8_t* y_plane, 55 const uint8_t* y_plane,
55 int y_stride, 56 int y_stride,
56 const uint8_t* u_plane, 57 const uint8_t* u_plane,
57 int u_stride, 58 int u_stride,
58 const uint8_t* v_plane, 59 const uint8_t* v_plane,
59 int v_stride, 60 int v_stride,
60 const rtc::Callback0<void>& no_longer_used); 61 const rtc::Callback0<void>& no_longer_used);
62 PixelFormat Format() const override;
63
61 int width() const override; 64 int width() const override;
62 int height() const override; 65 int height() const override;
63 66
64 const uint8_t* DataY() const override; 67 const uint8_t* DataY() const override;
65 const uint8_t* DataU() const override; 68 const uint8_t* DataU() const override;
66 const uint8_t* DataV() const override; 69 const uint8_t* DataV() const override;
67 int StrideY() const override; 70 int StrideY() const override;
68 int StrideU() const override; 71 int StrideU() const override;
69 int StrideV() const override; 72 int StrideV() const override;
70 73
71 void* native_handle() const override;
72
73 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
74
75 private: 74 private:
76 friend class rtc::RefCountedObject<WrappedI420Buffer>; 75 friend class rtc::RefCountedObject<WrappedI420Buffer>;
77 ~WrappedI420Buffer() override; 76 ~WrappedI420Buffer() override;
78 77
79 const int width_; 78 const int width_;
80 const int height_; 79 const int height_;
81 const uint8_t* const y_plane_; 80 const uint8_t* const y_plane_;
82 const uint8_t* const u_plane_; 81 const uint8_t* const u_plane_;
83 const uint8_t* const v_plane_; 82 const uint8_t* const v_plane_;
84 const int y_stride_; 83 const int y_stride_;
85 const int u_stride_; 84 const int u_stride_;
86 const int v_stride_; 85 const int v_stride_;
87 rtc::Callback0<void> no_longer_used_cb_; 86 rtc::Callback0<void> no_longer_used_cb_;
88 }; 87 };
89 88
90 } // namespace webrtc 89 } // namespace webrtc
91 90
92 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ 91 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698