Chromium Code Reviews| 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 24 matching lines...) Expand all Loading... | |
| 35 case VideoFrame::YV12A: | 35 case VideoFrame::YV12A: |
| 36 case VideoFrame::YV16: | 36 case VideoFrame::YV16: |
| 37 frame->AllocateYUV(); | 37 frame->AllocateYUV(); |
| 38 break; | 38 break; |
| 39 default: | 39 default: |
| 40 LOG(FATAL) << "Unsupported frame format: " << format; | 40 LOG(FATAL) << "Unsupported frame format: " << format; |
| 41 } | 41 } |
| 42 return frame; | 42 return frame; |
| 43 } | 43 } |
| 44 | 44 |
| 45 static std::string FormatToString(VideoFrame::Format format) { | |
| 46 switch(format){ | |
|
DaleCurtis
2013/08/05 19:58:39
Space after )
Ty Overby
2013/08/05 20:14:59
Done.
| |
| 47 case VideoFrame::Format::INVALID: | |
| 48 return "INVALID"; | |
| 49 case VideoFrame::Format::RGB32: | |
| 50 return "RGB32"; | |
| 51 case VideoFrame::Format::YV12: | |
| 52 return "YV12"; | |
| 53 case VideoFrame::Format::YV16: | |
| 54 return "YV16"; | |
| 55 case VideoFrame::Format::EMPTY: | |
| 56 return "EMPTY"; | |
| 57 case VideoFrame::Format::I420: | |
| 58 return "I420"; | |
| 59 case VideoFrame::Format::NATIVE_TEXTURE: | |
| 60 return "NATIVE_TEXTURE"; | |
| 61 #if defined(GOOGLE_TV) | |
| 62 case VideoFrame::Format::HOLE: | |
| 63 return "HOLE"; | |
| 64 #endif | |
| 65 case VideoFrame::Format::YV12A: | |
| 66 return "YV12A"; | |
| 67 } | |
| 68 } | |
| 69 | |
| 45 // static | 70 // static |
| 46 bool VideoFrame::IsValidConfig(VideoFrame::Format format, | 71 bool VideoFrame::IsValidConfig(VideoFrame::Format format, |
| 47 const gfx::Size& coded_size, | 72 const gfx::Size& coded_size, |
| 48 const gfx::Rect& visible_rect, | 73 const gfx::Rect& visible_rect, |
| 49 const gfx::Size& natural_size) { | 74 const gfx::Size& natural_size) { |
| 50 return (format != VideoFrame::INVALID && | 75 return (format != VideoFrame::INVALID && |
| 51 !coded_size.IsEmpty() && | 76 !coded_size.IsEmpty() && |
| 52 coded_size.GetArea() <= limits::kMaxCanvas && | 77 coded_size.GetArea() <= limits::kMaxCanvas && |
| 53 coded_size.width() <= limits::kMaxDimension && | 78 coded_size.width() <= limits::kMaxDimension && |
| 54 coded_size.height() <= limits::kMaxDimension && | 79 coded_size.height() <= limits::kMaxDimension && |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 : mailbox_(mailbox), | 406 : mailbox_(mailbox), |
| 382 sync_point_(sync_point), | 407 sync_point_(sync_point), |
| 383 release_callback_(release_callback) {} | 408 release_callback_(release_callback) {} |
| 384 | 409 |
| 385 VideoFrame::MailboxHolder::~MailboxHolder() { | 410 VideoFrame::MailboxHolder::~MailboxHolder() { |
| 386 if (!release_callback_.is_null()) | 411 if (!release_callback_.is_null()) |
| 387 release_callback_.Run(sync_point_); | 412 release_callback_.Run(sync_point_); |
| 388 } | 413 } |
| 389 | 414 |
| 390 } // namespace media | 415 } // namespace media |
| OLD | NEW |