Tag Parser 12.3.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Loading...
Searching...
No Matches
opusidentificationheader.cpp
Go to the documentation of this file.
2
4
5#include "../exceptions.h"
6
7#include <c++utilities/conversion/binaryconversion.h>
8
9using namespace std;
10using namespace CppUtilities;
11
12namespace TagParser {
13
25{
26 char buff[19 - 8];
27 iterator.read(buff, 8);
28 if (BE::toInt<std::uint64_t>(buff) != 0x4F70757348656164u) {
29 throw InvalidDataException(); // not Opus identification header
30 }
31 iterator.read(buff, sizeof(buff));
32 m_version = static_cast<std::uint8_t>(*(buff));
33 m_channels = static_cast<std::uint8_t>(*(buff + 1));
34 m_preSkip = LE::toInt<std::uint16_t>(buff + 2);
35 m_sampleRate = LE::toUInt32(buff + 4);
36 m_outputGain = LE::toInt<std::uint16_t>(buff + 8);
37 m_channelMap = static_cast<std::uint8_t>(*(buff + 10));
38}
39
40} // namespace TagParser
The exception that is thrown when the data to be parsed or to be made seems invalid and therefore can...
The OggIterator class helps iterating through all segments of an Ogg bitstream.
void read(char *buffer, std::size_t count)
Reads count bytes from the Ogg stream and writes it to the specified buffer.
void parseHeader(OggIterator &iterator)
Parses the Opus identification header which is read using the specified iterator.
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10