Tag Parser: adts/adtsframe.cpp Source File

Tag Parser 12.5.3 C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags

Loading...
Searching...
No Matches
adtsframe.cpp
Go to the documentation of this file.
1#include "./adtsframe.h"
2
3#include "../exceptions.h"
4
5#include <c++utilities/io/binaryreader.h>
6
7using namespace std;
8
9namespace TagParser {
10
15
21 void AdtsFrame::parseHeader(CppUtilities::BinaryReader &reader)
22{
23 m_header1 = reader.readUInt16BE();
24 // check whether syncword is present
25 if ((m_header1 & 0xFFF6u) != 0xFFF0u) {
26 throw InvalidDataException();
27 }
28 m_header2 = hasCrc() ? reader.readUInt56BE() : (reader.readUInt40BE() << 16);
29 // check whether frame length is ok
30 if (totalSize() < headerSize()) {
31 throw InvalidDataException();
32 }
33}
34
35} // namespace TagParser
adtsframe.h
TagParser::AdtsFrame::totalSize
constexpr std::uint16_t totalSize() const
Returns the size of the frame (including the header) in bytes.
Definition adtsframe.h:103
TagParser::AdtsFrame::hasCrc
constexpr bool hasCrc() const
Returns whether a CRC-16 checksum is present ("protection absent" bit is NOT set).
Definition adtsframe.h:66
TagParser::AdtsFrame::headerSize
constexpr std::uint8_t headerSize() const
Returns the header size in bytes (9 if CRC is present; otherwise 7).
Definition adtsframe.h:111
TagParser::AdtsFrame::parseHeader
void parseHeader(CppUtilities::BinaryReader &reader)
Parses the header read using the specified reader.
Definition adtsframe.cpp:21
TagParser::InvalidDataException
The exception that is thrown when the data to be parsed or to be made seems invalid and therefore can...
Definition exceptions.h:25
exceptions.h
TagParser
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10