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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 switch (format) { | 163 switch (format) { |
164 case VideoFrame::NATIVE_TEXTURE: | 164 case VideoFrame::NATIVE_TEXTURE: |
165 #if defined(GOOGLE_TV) | 165 #if defined(GOOGLE_TV) |
166 case VideoFrame::HOLE: | 166 case VideoFrame::HOLE: |
167 #endif | 167 #endif |
168 return 0; | 168 return 0; |
169 case VideoFrame::RGB32: | 169 case VideoFrame::RGB32: |
170 return 1; | 170 return 1; |
171 case VideoFrame::YV12: | 171 case VideoFrame::YV12: |
172 case VideoFrame::YV16: | 172 case VideoFrame::YV16: |
| 173 case VideoFrame::I420: |
173 return 3; | 174 return 3; |
174 case VideoFrame::YV12A: | 175 case VideoFrame::YV12A: |
175 return 4; | 176 return 4; |
176 case VideoFrame::EMPTY: | 177 case VideoFrame::EMPTY: |
177 case VideoFrame::I420: | |
178 case VideoFrame::INVALID: | 178 case VideoFrame::INVALID: |
179 break; | 179 break; |
180 } | 180 } |
181 NOTREACHED() << "Unsupported video frame format: " << format; | 181 NOTREACHED() << "Unsupported video frame format: " << format; |
182 return 0; | 182 return 0; |
183 } | 183 } |
184 | 184 |
185 static inline size_t RoundUp(size_t value, size_t alignment) { | 185 static inline size_t RoundUp(size_t value, size_t alignment) { |
186 // Check that |alignment| is a power of 2. | 186 // Check that |alignment| is a power of 2. |
187 DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1))); | 187 DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1))); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } | 316 } |
317 | 317 |
318 int VideoFrame::rows(size_t plane) const { | 318 int VideoFrame::rows(size_t plane) const { |
319 DCHECK(IsValidPlane(plane)); | 319 DCHECK(IsValidPlane(plane)); |
320 int height = coded_size_.height(); | 320 int height = coded_size_.height(); |
321 switch (format_) { | 321 switch (format_) { |
322 case RGB32: | 322 case RGB32: |
323 case YV16: | 323 case YV16: |
324 return height; | 324 return height; |
325 | 325 |
| 326 case YV12A: |
| 327 if (plane == kAPlane) |
| 328 return height; |
| 329 // fallthrough. |
326 case YV12: | 330 case YV12: |
327 case YV12A: | 331 case I420: |
328 if (plane == kYPlane || plane == kAPlane) | 332 if (plane == kYPlane) |
329 return height; | 333 return height; |
330 return RoundUp(height, 2) / 2; | 334 return RoundUp(height, 2) / 2; |
331 | 335 |
332 default: | 336 default: |
333 break; | 337 break; |
334 } | 338 } |
335 | 339 |
336 // Intentionally leave out non-production formats. | 340 // Intentionally leave out non-production formats. |
337 NOTREACHED() << "Unsupported video frame format: " << format_; | 341 NOTREACHED() << "Unsupported video frame format: " << format_; |
338 return 0; | 342 return 0; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 : mailbox_(mailbox), | 385 : mailbox_(mailbox), |
382 sync_point_(sync_point), | 386 sync_point_(sync_point), |
383 release_callback_(release_callback) {} | 387 release_callback_(release_callback) {} |
384 | 388 |
385 VideoFrame::MailboxHolder::~MailboxHolder() { | 389 VideoFrame::MailboxHolder::~MailboxHolder() { |
386 if (!release_callback_.is_null()) | 390 if (!release_callback_.is_null()) |
387 release_callback_.Run(sync_point_); | 391 release_callback_.Run(sync_point_); |
388 } | 392 } |
389 | 393 |
390 } // namespace media | 394 } // namespace media |
OLD | NEW |