Fix warnings in MpegAudioFrame
This commit is contained in:
parent
54174f014a
commit
f1a3f5cbce
|
@ -28,21 +28,17 @@ const char *mpegChannelModeString(MpegChannelMode channelMode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint64 MpegAudioFrame::m_xingHeaderOffset = 0x24;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \class TagParser::MpegAudioFrame
|
* \class TagParser::MpegAudioFrame
|
||||||
* \brief The MpegAudioFrame class is used to parse MPEG audio frames.
|
* \brief The MpegAudioFrame class is used to parse MPEG audio frames.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const int MpegAudioFrame::m_bitrateTable[0x2][0x3][0xF] = { { { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
|
const uint16 MpegAudioFrame::s_bitrateTable[0x2][0x3][0xF] = { { { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
|
||||||
{ 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 },
|
{ 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 },
|
||||||
{ 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } },
|
{ 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } },
|
||||||
{ { 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 },
|
{ { 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 },
|
||||||
{ 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 } } };
|
{ 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 } } };
|
||||||
|
|
||||||
const uint32 MpegAudioFrame::m_sync = 0xFFE00000u;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Parses the header read using the specified \a reader.
|
* \brief Parses the header read using the specified \a reader.
|
||||||
* \throws Throws InvalidDataException if the data read from the stream is
|
* \throws Throws InvalidDataException if the data read from the stream is
|
||||||
|
@ -55,7 +51,7 @@ void MpegAudioFrame::parseHeader(BinaryReader &reader, Diagnostics &diag)
|
||||||
diag.emplace_back(DiagLevel::Critical, "Header is invalid.", "parsing MPEG audio frame header");
|
diag.emplace_back(DiagLevel::Critical, "Header is invalid.", "parsing MPEG audio frame header");
|
||||||
throw InvalidDataException();
|
throw InvalidDataException();
|
||||||
}
|
}
|
||||||
reader.stream()->seekg(m_xingHeaderOffset - 4, ios_base::cur);
|
reader.stream()->seekg(s_xingHeaderOffset - 4, ios_base::cur);
|
||||||
m_xingHeader = reader.readUInt64BE();
|
m_xingHeader = reader.readUInt64BE();
|
||||||
m_xingHeaderFlags = static_cast<XingHeaderFlags>(m_xingHeader & 0xffffffffuL);
|
m_xingHeaderFlags = static_cast<XingHeaderFlags>(m_xingHeader & 0xffffffffuL);
|
||||||
if (isXingHeaderAvailable()) {
|
if (isXingHeaderAvailable()) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
double mpegVersion() const;
|
double mpegVersion() const;
|
||||||
int layer() const;
|
int layer() const;
|
||||||
constexpr bool isProtectedByCrc() const;
|
constexpr bool isProtectedByCrc() const;
|
||||||
uint32 bitrate() const;
|
uint16 bitrate() const;
|
||||||
uint32 samplingFrequency() const;
|
uint32 samplingFrequency() const;
|
||||||
constexpr uint32 paddingSize() const;
|
constexpr uint32 paddingSize() const;
|
||||||
MpegChannelMode channelMode() const;
|
MpegChannelMode channelMode() const;
|
||||||
|
@ -63,9 +63,9 @@ public:
|
||||||
constexpr uint32 xingQualityIndicator() const;
|
constexpr uint32 xingQualityIndicator() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const uint64 m_xingHeaderOffset;
|
static constexpr uint64 s_xingHeaderOffset = 0x24;
|
||||||
static const int m_bitrateTable[0x2][0x3][0xF];
|
static constexpr uint32 s_sync = 0xFFE00000u;
|
||||||
static const uint32 m_sync;
|
static const uint16 s_bitrateTable[0x2][0x3][0xF];
|
||||||
uint32 m_header;
|
uint32 m_header;
|
||||||
uint64 m_xingHeader;
|
uint64 m_xingHeader;
|
||||||
XingHeaderFlags m_xingHeaderFlags;
|
XingHeaderFlags m_xingHeaderFlags;
|
||||||
|
@ -92,7 +92,7 @@ constexpr MpegAudioFrame::MpegAudioFrame()
|
||||||
*/
|
*/
|
||||||
constexpr bool MpegAudioFrame::isValid() const
|
constexpr bool MpegAudioFrame::isValid() const
|
||||||
{
|
{
|
||||||
return (m_header & m_sync) == m_sync;
|
return (m_header & s_sync) == s_sync;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -106,10 +106,10 @@ constexpr bool MpegAudioFrame::isProtectedByCrc() const
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns the bitrate of the frame if known; otherwise returns 0.
|
* \brief Returns the bitrate of the frame if known; otherwise returns 0.
|
||||||
*/
|
*/
|
||||||
inline uint32 MpegAudioFrame::bitrate() const
|
inline uint16 MpegAudioFrame::bitrate() const
|
||||||
{
|
{
|
||||||
if (mpegVersion() > 0.0 && layer() > 0) {
|
if (mpegVersion() > 0.0 && layer() > 0) {
|
||||||
return m_bitrateTable[mpegVersion() == 1.0 ? 0 : 1][layer() - 1][(m_header & 0xf000u) >> 12];
|
return s_bitrateTable[mpegVersion() == 1.0 ? 0 : 1][layer() - 1][(m_header & 0xf000u) >> 12];
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue