Tag Parser
12.3.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Loading...
Searching...
No Matches
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::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
TagParser::InvalidDataException
The exception that is thrown when the data to be parsed or to be made seems invalid and therefore can...
TagParser::OggIterator
The OggIterator class helps iterating through all segments of an Ogg bitstream.
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
TagParser::OpusIdentificationHeader::parseHeader
void parseHeader(OggIterator &iterator)
Parses the Opus identification header which is read using the specified iterator.
Definition
opusidentificationheader.cpp:24
exceptions.h
CppUtilities
Definition
abstractcontainer.h:16
TagParser
Contains all classes and functions of the TagInfo library.
Definition
aaccodebook.h:10
oggiterator.h
opusidentificationheader.h
Generated on Sun Sep 22 2024 20:12:46 for Tag Parser by
1.12.0