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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 case media::VideoFrame::YV12A: | 70 case media::VideoFrame::YV12A: |
71 case media::VideoFrame::YV16: | 71 case media::VideoFrame::YV16: |
72 case media::VideoFrame::NATIVE_TEXTURE: | 72 case media::VideoFrame::NATIVE_TEXTURE: |
73 #if defined(GOOGLE_TV) | 73 #if defined(GOOGLE_TV) |
74 case media::VideoFrame::HOLE: | 74 case media::VideoFrame::HOLE: |
75 #endif | 75 #endif |
76 return true; | 76 return true; |
77 | 77 |
78 // Unacceptable inputs. ¯\(°_o)/¯ | 78 // Unacceptable inputs. ¯\(°_o)/¯ |
79 case media::VideoFrame::UNKNOWN: | 79 case media::VideoFrame::UNKNOWN: |
80 case media::VideoFrame::EMPTY: | |
81 case media::VideoFrame::I420: | 80 case media::VideoFrame::I420: |
82 break; | 81 break; |
83 } | 82 } |
84 return false; | 83 return false; |
85 } | 84 } |
86 | 85 |
87 // For frames that we receive in software format, determine the dimensions of | 86 // For frames that we receive in software format, determine the dimensions of |
88 // each plane in the frame. | 87 // each plane in the frame. |
89 static gfx::Size SoftwarePlaneDimension( | 88 static gfx::Size SoftwarePlaneDimension( |
90 media::VideoFrame::Format input_frame_format, | 89 media::VideoFrame::Format input_frame_format, |
91 gfx::Size coded_size, | 90 gfx::Size coded_size, |
92 ResourceFormat output_resource_format, | 91 ResourceFormat output_resource_format, |
93 int plane_index) { | 92 int plane_index) { |
94 if (output_resource_format == kYUVResourceFormat) { | 93 if (output_resource_format == kYUVResourceFormat) { |
95 if (plane_index == media::VideoFrame::kYPlane || | 94 if (plane_index == media::VideoFrame::kYPlane || |
96 plane_index == media::VideoFrame::kAPlane) | 95 plane_index == media::VideoFrame::kAPlane) |
97 return coded_size; | 96 return coded_size; |
98 | 97 |
99 switch (input_frame_format) { | 98 switch (input_frame_format) { |
100 case media::VideoFrame::YV12: | 99 case media::VideoFrame::YV12: |
101 case media::VideoFrame::YV12A: | 100 case media::VideoFrame::YV12A: |
102 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 0.5f)); | 101 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 0.5f)); |
103 case media::VideoFrame::YV16: | 102 case media::VideoFrame::YV16: |
104 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 1.f)); | 103 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 1.f)); |
105 | 104 |
106 case media::VideoFrame::UNKNOWN: | 105 case media::VideoFrame::UNKNOWN: |
107 case media::VideoFrame::EMPTY: | |
108 case media::VideoFrame::I420: | 106 case media::VideoFrame::I420: |
109 case media::VideoFrame::NATIVE_TEXTURE: | 107 case media::VideoFrame::NATIVE_TEXTURE: |
110 #if defined(GOOGLE_TV) | 108 #if defined(GOOGLE_TV) |
111 case media::VideoFrame::HOLE: | 109 case media::VideoFrame::HOLE: |
112 #endif | 110 #endif |
113 NOTREACHED(); | 111 NOTREACHED(); |
114 } | 112 } |
115 } | 113 } |
116 | 114 |
117 DCHECK_EQ(output_resource_format, kRGBResourceFormat); | 115 DCHECK_EQ(output_resource_format, kRGBResourceFormat); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 } | 396 } |
399 | 397 |
400 PlaneResource recycled_resource(data.resource_id, | 398 PlaneResource recycled_resource(data.resource_id, |
401 data.resource_size, | 399 data.resource_size, |
402 data.resource_format, | 400 data.resource_format, |
403 data.mailbox); | 401 data.mailbox); |
404 updater->recycled_resources_.push_back(recycled_resource); | 402 updater->recycled_resources_.push_back(recycled_resource); |
405 } | 403 } |
406 | 404 |
407 } // namespace cc | 405 } // namespace cc |
OLD | NEW |