3 #include "../diagnostics.h"
4 #include "../exceptions.h"
5 #include "../mediaformat.h"
7 #include <c++utilities/io/binaryreader.h>
25 void AvcConfiguration::parse(BinaryReader &reader, std::uint64_t maxSize,
Diagnostics &diag)
32 reader.stream()->seekg(1, ios_base::cur);
33 profileIndication = reader.readByte();
34 profileCompat = reader.readByte();
35 levelIndication = reader.readByte();
36 naluSizeLength = (reader.readByte() & 0x03) + 1;
39 std::uint8_t spsEntryCount = reader.readByte() & 0x0f;
40 std::uint8_t ignoredSpsEntries = 0;
41 spsInfos.reserve(spsEntryCount);
42 for (; spsEntryCount; --spsEntryCount) {
43 if (maxSize < SpsInfo::minSize) {
48 spsInfos.emplace_back().parse(
49 reader, maxSize > numeric_limits<std::uint32_t>::max() ? numeric_limits<std::uint32_t>::max() :
static_cast<std::uint32_t
>(maxSize));
51 if (spsInfos.back().size > (maxSize - SpsInfo::minSize)) {
58 maxSize -= spsInfos.back().size;
66 std::uint8_t ppsEntryCount = reader.readByte();
67 std::uint8_t ignoredPpsEntries = 0;
68 ppsInfos.reserve(ppsEntryCount);
69 for (; ppsEntryCount; --ppsEntryCount) {
70 if (maxSize < PpsInfo::minSize) {
75 ppsInfos.emplace_back().parse(
76 reader, maxSize > numeric_limits<std::uint32_t>::max() ? numeric_limits<std::uint32_t>::max() :
static_cast<std::uint32_t
>(maxSize));
78 if (ppsInfos.back().size > (maxSize - PpsInfo::minSize)) {
85 maxSize -= ppsInfos.back().size;
93 if (ignoredSpsEntries || ignoredPpsEntries) {
94 diag.emplace_back(DiagLevel::Debug,
96 "Ignored ", ignoredSpsEntries,
" SPS entries and ", ignoredPpsEntries,
" PPS entries. This AVC config is likely just not supported."),
97 "parsing AVC config");
The Diagnostics class is a container for DiagMessage.
The class inherits from std::exception and serves as base class for exceptions thrown by the elements...
The exception that is thrown when the data to be parsed is truncated and therefore can not be parsed ...
Contains all classes and functions of the TagInfo library.