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/base/video_frame.h" | 5 #include "media/base/video_frame.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/base/limits.h" | 8 #include "media/base/limits.h" |
9 #include "media/base/video_util.h" | 9 #include "media/base/video_util.h" |
10 | 10 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 | 191 |
192 default: | 192 default: |
193 break; | 193 break; |
194 } | 194 } |
195 | 195 |
196 // Intentionally leave out non-production formats. | 196 // Intentionally leave out non-production formats. |
197 NOTREACHED() << "Unsupported video frame format: " << format_; | 197 NOTREACHED() << "Unsupported video frame format: " << format_; |
198 return false; | 198 return false; |
199 } | 199 } |
200 | 200 |
201 int VideoFrame::stride(size_t plane) const { | 201 size_t VideoFrame::stride(size_t plane) const { |
202 DCHECK(IsValidPlane(plane)); | 202 DCHECK(IsValidPlane(plane)); |
203 return strides_[plane]; | 203 return strides_[plane]; |
204 } | 204 } |
205 | 205 |
206 int VideoFrame::row_bytes(size_t plane) const { | 206 size_t VideoFrame::row_bytes(size_t plane) const { |
207 DCHECK(IsValidPlane(plane)); | 207 DCHECK(IsValidPlane(plane)); |
208 switch (format_) { | 208 switch (format_) { |
209 // 16bpp. | |
209 case RGB555: | 210 case RGB555: |
210 case RGB565: | 211 case RGB565: |
212 return width_ * 2; | |
Ami GONE FROM CHROMIUM
2012/03/21 04:33:44
FTR, nothing uses these, right?
(i.e. this a rake-
DaleCurtis
2012/03/22 01:24:43
None that I could find. I like the rake in the gra
Ami GONE FROM CHROMIUM
2012/03/22 10:53:25
Oh, sad panda.
scherkus (not reviewing)
2012/03/22 10:57:54
I believe all usage of these additional formats ar
DaleCurtis
2012/03/22 17:30:36
To be precise, I took my notes from the previous s
| |
213 | |
214 // 24bpp. | |
211 case RGB24: | 215 case RGB24: |
216 return width_ * 3; | |
217 | |
218 // 32bpp. | |
212 case RGB32: | 219 case RGB32: |
213 case RGBA: | 220 case RGBA: |
214 return width_; | 221 return width_ * 4; |
215 | 222 |
223 // Planar, 8bpp. | |
216 case YV12: | 224 case YV12: |
217 case YV16: | 225 case YV16: |
218 if (plane == kYPlane) | 226 if (plane == kYPlane) |
219 return width_; | 227 return width_; |
220 return RoundUp(width_, 2) / 2; | 228 return RoundUp(width_, 2) / 2; |
221 | 229 |
222 default: | 230 default: |
223 break; | 231 break; |
224 } | 232 } |
225 | 233 |
226 // Intentionally leave out non-production formats. | 234 // Intentionally leave out non-production formats. |
227 NOTREACHED() << "Unsupported video frame format: " << format_; | 235 NOTREACHED() << "Unsupported video frame format: " << format_; |
228 return 0; | 236 return 0; |
229 } | 237 } |
230 | 238 |
231 int VideoFrame::rows(size_t plane) const { | 239 size_t VideoFrame::rows(size_t plane) const { |
232 DCHECK(IsValidPlane(plane)); | 240 DCHECK(IsValidPlane(plane)); |
233 switch (format_) { | 241 switch (format_) { |
234 case RGB555: | 242 case RGB555: |
235 case RGB565: | 243 case RGB565: |
236 case RGB24: | 244 case RGB24: |
237 case RGB32: | 245 case RGB32: |
238 case RGBA: | 246 case RGBA: |
239 case YV16: | 247 case YV16: |
240 return height_; | 248 return height_; |
241 | 249 |
(...skipping 24 matching lines...) Expand all Loading... | |
266 uint32 VideoFrame::texture_target() const { | 274 uint32 VideoFrame::texture_target() const { |
267 DCHECK_EQ(format_, NATIVE_TEXTURE); | 275 DCHECK_EQ(format_, NATIVE_TEXTURE); |
268 return texture_target_; | 276 return texture_target_; |
269 } | 277 } |
270 | 278 |
271 bool VideoFrame::IsEndOfStream() const { | 279 bool VideoFrame::IsEndOfStream() const { |
272 return format_ == VideoFrame::EMPTY; | 280 return format_ == VideoFrame::EMPTY; |
273 } | 281 } |
274 | 282 |
275 } // namespace media | 283 } // namespace media |
OLD | NEW |