| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } | 242 } |
| 243 | 243 |
| 244 // static | 244 // static |
| 245 scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture( | 245 scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture( |
| 246 scoped_ptr<gpu::MailboxHolder> mailbox_holder, | 246 scoped_ptr<gpu::MailboxHolder> mailbox_holder, |
| 247 const ReleaseMailboxCB& mailbox_holder_release_cb, | 247 const ReleaseMailboxCB& mailbox_holder_release_cb, |
| 248 const gfx::Size& coded_size, | 248 const gfx::Size& coded_size, |
| 249 const gfx::Rect& visible_rect, | 249 const gfx::Rect& visible_rect, |
| 250 const gfx::Size& natural_size, | 250 const gfx::Size& natural_size, |
| 251 base::TimeDelta timestamp, | 251 base::TimeDelta timestamp, |
| 252 bool allow_overlay) { | 252 bool allow_overlay, |
| 253 bool has_alpha) { |
| 253 scoped_refptr<VideoFrame> frame(new VideoFrame(NATIVE_TEXTURE, | 254 scoped_refptr<VideoFrame> frame(new VideoFrame(NATIVE_TEXTURE, |
| 254 coded_size, | 255 coded_size, |
| 255 visible_rect, | 256 visible_rect, |
| 256 natural_size, | 257 natural_size, |
| 257 mailbox_holder.Pass(), | 258 mailbox_holder.Pass(), |
| 258 timestamp, | 259 timestamp, |
| 259 false)); | 260 false)); |
| 260 frame->mailbox_holder_release_cb_ = mailbox_holder_release_cb; | 261 frame->mailbox_holder_release_cb_ = mailbox_holder_release_cb; |
| 261 frame->allow_overlay_ = allow_overlay; | 262 frame->allow_overlay_ = allow_overlay; |
| 263 frame->has_alpha_ = has_alpha; |
| 262 | 264 |
| 263 return frame; | 265 return frame; |
| 264 } | 266 } |
| 265 | 267 |
| 266 // static | 268 // static |
| 267 scoped_refptr<VideoFrame> VideoFrame::WrapExternalPackedMemory( | 269 scoped_refptr<VideoFrame> VideoFrame::WrapExternalPackedMemory( |
| 268 Format format, | 270 Format format, |
| 269 const gfx::Size& coded_size, | 271 const gfx::Size& coded_size, |
| 270 const gfx::Rect& visible_rect, | 272 const gfx::Rect& visible_rect, |
| 271 const gfx::Size& natural_size, | 273 const gfx::Size& natural_size, |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 : format_(format), | 672 : format_(format), |
| 671 coded_size_(coded_size), | 673 coded_size_(coded_size), |
| 672 visible_rect_(visible_rect), | 674 visible_rect_(visible_rect), |
| 673 natural_size_(natural_size), | 675 natural_size_(natural_size), |
| 674 mailbox_holder_(mailbox_holder.Pass()), | 676 mailbox_holder_(mailbox_holder.Pass()), |
| 675 shared_memory_handle_(base::SharedMemory::NULLHandle()), | 677 shared_memory_handle_(base::SharedMemory::NULLHandle()), |
| 676 shared_memory_offset_(0), | 678 shared_memory_offset_(0), |
| 677 timestamp_(timestamp), | 679 timestamp_(timestamp), |
| 678 release_sync_point_(0), | 680 release_sync_point_(0), |
| 679 end_of_stream_(end_of_stream), | 681 end_of_stream_(end_of_stream), |
| 680 allow_overlay_(false) { | 682 allow_overlay_(false), |
| 683 has_alpha_(false) { |
| 681 DCHECK(IsValidConfig(format_, coded_size_, visible_rect_, natural_size_)); | 684 DCHECK(IsValidConfig(format_, coded_size_, visible_rect_, natural_size_)); |
| 682 | 685 |
| 683 memset(&strides_, 0, sizeof(strides_)); | 686 memset(&strides_, 0, sizeof(strides_)); |
| 684 memset(&data_, 0, sizeof(data_)); | 687 memset(&data_, 0, sizeof(data_)); |
| 685 } | 688 } |
| 686 | 689 |
| 687 VideoFrame::~VideoFrame() { | 690 VideoFrame::~VideoFrame() { |
| 688 if (!mailbox_holder_release_cb_.is_null()) { | 691 if (!mailbox_holder_release_cb_.is_null()) { |
| 689 uint32 release_sync_point; | 692 uint32 release_sync_point; |
| 690 { | 693 { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) { | 814 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) { |
| 812 for (int row = 0; row < rows(plane); ++row) { | 815 for (int row = 0; row < rows(plane); ++row) { |
| 813 base::MD5Update(context, base::StringPiece( | 816 base::MD5Update(context, base::StringPiece( |
| 814 reinterpret_cast<char*>(data(plane) + stride(plane) * row), | 817 reinterpret_cast<char*>(data(plane) + stride(plane) * row), |
| 815 row_bytes(plane))); | 818 row_bytes(plane))); |
| 816 } | 819 } |
| 817 } | 820 } |
| 818 } | 821 } |
| 819 | 822 |
| 820 } // namespace media | 823 } // namespace media |
| OLD | NEW |