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/renderers/skcanvas_video_renderer.h" | 5 #include "media/renderers/skcanvas_video_renderer.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "gpu/GLES2/gl2extchromium.h" | 10 #include "gpu/GLES2/gl2extchromium.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 private: | 80 private: |
81 gpu::gles2::GLES2Interface* gl_; | 81 gpu::gles2::GLES2Interface* gl_; |
82 | 82 |
83 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncTokenClientImpl); | 83 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncTokenClientImpl); |
84 }; | 84 }; |
85 | 85 |
86 sk_sp<SkImage> NewSkImageFromVideoFrameYUVTextures( | 86 sk_sp<SkImage> NewSkImageFromVideoFrameYUVTextures( |
87 const VideoFrame* video_frame, | 87 const VideoFrame* video_frame, |
88 const Context3D& context_3d) { | 88 const Context3D& context_3d) { |
89 DCHECK(video_frame->HasTextures()); | 89 DCHECK(video_frame->HasTextures()); |
90 DCHECK(video_frame->format() == PIXEL_FORMAT_I420 || | 90 DCHECK(video_frame->format() == PIXEL_FORMAT_I420 || |
liberato (no reviews please)
2016/12/14 17:51:44
seems like I422 will get here via UpdateLastImage,
jcliang
2016/12/15 04:28:43
Done.
I'm not familiar with this module, but from
| |
91 video_frame->format() == PIXEL_FORMAT_NV12); | 91 video_frame->format() == PIXEL_FORMAT_NV12); |
92 | 92 |
93 gpu::gles2::GLES2Interface* gl = context_3d.gl; | 93 gpu::gles2::GLES2Interface* gl = context_3d.gl; |
94 DCHECK(gl); | 94 DCHECK(gl); |
95 gfx::Size ya_tex_size = video_frame->coded_size(); | 95 gfx::Size ya_tex_size = video_frame->coded_size(); |
96 gfx::Size uv_tex_size((ya_tex_size.width() + 1) / 2, | 96 gfx::Size uv_tex_size((ya_tex_size.width() + 1) / 2, |
97 (ya_tex_size.height() + 1) / 2); | 97 (ya_tex_size.height() + 1) / 2); |
98 | 98 |
99 GrGLTextureInfo source_textures[] = {{0, 0}, {0, 0}, {0, 0}}; | 99 GrGLTextureInfo source_textures[] = {{0, 0}, {0, 0}, {0, 0}}; |
100 for (size_t i = 0; i < media::VideoFrame::NumPlanes(video_frame->format()); | 100 for (size_t i = 0; i < media::VideoFrame::NumPlanes(video_frame->format()); |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
647 video_frame->visible_data(VideoFrame::kUPlane), | 647 video_frame->visible_data(VideoFrame::kUPlane), |
648 video_frame->stride(VideoFrame::kUPlane), | 648 video_frame->stride(VideoFrame::kUPlane), |
649 video_frame->visible_data(VideoFrame::kVPlane), | 649 video_frame->visible_data(VideoFrame::kVPlane), |
650 video_frame->stride(VideoFrame::kVPlane), | 650 video_frame->stride(VideoFrame::kVPlane), |
651 static_cast<uint8_t*>(rgb_pixels), row_bytes, | 651 static_cast<uint8_t*>(rgb_pixels), row_bytes, |
652 video_frame->visible_rect().width(), | 652 video_frame->visible_rect().width(), |
653 video_frame->visible_rect().height()); | 653 video_frame->visible_rect().height()); |
654 } | 654 } |
655 break; | 655 break; |
656 case PIXEL_FORMAT_YV16: | 656 case PIXEL_FORMAT_YV16: |
657 case PIXEL_FORMAT_I422: | |
657 LIBYUV_I422_TO_ARGB(video_frame->visible_data(VideoFrame::kYPlane), | 658 LIBYUV_I422_TO_ARGB(video_frame->visible_data(VideoFrame::kYPlane), |
658 video_frame->stride(VideoFrame::kYPlane), | 659 video_frame->stride(VideoFrame::kYPlane), |
659 video_frame->visible_data(VideoFrame::kUPlane), | 660 video_frame->visible_data(VideoFrame::kUPlane), |
660 video_frame->stride(VideoFrame::kUPlane), | 661 video_frame->stride(VideoFrame::kUPlane), |
661 video_frame->visible_data(VideoFrame::kVPlane), | 662 video_frame->visible_data(VideoFrame::kVPlane), |
662 video_frame->stride(VideoFrame::kVPlane), | 663 video_frame->stride(VideoFrame::kVPlane), |
663 static_cast<uint8_t*>(rgb_pixels), row_bytes, | 664 static_cast<uint8_t*>(rgb_pixels), row_bytes, |
664 video_frame->visible_rect().width(), | 665 video_frame->visible_rect().width(), |
665 video_frame->visible_rect().height()); | 666 video_frame->visible_rect().height()); |
666 break; | 667 break; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
932 last_image_->bounds().contains(visible_rect)) { | 933 last_image_->bounds().contains(visible_rect)) { |
933 last_image_ = last_image_->makeSubset(visible_rect); | 934 last_image_ = last_image_->makeSubset(visible_rect); |
934 } | 935 } |
935 } | 936 } |
936 | 937 |
937 SkISize SkCanvasVideoRenderer::LastImageDimensionsForTesting() { | 938 SkISize SkCanvasVideoRenderer::LastImageDimensionsForTesting() { |
938 return last_image_dimensions_for_testing_; | 939 return last_image_dimensions_for_testing_; |
939 } | 940 } |
940 | 941 |
941 } // namespace media | 942 } // namespace media |
OLD | NEW |