7 #include "packager/media/filters/avc_decoder_configuration.h"
9 #include "packager/base/strings/string_number_conversions.h"
10 #include "packager/base/strings/string_util.h"
11 #include "packager/media/base/buffer_reader.h"
12 #include "packager/media/filters/h264_parser.h"
13 #include "packager/media/formats/mp4/rcheck.h"
15 namespace edash_packager {
18 AVCDecoderConfiguration::AVCDecoderConfiguration()
20 profile_indication_(0),
21 profile_compatibility_(0),
25 AVCDecoderConfiguration::~AVCDecoderConfiguration() {}
29 RCHECK(reader.Read1(&version_) && version_ == 1 &&
30 reader.Read1(&profile_indication_) &&
31 reader.Read1(&profile_compatibility_) && reader.Read1(&avc_level_));
33 uint8_t length_size_minus_one;
34 RCHECK(reader.Read1(&length_size_minus_one));
35 length_size_ = (length_size_minus_one & 0x3) + 1;
38 RCHECK(reader.Read1(&num_sps));
41 LOG(ERROR) <<
"No SPS found.";
45 uint16_t sps_length = 0;
46 RCHECK(reader.Read2(&sps_length));
51 RCHECK(nalu.InitializeFromH264(reader.data() + reader.pos(), sps_length));
52 RCHECK(parser.ParseSPS(nalu, &sps_id) == H264Parser::kOk);
53 return ExtractResolutionFromSps(*parser.GetSPS(sps_id), &coded_width_,
54 &coded_height_, &pixel_width_,
67 uint8_t profile_indication,
68 uint8_t profile_compatibility,
70 const uint8_t bytes[] = {profile_indication, profile_compatibility,
73 base::StringToLowerASCII(base::HexEncode(bytes, arraysize(bytes)));