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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 216 |
217 // static | 217 // static |
218 scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture( | 218 scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture( |
219 VideoPixelFormat format, | 219 VideoPixelFormat format, |
220 const gpu::MailboxHolder& mailbox_holder, | 220 const gpu::MailboxHolder& mailbox_holder, |
221 const ReleaseMailboxCB& mailbox_holder_release_cb, | 221 const ReleaseMailboxCB& mailbox_holder_release_cb, |
222 const gfx::Size& coded_size, | 222 const gfx::Size& coded_size, |
223 const gfx::Rect& visible_rect, | 223 const gfx::Rect& visible_rect, |
224 const gfx::Size& natural_size, | 224 const gfx::Size& natural_size, |
225 base::TimeDelta timestamp) { | 225 base::TimeDelta timestamp) { |
226 if (format != PIXEL_FORMAT_ARGB) { | 226 if (format != PIXEL_FORMAT_ARGB && format != PIXEL_FORMAT_UYVY) { |
227 DLOG(ERROR) << "Only ARGB pixel format supported, got " | 227 DLOG(ERROR) << "Unsupported pixel format supported, got " |
228 << VideoPixelFormatToString(format); | 228 << VideoPixelFormatToString(format); |
229 return nullptr; | 229 return nullptr; |
230 } | 230 } |
231 const StorageType storage = STORAGE_OPAQUE; | 231 const StorageType storage = STORAGE_OPAQUE; |
232 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { | 232 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { |
233 DLOG(ERROR) << __FUNCTION__ << " Invalid config." | 233 DLOG(ERROR) << __FUNCTION__ << " Invalid config." |
234 << ConfigToString(format, storage, coded_size, visible_rect, | 234 << ConfigToString(format, storage, coded_size, visible_rect, |
235 natural_size); | 235 natural_size); |
236 return nullptr; | 236 return nullptr; |
237 } | 237 } |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 uint8* data = reinterpret_cast<uint8*>( | 907 uint8* data = reinterpret_cast<uint8*>( |
908 base::AlignedAlloc(data_size, kFrameAddressAlignment)); | 908 base::AlignedAlloc(data_size, kFrameAddressAlignment)); |
909 | 909 |
910 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) | 910 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) |
911 data_[plane] = data + offset[plane]; | 911 data_[plane] = data + offset[plane]; |
912 | 912 |
913 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); | 913 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); |
914 } | 914 } |
915 | 915 |
916 } // namespace media | 916 } // namespace media |
OLD | NEW |