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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 128 } |
129 | 129 |
130 // static | 130 // static |
131 scoped_refptr<VideoFrame> VideoFrame::CreateBlackFrame(const gfx::Size& size) { | 131 scoped_refptr<VideoFrame> VideoFrame::CreateBlackFrame(const gfx::Size& size) { |
132 const uint8 kBlackY = 0x00; | 132 const uint8 kBlackY = 0x00; |
133 const uint8 kBlackUV = 0x80; | 133 const uint8 kBlackUV = 0x80; |
134 const base::TimeDelta kZero; | 134 const base::TimeDelta kZero; |
135 return CreateColorFrame(size, kBlackY, kBlackUV, kBlackUV, kZero); | 135 return CreateColorFrame(size, kBlackY, kBlackUV, kBlackUV, kZero); |
136 } | 136 } |
137 | 137 |
| 138 #if defined(GOOGLE_TV) |
| 139 // static |
| 140 scoped_refptr<VideoFrame> VideoFrame::CreateHoleFrame( |
| 141 const gfx::Size& size) { |
| 142 DCHECK(IsValidConfig(VideoFrame::HOLE, size, gfx::Rect(size), size)); |
| 143 scoped_refptr<VideoFrame> frame(new VideoFrame( |
| 144 VideoFrame::HOLE, size, gfx::Rect(size), size, base::TimeDelta())); |
| 145 return frame; |
| 146 } |
| 147 #endif |
| 148 |
138 static inline size_t RoundUp(size_t value, size_t alignment) { | 149 static inline size_t RoundUp(size_t value, size_t alignment) { |
139 // Check that |alignment| is a power of 2. | 150 // Check that |alignment| is a power of 2. |
140 DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1))); | 151 DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1))); |
141 return ((value + (alignment - 1)) & ~(alignment-1)); | 152 return ((value + (alignment - 1)) & ~(alignment-1)); |
142 } | 153 } |
143 | 154 |
144 // Release data allocated by AllocateRGB() or AllocateYUV(). | 155 // Release data allocated by AllocateRGB() or AllocateYUV(). |
145 static void ReleaseData(uint8* data) { | 156 static void ReleaseData(uint8* data) { |
146 DCHECK(data); | 157 DCHECK(data); |
147 base::AlignedFree(data); | 158 base::AlignedFree(data); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 break; | 333 break; |
323 for (int row = 0; row < rows(plane); ++row) { | 334 for (int row = 0; row < rows(plane); ++row) { |
324 base::MD5Update(context, base::StringPiece( | 335 base::MD5Update(context, base::StringPiece( |
325 reinterpret_cast<char*>(data(plane) + stride(plane) * row), | 336 reinterpret_cast<char*>(data(plane) + stride(plane) * row), |
326 row_bytes(plane))); | 337 row_bytes(plane))); |
327 } | 338 } |
328 } | 339 } |
329 } | 340 } |
330 | 341 |
331 } // namespace media | 342 } // namespace media |
OLD | NEW |