OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation); | 72 bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation); |
73 | 73 |
74 void InitToEmptyBuffer(int w, int h, size_t pixel_width, size_t pixel_height, | 74 void InitToEmptyBuffer(int w, int h, size_t pixel_width, size_t pixel_height, |
75 int64_t time_stamp_ns); | 75 int64_t time_stamp_ns); |
76 | 76 |
77 // TODO(magjed): Remove once Chromium is updated. | 77 // TODO(magjed): Remove once Chromium is updated. |
78 bool InitToBlack(int w, int h, size_t pixel_width, size_t pixel_height, | 78 bool InitToBlack(int w, int h, size_t pixel_width, size_t pixel_height, |
79 int64_t elapsed_time_ns, int64_t time_stamp_ns); | 79 int64_t elapsed_time_ns, int64_t time_stamp_ns); |
80 | 80 |
81 bool InitToBlack(int w, int h, size_t pixel_width, size_t pixel_height, | 81 bool InitToBlack(int w, int h, size_t pixel_width, size_t pixel_height, |
82 int64_t time_stamp_ns); | 82 int64_t time_stamp_ns) override; |
83 | 83 |
84 // From base class VideoFrame. | 84 // From base class VideoFrame. |
85 virtual bool Reset(uint32_t format, | 85 bool Reset(uint32_t format, |
86 int w, | 86 int w, |
87 int h, | 87 int h, |
88 int dw, | 88 int dw, |
89 int dh, | 89 int dh, |
90 uint8_t* sample, | 90 uint8_t* sample, |
91 size_t sample_size, | 91 size_t sample_size, |
92 size_t pixel_width, | 92 size_t pixel_width, |
93 size_t pixel_height, | 93 size_t pixel_height, |
94 int64_t time_stamp_ns, | 94 int64_t time_stamp_ns, |
95 webrtc::VideoRotation rotation, | 95 webrtc::VideoRotation rotation, |
96 bool apply_rotation); | 96 bool apply_rotation) override; |
97 | 97 |
98 virtual size_t GetWidth() const; | 98 size_t GetWidth() const override; |
99 virtual size_t GetHeight() const; | 99 size_t GetHeight() const override; |
100 virtual const uint8_t* GetYPlane() const; | 100 const uint8_t* GetYPlane() const override; |
101 virtual const uint8_t* GetUPlane() const; | 101 const uint8_t* GetUPlane() const override; |
102 virtual const uint8_t* GetVPlane() const; | 102 const uint8_t* GetVPlane() const override; |
103 virtual uint8_t* GetYPlane(); | 103 uint8_t* GetYPlane() override; |
104 virtual uint8_t* GetUPlane(); | 104 uint8_t* GetUPlane() override; |
105 virtual uint8_t* GetVPlane(); | 105 uint8_t* GetVPlane() override; |
106 virtual int32_t GetYPitch() const; | 106 int32_t GetYPitch() const override; |
107 virtual int32_t GetUPitch() const; | 107 int32_t GetUPitch() const override; |
108 virtual int32_t GetVPitch() const; | 108 int32_t GetVPitch() const override; |
109 virtual void* GetNativeHandle() const; | 109 void* GetNativeHandle() const override; |
110 virtual rtc::scoped_refptr<webrtc::VideoFrameBuffer> GetVideoFrameBuffer() | 110 rtc::scoped_refptr<webrtc::VideoFrameBuffer> GetVideoFrameBuffer() |
111 const; | 111 const override; |
112 | 112 |
113 virtual size_t GetPixelWidth() const { return pixel_width_; } | 113 size_t GetPixelWidth() const override { return pixel_width_; } |
114 virtual size_t GetPixelHeight() const { return pixel_height_; } | 114 size_t GetPixelHeight() const override { return pixel_height_; } |
115 virtual int64_t GetTimeStamp() const { return time_stamp_ns_; } | 115 int64_t GetTimeStamp() const override { return time_stamp_ns_; } |
116 virtual void SetTimeStamp(int64_t time_stamp_ns) { | 116 void SetTimeStamp(int64_t time_stamp_ns) override { |
117 time_stamp_ns_ = time_stamp_ns; | 117 time_stamp_ns_ = time_stamp_ns; |
118 } | 118 } |
119 | 119 |
120 virtual webrtc::VideoRotation GetVideoRotation() const { return rotation_; } | 120 webrtc::VideoRotation GetVideoRotation() const override { |
| 121 return rotation_; |
| 122 } |
121 | 123 |
122 virtual VideoFrame* Copy() const; | 124 VideoFrame* Copy() const override; |
123 virtual bool IsExclusive() const; | 125 bool IsExclusive() const override; |
124 virtual bool MakeExclusive(); | 126 bool MakeExclusive() override; |
125 virtual size_t ConvertToRgbBuffer(uint32_t to_fourcc, | 127 size_t ConvertToRgbBuffer(uint32_t to_fourcc, |
126 uint8_t* buffer, | 128 uint8_t* buffer, |
127 size_t size, | 129 size_t size, |
128 int stride_rgb) const; | 130 int stride_rgb) const override; |
129 | 131 |
130 const VideoFrame* GetCopyWithRotationApplied() const override; | 132 const VideoFrame* GetCopyWithRotationApplied() const override; |
131 | 133 |
132 protected: | 134 protected: |
133 void SetRotation(webrtc::VideoRotation rotation) override { | 135 void SetRotation(webrtc::VideoRotation rotation) override { |
134 rotation_ = rotation; | 136 rotation_ = rotation; |
135 } | 137 } |
136 | 138 |
137 private: | 139 private: |
138 virtual VideoFrame* CreateEmptyFrame(int w, int h, size_t pixel_width, | 140 VideoFrame* CreateEmptyFrame(int w, int h, size_t pixel_width, |
139 size_t pixel_height, | 141 size_t pixel_height, |
140 int64_t time_stamp_ns) const; | 142 int64_t time_stamp_ns) const override; |
141 | 143 |
142 // An opaque reference counted handle that stores the pixel data. | 144 // An opaque reference counted handle that stores the pixel data. |
143 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_; | 145 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_; |
144 size_t pixel_width_; | 146 size_t pixel_width_; |
145 size_t pixel_height_; | 147 size_t pixel_height_; |
146 int64_t time_stamp_ns_; | 148 int64_t time_stamp_ns_; |
147 webrtc::VideoRotation rotation_; | 149 webrtc::VideoRotation rotation_; |
148 | 150 |
149 // This is mutable as the calculation is expensive but once calculated, it | 151 // This is mutable as the calculation is expensive but once calculated, it |
150 // remains const. | 152 // remains const. |
151 mutable rtc::scoped_ptr<VideoFrame> rotated_frame_; | 153 mutable rtc::scoped_ptr<VideoFrame> rotated_frame_; |
152 }; | 154 }; |
153 | 155 |
154 } // namespace cricket | 156 } // namespace cricket |
155 | 157 |
156 #endif // TALK_MEDIA_WEBRTCVIDEOFRAME_H_ | 158 #endif // TALK_MEDIA_WEBRTCVIDEOFRAME_H_ |
OLD | NEW |