Tag Parser
12.5.3
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Toggle main menu visibility
Loading...
Searching...
No Matches
vorbis
vorbisidentificationheader.cpp
Go to the documentation of this file.
1
#include "
./vorbisidentificationheader.h
"
2
#include "
./vorbispackagetypes.h
"
3
4
#include "
../ogg/oggiterator.h
"
5
6
#include "
../exceptions.h
"
7
8
#include <c++utilities/conversion/binaryconversion.h>
9
10
using namespace
std;
11
using namespace
CppUtilities
;
12
13
namespace
TagParser
{
14
19
24
void
VorbisIdentificationHeader::parseHeader
(
OggIterator
&iterator)
25
{
26
char
buff[30 - 7];
27
iterator.
read
(buff, 7);
28
if
((BE::toInt<std::uint64_t>(buff) & 0xffffffffffffff00u) != 0x01766F7262697300u) {
29
throw
InvalidDataException
();
// not Vorbis identification header
30
}
31
iterator.
read
(buff,
sizeof
(buff));
32
m_version = LE::toUInt32(buff);
33
m_channels =
static_cast<
std::uint8_t
>
(*(buff + 4));
34
m_sampleRate = LE::toUInt32(buff + 5);
35
m_maxBitrate = LE::toUInt32(buff + 9);
36
m_nominalBitrate = LE::toUInt32(buff + 13);
37
m_minBitrate = LE::toUInt32(buff + 17);
38
m_blockSize =
static_cast<
std::uint8_t
>
(*(buff + 21));
39
m_framingFlag =
static_cast<
std::uint8_t
>
(*(buff + 22));
40
}
41
42
}
// namespace TagParser
TagParser::InvalidDataException::InvalidDataException
InvalidDataException() noexcept
Constructs a new exception.
Definition
exceptions.cpp:73
TagParser::OggIterator
The OggIterator class helps iterating through all segments of an Ogg bitstream.
Definition
oggiterator.h:11
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::VorbisIdentificationHeader::parseHeader
void parseHeader(OggIterator &iterator)
Parses the Vorbis identification header which is read using the specified iterator.
Definition
vorbisidentificationheader.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
vorbisidentificationheader.h
vorbispackagetypes.h
Generated on
for Tag Parser by
1.18.0