| 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 HEVCDecoderConfigurationRecord::~HEVCDecoderConfigurationRecord() {} | 42 HEVCDecoderConfigurationRecord::~HEVCDecoderConfigurationRecord() {} |
| 43 FourCC HEVCDecoderConfigurationRecord::BoxType() const { return FOURCC_HVCC; } | 43 FourCC HEVCDecoderConfigurationRecord::BoxType() const { return FOURCC_HVCC; } |
| 44 | 44 |
| 45 bool HEVCDecoderConfigurationRecord::Parse(BoxReader* reader) { | 45 bool HEVCDecoderConfigurationRecord::Parse(BoxReader* reader) { |
| 46 return ParseInternal(reader, reader->media_log()); | 46 return ParseInternal(reader, reader->media_log()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool HEVCDecoderConfigurationRecord::Parse(const uint8_t* data, int data_size) { | 49 bool HEVCDecoderConfigurationRecord::Parse(const uint8_t* data, int data_size) { |
| 50 BufferReader reader(data, data_size); | 50 BufferReader reader(data, data_size); |
| 51 return ParseInternal(&reader, new MediaLog()); | 51 // TODO(wolenetz): Questionable MediaLog usage, http://crbug.com/712310 |
| 52 MediaLog media_log; |
| 53 return ParseInternal(&reader, &media_log); |
| 52 } | 54 } |
| 53 | 55 |
| 54 HEVCDecoderConfigurationRecord::HVCCNALArray::HVCCNALArray() | 56 HEVCDecoderConfigurationRecord::HVCCNALArray::HVCCNALArray() |
| 55 : first_byte(0) {} | 57 : first_byte(0) {} |
| 56 | 58 |
| 57 HEVCDecoderConfigurationRecord::HVCCNALArray::HVCCNALArray( | 59 HEVCDecoderConfigurationRecord::HVCCNALArray::HVCCNALArray( |
| 58 const HVCCNALArray& other) = default; | 60 const HVCCNALArray& other) = default; |
| 59 | 61 |
| 60 HEVCDecoderConfigurationRecord::HVCCNALArray::~HVCCNALArray() {} | 62 HEVCDecoderConfigurationRecord::HVCCNALArray::~HVCCNALArray() {} |
| 61 | 63 |
| 62 bool HEVCDecoderConfigurationRecord::ParseInternal( | 64 bool HEVCDecoderConfigurationRecord::ParseInternal(BufferReader* reader, |
| 63 BufferReader* reader, | 65 MediaLog* media_log) { |
| 64 const scoped_refptr<MediaLog>& media_log) { | |
| 65 uint8_t profile_indication = 0; | 66 uint8_t profile_indication = 0; |
| 66 uint32_t general_constraint_indicator_flags_hi = 0; | 67 uint32_t general_constraint_indicator_flags_hi = 0; |
| 67 uint16_t general_constraint_indicator_flags_lo = 0; | 68 uint16_t general_constraint_indicator_flags_lo = 0; |
| 68 uint8_t misc = 0; | 69 uint8_t misc = 0; |
| 69 RCHECK(reader->Read1(&configurationVersion) && configurationVersion == 1 && | 70 RCHECK(reader->Read1(&configurationVersion) && configurationVersion == 1 && |
| 70 reader->Read1(&profile_indication) && | 71 reader->Read1(&profile_indication) && |
| 71 reader->Read4(&general_profile_compatibility_flags) && | 72 reader->Read4(&general_profile_compatibility_flags) && |
| 72 reader->Read4(&general_constraint_indicator_flags_hi) && | 73 reader->Read4(&general_constraint_indicator_flags_hi) && |
| 73 reader->Read2(&general_constraint_indicator_flags_lo) && | 74 reader->Read2(&general_constraint_indicator_flags_lo) && |
| 74 reader->Read1(&general_level_idc) && | 75 reader->Read1(&general_level_idc) && |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // count for that first subsample. | 244 // count for that first subsample. |
| 244 RCHECK(HEVC::InsertParamSetsAnnexB(*hevc_config_, frame_buf, subsamples)); | 245 RCHECK(HEVC::InsertParamSetsAnnexB(*hevc_config_, frame_buf, subsamples)); |
| 245 } | 246 } |
| 246 | 247 |
| 247 DCHECK(HEVC::IsValidAnnexB(*frame_buf, *subsamples)); | 248 DCHECK(HEVC::IsValidAnnexB(*frame_buf, *subsamples)); |
| 248 return true; | 249 return true; |
| 249 } | 250 } |
| 250 | 251 |
| 251 } // namespace mp4 | 252 } // namespace mp4 |
| 252 } // namespace media | 253 } // namespace media |
| OLD | NEW |