5#include <c++utilities/conversion/stringbuilder.h>
6#include <c++utilities/conversion/stringconversion.h>
7#include <c++utilities/io/binaryreader.h>
19 switch (channelMode) {
21 return "2 channels: stereo";
23 return "2 channels: joint stereo";
25 return "2 channels: dual channel";
27 return "1 channel: single channel";
29 return std::string_view();
38const std::uint16_t MpegAudioFrame::s_bitrateTable[0x2][0x3][0xF] = { { { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
39 { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 },
40 { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } },
41 { { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256 }, { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 },
42 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 } } };
52 m_header = reader.readUInt32BE();
55 "Frame 0x" % numberToString(m_header, 16u) %
" at 0x"
56 % numberToString<std::int64_t>(reader.stream()->tellg() -
static_cast<std::streamoff
>(4), 16)
58 "parsing MPEG audio frame header");
63 if (
size() < s_xingHeaderOffset - 4 + 8) {
66 reader.stream()->seekg(s_xingHeaderOffset - 4, ios_base::cur);
67 m_xingHeader = reader.readUInt64BE();
69 m_xingHeaderFlags =
static_cast<XingHeaderFlags>(m_xingHeader & 0xffffffffuL);
71 m_xingFramefield = reader.readUInt32BE();
74 m_xingBytesfield = reader.readUInt32BE();
77 reader.stream()->seekg(0x64, ios_base::cur);
80 m_xingQualityIndicator = reader.readUInt32BE();
90 switch (m_header & 0x180000u) {
107 switch (m_header & 0x60000u) {
124 switch (m_header & 0xc00u) {
128 switch (m_header & 0x180000u) {
138 switch (m_header & 0x180000u) {
148 switch (m_header & 0x180000u) {
167 switch (m_header & 0xc0u) {
187 switch (m_header & 0x60000u) {
193 switch (m_header & 0x180000u) {
210 switch (m_header & 0x60000u) {
212 return static_cast<std::uint32_t
>(
218 return static_cast<std::uint32_t
>(
The Diagnostics class is a container for DiagMessage.
The exception that is thrown when the data to be parsed or to be made seems invalid and therefore can...
std::uint32_t size() const
Returns the size if known; otherwise returns 0.
constexpr bool isXingQualityIndicatorFieldPresent() const
Returns an indication whether the Xing quality indicator field is present.
std::uint32_t samplingFrequency() const
Returns the sampeling frequency of the frame if known; otherwise returns 0.
MpegChannelMode channelMode() const
Returns the channel mode if known; otherwise returns MpegChannelMode::Unspecifed.
constexpr std::uint32_t paddingSize() const
Returns the padding size if known; otherwise returns 0.
std::uint32_t sampleCount() const
Returns the sample count if known; otherwise returns 0.
constexpr bool isXingTocFieldPresent() const
Returns an indication whether the Xing TOC is present.
constexpr bool isValid() const
Returns an indication whether the frame is valid.
int layer() const
Returns the MPEG layer if known (1, 2, or 3); otherwise returns 0.
std::uint16_t bitrate() const
Returns the bitrate of the frame if known; otherwise returns 0.
constexpr bool isXingBytesfieldPresent() const
Returns an indication whether the Xing bytes field is present.
void parseHeader(CppUtilities::BinaryReader &reader, Diagnostics &diag)
Parses the header read using the specified reader.
constexpr bool isXingHeaderAvailable() const
Returns an indication whether a Xing header is present.
double mpegVersion() const
Returns the MPEG version if known (1.0, 2.0 or 2.5); otherwise returns 0.
constexpr bool isXingFramefieldPresent() const
Returns an indication whether the Xing frame field is present.
Contains all classes and functions of the TagInfo library.
TAG_PARSER_EXPORT std::string_view mpegChannelModeString(MpegChannelMode channelMode)
Returns the string representation for the specified channelMode.
MpegChannelMode
Specifies the channel mode.