OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/filters/skcanvas_video_renderer.h" | 5 #include "media/filters/skcanvas_video_renderer.h" |
6 | 6 |
7 #include "gpu/GLES2/gl2extchromium.h" | 7 #include "gpu/GLES2/gl2extchromium.h" |
8 #include "gpu/command_buffer/client/gles2_interface.h" | 8 #include "gpu/command_buffer/client/gles2_interface.h" |
9 #include "gpu/command_buffer/common/mailbox_holder.h" | 9 #include "gpu/command_buffer/common/mailbox_holder.h" |
10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 protected: | 180 protected: |
181 bool onGetInfo(SkImageInfo* info) override { | 181 bool onGetInfo(SkImageInfo* info) override { |
182 info->fWidth = frame_->visible_rect().width(); | 182 info->fWidth = frame_->visible_rect().width(); |
183 info->fHeight = frame_->visible_rect().height(); | 183 info->fHeight = frame_->visible_rect().height(); |
184 info->fColorType = kN32_SkColorType; | 184 info->fColorType = kN32_SkColorType; |
185 info->fAlphaType = kPremul_SkAlphaType; | 185 info->fAlphaType = kPremul_SkAlphaType; |
186 return true; | 186 return true; |
187 } | 187 } |
188 | 188 |
189 bool onGetPixels(const SkImageInfo& info, | 189 // TODO (scroggo): Rename to onGetPixels once Skia is updated. |
| 190 Result onGetPixelsEnum(const SkImageInfo& info, |
190 void* pixels, | 191 void* pixels, |
191 size_t row_bytes, | 192 size_t row_bytes, |
192 SkPMColor ctable[], | 193 SkPMColor ctable[], |
193 int* ctable_count) override { | 194 int* ctable_count) override { |
194 if (!frame_.get()) | 195 if (!frame_.get()) |
195 return false; | 196 return kInvalidInput; |
196 if (!pixels) | |
197 return false; | |
198 // If skia couldn't do the YUV conversion on GPU, we will on CPU. | 197 // If skia couldn't do the YUV conversion on GPU, we will on CPU. |
199 SkCanvasVideoRenderer::ConvertVideoFrameToRGBPixels( | 198 SkCanvasVideoRenderer::ConvertVideoFrameToRGBPixels( |
200 frame_, pixels, row_bytes); | 199 frame_, pixels, row_bytes); |
201 return true; | 200 return kSuccess; |
202 } | 201 } |
203 | 202 |
204 bool onGetYUV8Planes(SkISize sizes[3], | 203 bool onGetYUV8Planes(SkISize sizes[3], |
205 void* planes[3], | 204 void* planes[3], |
206 size_t row_bytes[3], | 205 size_t row_bytes[3], |
207 SkYUVColorSpace* color_space) override { | 206 SkYUVColorSpace* color_space) override { |
208 if (!frame_.get() || !IsYUV(frame_->format()) || | 207 if (!frame_.get() || !IsYUV(frame_->format()) || |
209 // TODO(rileya): Skia currently doesn't support Rec709 YUV conversion, | 208 // TODO(rileya): Skia currently doesn't support Rec709 YUV conversion, |
210 // or YUVA conversion. Remove this case once it does. As-is we will | 209 // or YUVA conversion. Remove this case once it does. As-is we will |
211 // fall back on the pure-software path in this case. | 210 // fall back on the pure-software path in this case. |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 last_frame_timestamp_ = media::kNoTimestamp(); | 643 last_frame_timestamp_ = media::kNoTimestamp(); |
645 } | 644 } |
646 | 645 |
647 void SkCanvasVideoRenderer::ResetAcceleratedLastFrame() { | 646 void SkCanvasVideoRenderer::ResetAcceleratedLastFrame() { |
648 accelerated_last_frame_.reset(); | 647 accelerated_last_frame_.reset(); |
649 accelerated_generator_ = nullptr; | 648 accelerated_generator_ = nullptr; |
650 accelerated_last_frame_timestamp_ = media::kNoTimestamp(); | 649 accelerated_last_frame_timestamp_ = media::kNoTimestamp(); |
651 } | 650 } |
652 | 651 |
653 } // namespace media | 652 } // namespace media |
OLD | NEW |