OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/resources/video_resource_updater.h" | 5 #include "cc/resources/video_resource_updater.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "cc/output/gl_renderer.h" | 8 #include "cc/output/gl_renderer.h" |
9 #include "cc/resources/resource_provider.h" | 9 #include "cc/resources/resource_provider.h" |
10 #include "gpu/GLES2/gl2extchromium.h" | 10 #include "gpu/GLES2/gl2extchromium.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 const scoped_refptr<media::VideoFrame>& video_frame) { | 39 const scoped_refptr<media::VideoFrame>& video_frame) { |
40 // If these fail, we'll have to add logic that handles offset bitmap/texture | 40 // If these fail, we'll have to add logic that handles offset bitmap/texture |
41 // UVs. For now, just expect (0, 0) offset, since all our decoders so far | 41 // UVs. For now, just expect (0, 0) offset, since all our decoders so far |
42 // don't offset. | 42 // don't offset. |
43 DCHECK_EQ(video_frame->visible_rect().x(), 0); | 43 DCHECK_EQ(video_frame->visible_rect().x(), 0); |
44 DCHECK_EQ(video_frame->visible_rect().y(), 0); | 44 DCHECK_EQ(video_frame->visible_rect().y(), 0); |
45 | 45 |
46 switch (video_frame->format()) { | 46 switch (video_frame->format()) { |
47 // Acceptable inputs. | 47 // Acceptable inputs. |
48 case media::VideoFrame::YV12: | 48 case media::VideoFrame::YV12: |
| 49 case media::VideoFrame::YV12A: |
49 case media::VideoFrame::YV16: | 50 case media::VideoFrame::YV16: |
50 case media::VideoFrame::NATIVE_TEXTURE: | 51 case media::VideoFrame::NATIVE_TEXTURE: |
51 #if defined(GOOGLE_TV) | 52 #if defined(GOOGLE_TV) |
52 case media::VideoFrame::HOLE: | 53 case media::VideoFrame::HOLE: |
53 #endif | 54 #endif |
54 return true; | 55 return true; |
55 | 56 |
56 // Unacceptable inputs. ¯\(°_o)/¯ | 57 // Unacceptable inputs. ¯\(°_o)/¯ |
57 case media::VideoFrame::INVALID: | 58 case media::VideoFrame::INVALID: |
58 case media::VideoFrame::RGB32: | 59 case media::VideoFrame::RGB32: |
(...skipping 10 matching lines...) Expand all Loading... |
69 media::VideoFrame::Format input_frame_format, | 70 media::VideoFrame::Format input_frame_format, |
70 gfx::Size coded_size, | 71 gfx::Size coded_size, |
71 GLenum output_resource_format, | 72 GLenum output_resource_format, |
72 int plane_index) { | 73 int plane_index) { |
73 if (output_resource_format == kYUVResourceFormat) { | 74 if (output_resource_format == kYUVResourceFormat) { |
74 if (plane_index == media::VideoFrame::kYPlane) | 75 if (plane_index == media::VideoFrame::kYPlane) |
75 return coded_size; | 76 return coded_size; |
76 | 77 |
77 switch (input_frame_format) { | 78 switch (input_frame_format) { |
78 case media::VideoFrame::YV12: | 79 case media::VideoFrame::YV12: |
| 80 case media::VideoFrame::YV12A: |
79 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 0.5f)); | 81 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 0.5f)); |
80 case media::VideoFrame::YV16: | 82 case media::VideoFrame::YV16: |
81 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 1.f)); | 83 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 1.f)); |
82 | 84 |
83 case media::VideoFrame::INVALID: | 85 case media::VideoFrame::INVALID: |
84 case media::VideoFrame::RGB32: | 86 case media::VideoFrame::RGB32: |
85 case media::VideoFrame::EMPTY: | 87 case media::VideoFrame::EMPTY: |
86 case media::VideoFrame::I420: | 88 case media::VideoFrame::I420: |
87 case media::VideoFrame::NATIVE_TEXTURE: | 89 case media::VideoFrame::NATIVE_TEXTURE: |
88 #if defined(GOOGLE_TV) | 90 #if defined(GOOGLE_TV) |
(...skipping 17 matching lines...) Expand all Loading... |
106 #if defined(GOOGLE_TV) | 108 #if defined(GOOGLE_TV) |
107 if (input_frame_format == media::VideoFrame::HOLE) { | 109 if (input_frame_format == media::VideoFrame::HOLE) { |
108 VideoFrameExternalResources external_resources; | 110 VideoFrameExternalResources external_resources; |
109 external_resources.type = VideoFrameExternalResources::HOLE; | 111 external_resources.type = VideoFrameExternalResources::HOLE; |
110 return external_resources; | 112 return external_resources; |
111 } | 113 } |
112 #endif | 114 #endif |
113 | 115 |
114 // Only YUV software video frames are supported. | 116 // Only YUV software video frames are supported. |
115 DCHECK(input_frame_format == media::VideoFrame::YV12 || | 117 DCHECK(input_frame_format == media::VideoFrame::YV12 || |
| 118 input_frame_format == media::VideoFrame::YV12A || |
116 input_frame_format == media::VideoFrame::YV16); | 119 input_frame_format == media::VideoFrame::YV16); |
117 if (input_frame_format != media::VideoFrame::YV12 && | 120 if (input_frame_format != media::VideoFrame::YV12 && |
| 121 input_frame_format != media::VideoFrame::YV12A && |
118 input_frame_format != media::VideoFrame::YV16) | 122 input_frame_format != media::VideoFrame::YV16) |
119 return VideoFrameExternalResources(); | 123 return VideoFrameExternalResources(); |
120 | 124 |
121 bool software_compositor = !resource_provider_->GraphicsContext3D(); | 125 bool software_compositor = !resource_provider_->GraphicsContext3D(); |
122 | 126 |
123 GLenum output_resource_format = kYUVResourceFormat; | 127 GLenum output_resource_format = kYUVResourceFormat; |
124 size_t output_plane_count = 3; | 128 size_t output_plane_count = 3; |
125 | 129 |
126 // TODO(skaslev): If we're in software compositing mode, we do the YUV -> RGB | 130 // TODO(skaslev): If we're in software compositing mode, we do the YUV -> RGB |
127 // conversion here. That involves an extra copy of each frame to a bitmap. | 131 // conversion here. That involves an extra copy of each frame to a bitmap. |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 } | 382 } |
379 | 383 |
380 PlaneResource recycled_resource(data.resource_id, | 384 PlaneResource recycled_resource(data.resource_id, |
381 data.resource_size, | 385 data.resource_size, |
382 data.resource_format, | 386 data.resource_format, |
383 sync_point); | 387 sync_point); |
384 updater->recycled_resources_.push_back(recycled_resource); | 388 updater->recycled_resources_.push_back(recycled_resource); |
385 } | 389 } |
386 | 390 |
387 } // namespace cc | 391 } // namespace cc |
OLD | NEW |