Tag Parser
9.1.3
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
opus
opusidentificationheader.cpp
Go to the documentation of this file.
1
#include "
./opusidentificationheader.h
"
2
3
#include "../ogg/oggiterator.h"
4
5
#include "../exceptions.h"
6
7
#include <c++utilities/conversion/binaryconversion.h>
8
9
using namespace
std;
10
using namespace
CppUtilities
;
11
12
namespace
TagParser
{
13
24
void
OpusIdentificationHeader::parseHeader(
OggIterator
&iterator)
25
{
26
char
buff[19 - 8];
27
iterator.
read
(buff, 8);
28
if
(BE::toUInt64(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::toUInt16(buff + 2);
35
m_sampleRate = LE::toUInt32(buff + 4);
36
m_outputGain = LE::toUInt16(buff + 8);
37
m_channelMap =
static_cast<
std::uint8_t
>
(*(buff + 10));
38
}
39
40
}
// namespace TagParser
TagParser::OggIterator
The OggIterator class helps iterating through all segments of an OGG bitstream.
Definition:
oggiterator.h:11
TagParser
Contains all classes and functions of the TagInfo library.
Definition:
aaccodebook.h:10
opusidentificationheader.h
CppUtilities
Definition:
abstractcontainer.h:15
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
TagParser::OggIterator::read
void read(char *buffer, std::size_t count)
Reads count bytes from the OGG stream and writes it to the specified buffer.
Definition:
oggiterator.cpp:134
Generated on Tue Apr 7 2020 09:55:40 for Tag Parser by
1.8.17