Tag Parser  7.0.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 using namespace IoUtilities;
9 
10 namespace TagParser {
11 
22 void AdtsFrame::parseHeader(IoUtilities::BinaryReader &reader)
23 {
24  m_header1 = reader.readUInt16BE();
25  // check whether syncword is present
26  if ((m_header1 & 0xFFF6u) != 0xFFF0u) {
27  throw InvalidDataException();
28  }
29  m_header2 = hasCrc() ? reader.readUInt56BE() : (reader.readUInt40BE() << 16);
30  // check whether frame length is ok
31  if (totalSize() < headerSize()) {
32  throw InvalidDataException();
33  }
34 }
35 
36 } // namespace TagParser
STL namespace.
Contains utility classes helping to read and write streams.