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){ | |
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::YV12A: | |
60 return "YV12A"; | |
61 case VideoFrame::Format::NATIVE_TEXTURE: | |
62 return "NATIVE_TEXTURE"; | |
scherkus (not reviewing)
2013/08/03 00:17:18
try to have this order match the order defined in
Ty Overby
2013/08/05 19:18:45
Done.
| |
63 } | |
64 } | |
65 | |
45 // static | 66 // static |
46 bool VideoFrame::IsValidConfig(VideoFrame::Format format, | 67 bool VideoFrame::IsValidConfig(VideoFrame::Format format, |
47 const gfx::Size& coded_size, | 68 const gfx::Size& coded_size, |
48 const gfx::Rect& visible_rect, | 69 const gfx::Rect& visible_rect, |
49 const gfx::Size& natural_size) { | 70 const gfx::Size& natural_size) { |
50 return (format != VideoFrame::INVALID && | 71 return (format != VideoFrame::INVALID && |
51 !coded_size.IsEmpty() && | 72 !coded_size.IsEmpty() && |
52 coded_size.GetArea() <= limits::kMaxCanvas && | 73 coded_size.GetArea() <= limits::kMaxCanvas && |
53 coded_size.width() <= limits::kMaxDimension && | 74 coded_size.width() <= limits::kMaxDimension && |
54 coded_size.height() <= limits::kMaxDimension && | 75 coded_size.height() <= limits::kMaxDimension && |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 : mailbox_(mailbox), | 402 : mailbox_(mailbox), |
382 sync_point_(sync_point), | 403 sync_point_(sync_point), |
383 release_callback_(release_callback) {} | 404 release_callback_(release_callback) {} |
384 | 405 |
385 VideoFrame::MailboxHolder::~MailboxHolder() { | 406 VideoFrame::MailboxHolder::~MailboxHolder() { |
386 if (!release_callback_.is_null()) | 407 if (!release_callback_.is_null()) |
387 release_callback_.Run(sync_point_); | 408 release_callback_.Run(sync_point_); |
388 } | 409 } |
389 | 410 |
390 } // namespace media | 411 } // namespace media |
OLD | NEW |