| 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 #include <climits> | 8 #include <climits> |
| 9 | 9 |
| 10 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 } | 645 } |
| 646 | 646 |
| 647 bool VideoFrame::IsMappable() const { | 647 bool VideoFrame::IsMappable() const { |
| 648 return IsStorageTypeMappable(storage_type_); | 648 return IsStorageTypeMappable(storage_type_); |
| 649 } | 649 } |
| 650 | 650 |
| 651 bool VideoFrame::HasTextures() const { | 651 bool VideoFrame::HasTextures() const { |
| 652 return !mailbox_holders_[0].mailbox.IsZero(); | 652 return !mailbox_holders_[0].mailbox.IsZero(); |
| 653 } | 653 } |
| 654 | 654 |
| 655 gfx::ColorSpace VideoFrame::ColorSpace() const { |
| 656 int videoframe_color_space; |
| 657 if (metadata()->GetInteger(media::VideoFrameMetadata::COLOR_SPACE, |
| 658 &videoframe_color_space)) { |
| 659 switch (videoframe_color_space) { |
| 660 case media::COLOR_SPACE_JPEG: |
| 661 return gfx::ColorSpace::CreateJpeg(); |
| 662 case media::COLOR_SPACE_HD_REC709: |
| 663 return gfx::ColorSpace::CreateREC709(); |
| 664 case media::COLOR_SPACE_SD_REC601: |
| 665 return gfx::ColorSpace::CreateREC601(); |
| 666 default: |
| 667 break; |
| 668 } |
| 669 } |
| 670 return gfx::ColorSpace(); |
| 671 } |
| 672 |
| 655 int VideoFrame::stride(size_t plane) const { | 673 int VideoFrame::stride(size_t plane) const { |
| 656 DCHECK(IsValidPlane(plane, format_)); | 674 DCHECK(IsValidPlane(plane, format_)); |
| 657 return strides_[plane]; | 675 return strides_[plane]; |
| 658 } | 676 } |
| 659 | 677 |
| 660 int VideoFrame::row_bytes(size_t plane) const { | 678 int VideoFrame::row_bytes(size_t plane) const { |
| 661 return RowBytes(plane, format_, coded_size_.width()); | 679 return RowBytes(plane, format_, coded_size_.width()); |
| 662 } | 680 } |
| 663 | 681 |
| 664 int VideoFrame::rows(size_t plane) const { | 682 int VideoFrame::rows(size_t plane) const { |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 if (zero_initialize_memory) | 1148 if (zero_initialize_memory) |
| 1131 memset(data, 0, data_size); | 1149 memset(data, 0, data_size); |
| 1132 | 1150 |
| 1133 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) | 1151 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) |
| 1134 data_[plane] = data + offset[plane]; | 1152 data_[plane] = data + offset[plane]; |
| 1135 | 1153 |
| 1136 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); | 1154 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); |
| 1137 } | 1155 } |
| 1138 | 1156 |
| 1139 } // namespace media | 1157 } // namespace media |
| OLD | NEW |