3 #include "../diagnostics.h"
4 #include "../exceptions.h"
5 #include "../mediaformat.h"
7 #include <c++utilities/io/binaryreader.h>
26 void AvcConfiguration::parse(BinaryReader &reader, std::uint64_t maxSize,
Diagnostics &diag)
28 CPP_UTILITIES_UNUSED(diag)
34 reader.stream()->seekg(1, ios_base::cur);
35 profileIndication = reader.readByte();
36 profileCompat = reader.readByte();
37 levelIndication = reader.readByte();
38 naluSizeLength = (reader.readByte() & 0x03) + 1;
41 std::uint8_t entryCount = reader.readByte() & 0x0f;
42 spsInfos.reserve(entryCount);
43 for (; entryCount; --entryCount) {
47 spsInfos.emplace_back();
49 spsInfos.back().parse(
50 reader, maxSize > numeric_limits<std::uint32_t>::max() ? numeric_limits<std::uint32_t>::max() : static_cast<std::uint32_t>(maxSize));
52 if (spsInfos.back().size > maxSize - 2) {
60 maxSize -= spsInfos.back().size;
64 entryCount = reader.readByte();
65 ppsInfos.reserve(entryCount);
66 for (; entryCount; --entryCount) {
70 ppsInfos.emplace_back();
72 ppsInfos.back().parse(
73 reader, maxSize > numeric_limits<std::uint32_t>::max() ? numeric_limits<std::uint32_t>::max() : static_cast<std::uint32_t>(maxSize));
75 if (ppsInfos.back().size > maxSize - 2) {
83 maxSize -= ppsInfos.back().size;