7 #include "packager/media/filters/avc_decoder_configuration.h"
9 #include "packager/base/stl_util.h"
10 #include "packager/base/strings/string_number_conversions.h"
11 #include "packager/base/strings/string_util.h"
12 #include "packager/media/base/buffer_reader.h"
13 #include "packager/media/filters/h264_parser.h"
14 #include "packager/media/formats/mp4/rcheck.h"
16 namespace edash_packager {
19 AVCDecoderConfiguration::AVCDecoderConfiguration()
21 profile_indication_(0),
22 profile_compatibility_(0),
26 AVCDecoderConfiguration::~AVCDecoderConfiguration() {}
29 BufferReader reader(vector_as_array(&data), data.size());
30 RCHECK(reader.Read1(&version_) && version_ == 1 &&
31 reader.Read1(&profile_indication_) &&
32 reader.Read1(&profile_compatibility_) && reader.Read1(&avc_level_));
34 uint8_t length_size_minus_one;
35 RCHECK(reader.Read1(&length_size_minus_one));
36 length_size_ = (length_size_minus_one & 0x3) + 1;
39 RCHECK(reader.Read1(&num_sps));
42 LOG(ERROR) <<
"No SPS found.";
46 uint16_t sps_length = 0;
47 RCHECK(reader.Read2(&sps_length));
52 RCHECK(nalu.InitializeFromH264(reader.data() + reader.pos(), sps_length, 0));
53 RCHECK(parser.ParseSPS(nalu, &sps_id) == H264Parser::kOk);
54 return ExtractResolutionFromSps(*parser.GetSPS(sps_id), &coded_width_,
55 &coded_height_, &pixel_width_,
68 uint8_t profile_indication,
69 uint8_t profile_compatibility,
71 const uint8_t bytes[] = {profile_indication, profile_compatibility,
74 base::StringToLowerASCII(base::HexEncode(bytes, arraysize(bytes)));