Tag Parser 12.1.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Loading...
Searching...
No Matches
vorbisidentificationheader.cpp
Go to the documentation of this file.
3
4#include "../ogg/oggiterator.h"
5
6#include "../exceptions.h"
7
8#include <c++utilities/conversion/binaryconversion.h>
9
10using namespace std;
11using namespace CppUtilities;
12
13namespace TagParser {
14
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
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 Vorbis identification header which is read using the specified iterator.
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10