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