Tag Parser  9.2.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
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 
7 using namespace std;
8 
9 namespace TagParser {
10 
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
TagParser
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:10
adtsframe.h
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