| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/formats/mp4/hevc.h" | 5 #include "media/formats/mp4/hevc.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 if (media_log.get()) { | 120 if (media_log.get()) { |
| 121 MEDIA_LOG(INFO, media_log) << "Video codec: hevc"; | 121 MEDIA_LOG(INFO, media_log) << "Video codec: hevc"; |
| 122 } | 122 } |
| 123 | 123 |
| 124 return true; | 124 return true; |
| 125 } | 125 } |
| 126 | 126 |
| 127 VideoCodecProfile HEVCDecoderConfigurationRecord::GetVideoProfile() const { |
| 128 // The values of general_profile_idc are taken from the HEVC standard, see |
| 129 // the latest https://www.itu.int/rec/T-REC-H.265/en section A.3 |
| 130 switch (general_profile_idc) { |
| 131 case 1: |
| 132 return HEVCPROFILE_MAIN; |
| 133 case 2: |
| 134 return HEVCPROFILE_MAIN10; |
| 135 case 3: |
| 136 return HEVCPROFILE_MAIN_STILL_PICTURE; |
| 137 } |
| 138 return VIDEO_CODEC_PROFILE_UNKNOWN; |
| 139 } |
| 140 |
| 127 static const uint8_t kAnnexBStartCode[] = {0, 0, 0, 1}; | 141 static const uint8_t kAnnexBStartCode[] = {0, 0, 0, 1}; |
| 128 static const int kAnnexBStartCodeSize = 4; | 142 static const int kAnnexBStartCodeSize = 4; |
| 129 | 143 |
| 130 bool HEVC::InsertParamSetsAnnexB( | 144 bool HEVC::InsertParamSetsAnnexB( |
| 131 const HEVCDecoderConfigurationRecord& hevc_config, | 145 const HEVCDecoderConfigurationRecord& hevc_config, |
| 132 std::vector<uint8_t>* buffer, | 146 std::vector<uint8_t>* buffer, |
| 133 std::vector<SubsampleEntry>* subsamples) { | 147 std::vector<SubsampleEntry>* subsamples) { |
| 134 DCHECK(HEVC::IsValidAnnexB(*buffer, *subsamples)); | 148 DCHECK(HEVC::IsValidAnnexB(*buffer, *subsamples)); |
| 135 | 149 |
| 136 std::unique_ptr<H265Parser> parser(new H265Parser()); | 150 std::unique_ptr<H265Parser> parser(new H265Parser()); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // count for that first subsample. | 248 // count for that first subsample. |
| 235 RCHECK(HEVC::InsertParamSetsAnnexB(*hevc_config_, frame_buf, subsamples)); | 249 RCHECK(HEVC::InsertParamSetsAnnexB(*hevc_config_, frame_buf, subsamples)); |
| 236 } | 250 } |
| 237 | 251 |
| 238 DCHECK(HEVC::IsValidAnnexB(*frame_buf, *subsamples)); | 252 DCHECK(HEVC::IsValidAnnexB(*frame_buf, *subsamples)); |
| 239 return true; | 253 return true; |
| 240 } | 254 } |
| 241 | 255 |
| 242 } // namespace mp4 | 256 } // namespace mp4 |
| 243 } // namespace media | 257 } // namespace media |
| OLD | NEW |