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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 DCHECK_EQ(video_frame->visible_rect().x(), 0); | 64 DCHECK_EQ(video_frame->visible_rect().x(), 0); |
65 DCHECK_EQ(video_frame->visible_rect().y(), 0); | 65 DCHECK_EQ(video_frame->visible_rect().y(), 0); |
66 | 66 |
67 switch (video_frame->format()) { | 67 switch (video_frame->format()) { |
68 // Acceptable inputs. | 68 // Acceptable inputs. |
69 case media::VideoFrame::YV12: | 69 case media::VideoFrame::YV12: |
70 case media::VideoFrame::YV12A: | 70 case media::VideoFrame::YV12A: |
71 case media::VideoFrame::YV16: | 71 case media::VideoFrame::YV16: |
72 case media::VideoFrame::YV12J: | 72 case media::VideoFrame::YV12J: |
73 case media::VideoFrame::NATIVE_TEXTURE: | 73 case media::VideoFrame::NATIVE_TEXTURE: |
74 #if defined(GOOGLE_TV) | 74 #if defined(VIDEO_HOLE) |
75 case media::VideoFrame::HOLE: | 75 case media::VideoFrame::HOLE: |
76 #endif | 76 #endif // defined(VIDEO_HOLE) |
77 return true; | 77 return true; |
78 | 78 |
79 // Unacceptable inputs. ¯\(°_o)/¯ | 79 // Unacceptable inputs. ¯\(°_o)/¯ |
80 case media::VideoFrame::UNKNOWN: | 80 case media::VideoFrame::UNKNOWN: |
81 case media::VideoFrame::HISTOGRAM_MAX: | 81 case media::VideoFrame::HISTOGRAM_MAX: |
82 case media::VideoFrame::I420: | 82 case media::VideoFrame::I420: |
83 break; | 83 break; |
84 } | 84 } |
85 return false; | 85 return false; |
86 } | 86 } |
(...skipping 15 matching lines...) Expand all Loading... |
102 case media::VideoFrame::YV12A: | 102 case media::VideoFrame::YV12A: |
103 case media::VideoFrame::YV12J: | 103 case media::VideoFrame::YV12J: |
104 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 0.5f)); | 104 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 0.5f)); |
105 case media::VideoFrame::YV16: | 105 case media::VideoFrame::YV16: |
106 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 1.f)); | 106 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 1.f)); |
107 | 107 |
108 case media::VideoFrame::UNKNOWN: | 108 case media::VideoFrame::UNKNOWN: |
109 case media::VideoFrame::I420: | 109 case media::VideoFrame::I420: |
110 case media::VideoFrame::NATIVE_TEXTURE: | 110 case media::VideoFrame::NATIVE_TEXTURE: |
111 case media::VideoFrame::HISTOGRAM_MAX: | 111 case media::VideoFrame::HISTOGRAM_MAX: |
112 #if defined(GOOGLE_TV) | 112 #if defined(VIDEO_HOLE) |
113 case media::VideoFrame::HOLE: | 113 case media::VideoFrame::HOLE: |
114 #endif | 114 #endif // defined(VIDEO_HOLE) |
115 NOTREACHED(); | 115 NOTREACHED(); |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 DCHECK_EQ(output_resource_format, kRGBResourceFormat); | 119 DCHECK_EQ(output_resource_format, kRGBResourceFormat); |
120 return coded_size; | 120 return coded_size; |
121 } | 121 } |
122 | 122 |
123 VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes( | 123 VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes( |
124 const scoped_refptr<media::VideoFrame>& video_frame) { | 124 const scoped_refptr<media::VideoFrame>& video_frame) { |
125 media::VideoFrame::Format input_frame_format = video_frame->format(); | 125 media::VideoFrame::Format input_frame_format = video_frame->format(); |
126 | 126 |
127 #if defined(GOOGLE_TV) | 127 #if defined(VIDEO_HOLE) |
128 if (input_frame_format == media::VideoFrame::HOLE) { | 128 if (input_frame_format == media::VideoFrame::HOLE) { |
129 VideoFrameExternalResources external_resources; | 129 VideoFrameExternalResources external_resources; |
130 external_resources.type = VideoFrameExternalResources::HOLE; | 130 external_resources.type = VideoFrameExternalResources::HOLE; |
131 return external_resources; | 131 return external_resources; |
132 } | 132 } |
133 #endif | 133 #endif // defined(VIDEO_HOLE) |
134 | 134 |
135 // Only YUV software video frames are supported. | 135 // Only YUV software video frames are supported. |
136 DCHECK(input_frame_format == media::VideoFrame::YV12 || | 136 DCHECK(input_frame_format == media::VideoFrame::YV12 || |
137 input_frame_format == media::VideoFrame::YV12A || | 137 input_frame_format == media::VideoFrame::YV12A || |
138 input_frame_format == media::VideoFrame::YV12J || | 138 input_frame_format == media::VideoFrame::YV12J || |
139 input_frame_format == media::VideoFrame::YV16); | 139 input_frame_format == media::VideoFrame::YV16); |
140 if (input_frame_format != media::VideoFrame::YV12 && | 140 if (input_frame_format != media::VideoFrame::YV12 && |
141 input_frame_format != media::VideoFrame::YV12A && | 141 input_frame_format != media::VideoFrame::YV12A && |
142 input_frame_format != media::VideoFrame::YV12J && | 142 input_frame_format != media::VideoFrame::YV12J && |
143 input_frame_format != media::VideoFrame::YV16) | 143 input_frame_format != media::VideoFrame::YV16) |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 } | 399 } |
400 | 400 |
401 PlaneResource recycled_resource(data.resource_id, | 401 PlaneResource recycled_resource(data.resource_id, |
402 data.resource_size, | 402 data.resource_size, |
403 data.resource_format, | 403 data.resource_format, |
404 data.mailbox); | 404 data.mailbox); |
405 updater->recycled_resources_.push_back(recycled_resource); | 405 updater->recycled_resources_.push_back(recycled_resource); |
406 } | 406 } |
407 | 407 |
408 } // namespace cc | 408 } // namespace cc |
OLD | NEW |