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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 | 879 |
880 int VideoFrame::rows(size_t plane) const { | 880 int VideoFrame::rows(size_t plane) const { |
881 return Rows(plane, format_, coded_size_.height()); | 881 return Rows(plane, format_, coded_size_.height()); |
882 } | 882 } |
883 | 883 |
884 uint8* VideoFrame::data(size_t plane) const { | 884 uint8* VideoFrame::data(size_t plane) const { |
885 DCHECK(IsValidPlane(plane, format_)); | 885 DCHECK(IsValidPlane(plane, format_)); |
886 return data_[plane]; | 886 return data_[plane]; |
887 } | 887 } |
888 | 888 |
| 889 uint8* VideoFrame::visible_data(size_t plane) const { |
| 890 uint8* coded_data = data(plane); |
| 891 const int coded_stride = stride(plane); |
| 892 switch (plane) { |
| 893 case kYPlane: |
| 894 case kAPlane: |
| 895 return coded_data + visible_rect_.y() * coded_stride + visible_rect_.x(); |
| 896 case kUPlane: |
| 897 case kVPlane: |
| 898 return coded_data + visible_rect_.y() / 2 * coded_stride + |
| 899 visible_rect_.x() / 2; |
| 900 default: |
| 901 NOTIMPLEMENTED(); |
| 902 return NULL; |
| 903 } |
| 904 } |
| 905 |
889 const gpu::MailboxHolder* VideoFrame::mailbox_holder() const { | 906 const gpu::MailboxHolder* VideoFrame::mailbox_holder() const { |
890 DCHECK_EQ(format_, NATIVE_TEXTURE); | 907 DCHECK_EQ(format_, NATIVE_TEXTURE); |
891 return mailbox_holder_.get(); | 908 return mailbox_holder_.get(); |
892 } | 909 } |
893 | 910 |
894 base::SharedMemoryHandle VideoFrame::shared_memory_handle() const { | 911 base::SharedMemoryHandle VideoFrame::shared_memory_handle() const { |
895 return shared_memory_handle_; | 912 return shared_memory_handle_; |
896 } | 913 } |
897 | 914 |
898 void VideoFrame::UpdateReleaseSyncPoint(SyncPointClient* client) { | 915 void VideoFrame::UpdateReleaseSyncPoint(SyncPointClient* client) { |
(...skipping 25 matching lines...) Expand all Loading... |
924 break; | 941 break; |
925 for (int row = 0; row < rows(plane); ++row) { | 942 for (int row = 0; row < rows(plane); ++row) { |
926 base::MD5Update(context, base::StringPiece( | 943 base::MD5Update(context, base::StringPiece( |
927 reinterpret_cast<char*>(data(plane) + stride(plane) * row), | 944 reinterpret_cast<char*>(data(plane) + stride(plane) * row), |
928 row_bytes(plane))); | 945 row_bytes(plane))); |
929 } | 946 } |
930 } | 947 } |
931 } | 948 } |
932 | 949 |
933 } // namespace media | 950 } // namespace media |
OLD | NEW |