1 #ifndef TAG_PARSER_MP3FRAMEAUDIOSTREAM_H 2 #define TAG_PARSER_MP3FRAMEAUDIOSTREAM_H 4 #include "../diagnostics.h" 6 #include <c++utilities/conversion/types.h> 41 void parseHeader(IoUtilities::BinaryReader &reader,
Diagnostics &diag);
43 constexpr
bool isValid()
const;
44 double mpegVersion()
const;
46 constexpr
bool isProtectedByCrc()
const;
48 uint32 samplingFrequency()
const;
49 constexpr uint32 paddingSize()
const;
51 constexpr
bool hasCopyright()
const;
52 constexpr
bool isOriginal()
const;
53 uint32 sampleCount()
const;
55 constexpr
bool isXingHeaderAvailable()
const;
57 constexpr
bool isXingFramefieldPresent()
const;
58 constexpr
bool isXingBytesfieldPresent()
const;
59 constexpr
bool isXingTocFieldPresent()
const;
60 constexpr
bool isXingQualityIndicatorFieldPresent()
const;
61 constexpr uint32 xingFrameCount()
const;
62 constexpr uint32 xingBytesfield()
const;
63 constexpr uint32 xingQualityIndicator()
const;
66 static constexpr uint64 s_xingHeaderOffset = 0x24;
67 static constexpr uint32 s_sync = 0xFFE00000u;
68 static const uint16 s_bitrateTable[0x2][0x3][0xF];
72 uint32 m_xingFramefield;
73 uint32 m_xingBytesfield;
74 uint32 m_xingQualityIndicator;
86 , m_xingQualityIndicator(0)
95 return (m_header & s_sync) == s_sync;
103 return (m_header & 0x10000u) != 0x10000u;
112 return s_bitrateTable[
mpegVersion() == 1.0 ? 0 : 1][
layer() - 1][(m_header & 0xf000u) >> 12];
124 return (m_header & 0x60000u) == 0x60000u ? 4u : 1u * (m_header & 0x200u);
135 return (m_header & 0x8u) == 0x8u;
143 return (m_header & 0x4u) == 0x4u;
148 return static_cast<XingHeaderFlags>(
static_cast<int>(lhs) | static_cast<int>(rhs));
153 return static_cast<XingHeaderFlags>(
static_cast<int>(lhs) & static_cast<int>(rhs));
161 return ((m_xingHeader & 0x58696e6700000000uL) == 0x58696e6700000000uL) || ((m_xingHeader & 0x496e666f00000000uL) == 0x496e666f00000000uL);
169 return m_xingHeaderFlags;
209 return m_xingFramefield;
217 return m_xingBytesfield;
225 return m_xingQualityIndicator;
230 #endif // TAG_PARSER_MP3FRAMEAUDIOSTREAM_H The MpegAudioFrame class is used to parse MPEG audio frames.
MpegChannelMode
Specifies the channel mode.
double mpegVersion() const
Returns the MPEG version if known (1.0, 2.0 or 2.5); otherwise returns 0.
constexpr MpegAudioFrame()
Constructs a new frame.
constexpr uint32 paddingSize() const
Returns the padding size if known; otherwise returns 0.
constexpr XingHeaderFlags operator &(XingHeaderFlags lhs, XingHeaderFlags rhs)
constexpr bool isOriginal() const
Returns an indication whether the frame labeled as original.
constexpr bool hasCopyright() const
Returns an indication whether the frame is copyrighted.
constexpr XingHeaderFlags operator|(XingHeaderFlags lhs, XingHeaderFlags rhs)
constexpr bool isXingFramefieldPresent() const
Returns an indication whether the Xing frame field is present.
int layer() const
Returns the MPEG layer if known (1, 2, or 3); otherwise returns 0.
Contains utility classes helping to read and write streams.
constexpr bool isXingHeaderAvailable() const
Returns an indication whether a Xing header is present.
constexpr bool isXingBytesfieldPresent() const
Returns an indication whether the Xing bytes field is present.
TAG_PARSER_EXPORT const char * mpegChannelModeString(MpegChannelMode channelMode)
Returns the string representation for the specified channelMode.
constexpr bool isXingQualityIndicatorFieldPresent() const
Returns an indication whether the Xing quality indicator field is present.
constexpr XingHeaderFlags xingHeaderFlags() const
Returns the Xing header flags.
uint16 bitrate() const
Returns the bitrate of the frame if known; otherwise returns 0.
constexpr bool isValid() const
Returns an indication whether the frame is valid.
constexpr bool isXingTocFieldPresent() const
Returns an indication whether the Xing TOC is present.
constexpr bool isProtectedByCrc() const
Returns an indication whether the frame is protected by CRC.
constexpr TAG_PARSER_EXPORT const char * bitrate()
The track's bit rate in bits per second.
constexpr uint32 xingQualityIndicator() const
Returns the Xing quality indicator if known; otherwise returns 0.
Contains all classes and functions of the TagInfo library.
constexpr uint32 xingFrameCount() const
Returns an indication whether the Xing frame count is present.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
constexpr uint32 xingBytesfield() const
Returns the Xing bytes field if known; otherwise returns 0.
The Diagnostics class is a container for DiagMessage.