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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 } | 757 } |
758 NOTREACHED() << "Unsupported video frame format/plane: " << format << "/" | 758 NOTREACHED() << "Unsupported video frame format/plane: " << format << "/" |
759 << plane; | 759 << plane; |
760 return 0; | 760 return 0; |
761 } | 761 } |
762 | 762 |
763 int VideoFrame::row_bytes(size_t plane) const { | 763 int VideoFrame::row_bytes(size_t plane) const { |
764 return RowBytes(plane, format_, coded_size_.width()); | 764 return RowBytes(plane, format_, coded_size_.width()); |
765 } | 765 } |
766 | 766 |
767 int VideoFrame::rows(size_t plane) const { | 767 // static |
768 DCHECK(IsValidPlane(plane, format_)); | 768 int VideoFrame::Rows(size_t plane, VideoFrame::Format format, int height) { |
769 int height = coded_size_.height(); | 769 DCHECK(IsValidPlane(plane, format)); |
770 switch (format_) { | 770 switch (format) { |
771 case VideoFrame::YV24: | 771 case VideoFrame::YV24: |
772 case VideoFrame::YV16: | 772 case VideoFrame::YV16: |
773 switch (plane) { | 773 switch (plane) { |
774 case kYPlane: | 774 case kYPlane: |
775 case kUPlane: | 775 case kUPlane: |
776 case kVPlane: | 776 case kVPlane: |
777 return height; | 777 return height; |
778 default: | 778 default: |
779 break; | 779 break; |
780 } | 780 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 break; | 814 break; |
815 } | 815 } |
816 break; | 816 break; |
817 case VideoFrame::UNKNOWN: | 817 case VideoFrame::UNKNOWN: |
818 #if defined(VIDEO_HOLE) | 818 #if defined(VIDEO_HOLE) |
819 case VideoFrame::HOLE: | 819 case VideoFrame::HOLE: |
820 #endif // defined(VIDEO_HOLE) | 820 #endif // defined(VIDEO_HOLE) |
821 case VideoFrame::NATIVE_TEXTURE: | 821 case VideoFrame::NATIVE_TEXTURE: |
822 break; | 822 break; |
823 } | 823 } |
824 NOTREACHED() << "Unsupported video frame format/plane: " | 824 NOTREACHED() << "Unsupported video frame format/plane: " << format << "/" |
825 << format_ << "/" << plane; | 825 << plane; |
826 return 0; | 826 return 0; |
827 } | 827 } |
828 | 828 |
| 829 int VideoFrame::rows(size_t plane) const { |
| 830 return Rows(plane, format_, coded_size_.height()); |
| 831 } |
| 832 |
829 uint8* VideoFrame::data(size_t plane) const { | 833 uint8* VideoFrame::data(size_t plane) const { |
830 DCHECK(IsValidPlane(plane, format_)); | 834 DCHECK(IsValidPlane(plane, format_)); |
831 return data_[plane]; | 835 return data_[plane]; |
832 } | 836 } |
833 | 837 |
834 const gpu::MailboxHolder* VideoFrame::mailbox_holder() const { | 838 const gpu::MailboxHolder* VideoFrame::mailbox_holder() const { |
835 DCHECK_EQ(format_, NATIVE_TEXTURE); | 839 DCHECK_EQ(format_, NATIVE_TEXTURE); |
836 return mailbox_holder_.get(); | 840 return mailbox_holder_.get(); |
837 } | 841 } |
838 | 842 |
(...skipping 24 matching lines...) Expand all Loading... |
863 break; | 867 break; |
864 for (int row = 0; row < rows(plane); ++row) { | 868 for (int row = 0; row < rows(plane); ++row) { |
865 base::MD5Update(context, base::StringPiece( | 869 base::MD5Update(context, base::StringPiece( |
866 reinterpret_cast<char*>(data(plane) + stride(plane) * row), | 870 reinterpret_cast<char*>(data(plane) + stride(plane) * row), |
867 row_bytes(plane))); | 871 row_bytes(plane))); |
868 } | 872 } |
869 } | 873 } |
870 } | 874 } |
871 | 875 |
872 } // namespace media | 876 } // namespace media |
OLD | NEW |