Tag Parser 12.1.0
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
3#include "../ogg/oggiterator.h"
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...
Definition exceptions.h:25
The OggIterator class helps iterating through all segments of an OGG bitstream.
Definition oggiterator.h:11
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