Use constexpr where possible

This commit is contained in:
Martchus 2018-07-10 14:11:11 +02:00
parent 1a97d91b27
commit 9361e0bc13
19 changed files with 349 additions and 345 deletions

View File

@ -13,22 +13,22 @@ namespace TagParser {
class TAG_PARSER_EXPORT AdtsFrame { class TAG_PARSER_EXPORT AdtsFrame {
public: public:
AdtsFrame(); constexpr AdtsFrame();
void parseHeader(IoUtilities::BinaryReader &reader); void parseHeader(IoUtilities::BinaryReader &reader);
bool isValid() const; constexpr bool isValid() const;
bool isMpeg4() const; constexpr bool isMpeg4() const;
bool hasCrc() const; constexpr bool hasCrc() const;
byte mpeg4AudioObjectId() const; constexpr byte mpeg4AudioObjectId() const;
byte mpeg4SamplingFrequencyIndex() const; constexpr byte mpeg4SamplingFrequencyIndex() const;
byte mpeg4ChannelConfig() const; constexpr byte mpeg4ChannelConfig() const;
uint16 totalSize() const; constexpr uint16 totalSize() const;
byte headerSize() const; constexpr byte headerSize() const;
uint16 dataSize() const; constexpr uint16 dataSize() const;
uint16 bufferFullness() const; constexpr uint16 bufferFullness() const;
byte frameCount() const; constexpr byte frameCount() const;
uint16 crc() const; constexpr uint16 crc() const;
private: private:
uint16 m_header1; uint16 m_header1;
@ -38,15 +38,16 @@ private:
/*! /*!
* \brief Constructs a new frame. * \brief Constructs a new frame.
*/ */
inline AdtsFrame::AdtsFrame() constexpr AdtsFrame::AdtsFrame()
: m_header1(0) : m_header1(0)
, m_header2(0)
{ {
} }
/*! /*!
* \brief Returns an indication whether the frame is valid. * \brief Returns an indication whether the frame is valid.
*/ */
inline bool AdtsFrame::isValid() const constexpr bool AdtsFrame::isValid() const
{ {
return ((m_header1 & 0xFFF6u) == 0xFFF0u) && (totalSize() >= headerSize()); return ((m_header1 & 0xFFF6u) == 0xFFF0u) && (totalSize() >= headerSize());
} }
@ -54,7 +55,7 @@ inline bool AdtsFrame::isValid() const
/*! /*!
* \brief Returns whether the MPEG version is MPEG-4; otherwise the MPEG version is MPEG-2. * \brief Returns whether the MPEG version is MPEG-4; otherwise the MPEG version is MPEG-2.
*/ */
inline bool AdtsFrame::isMpeg4() const constexpr bool AdtsFrame::isMpeg4() const
{ {
return m_header1 & 0x8u; return m_header1 & 0x8u;
} }
@ -62,7 +63,7 @@ inline bool AdtsFrame::isMpeg4() const
/*! /*!
* \brief Returns whether a CRC-16 checksum is present ("protection absent" bit is NOT set). * \brief Returns whether a CRC-16 checksum is present ("protection absent" bit is NOT set).
*/ */
inline bool AdtsFrame::hasCrc() const constexpr bool AdtsFrame::hasCrc() const
{ {
return (m_header1 & 0x1u) == 0; return (m_header1 & 0x1u) == 0;
} }
@ -72,7 +73,7 @@ inline bool AdtsFrame::hasCrc() const
* \sa TagParser::Mpeg4AudioObjectIds * \sa TagParser::Mpeg4AudioObjectIds
* \sa Mpeg4AudioObjectIds::idToMediaFormat() * \sa Mpeg4AudioObjectIds::idToMediaFormat()
*/ */
inline byte AdtsFrame::mpeg4AudioObjectId() const constexpr byte AdtsFrame::mpeg4AudioObjectId() const
{ {
return (m_header2 >> 0x36) + 0x1u; return (m_header2 >> 0x36) + 0x1u;
} }
@ -81,7 +82,7 @@ inline byte AdtsFrame::mpeg4AudioObjectId() const
* \brief Returns the MPEG-4 sample rate index. * \brief Returns the MPEG-4 sample rate index.
* \sa TagParser::mpeg4SampleRateTable * \sa TagParser::mpeg4SampleRateTable
*/ */
inline byte AdtsFrame::mpeg4SamplingFrequencyIndex() const constexpr byte AdtsFrame::mpeg4SamplingFrequencyIndex() const
{ {
return (m_header2 >> 0x32) & 0xFu; return (m_header2 >> 0x32) & 0xFu;
} }
@ -91,7 +92,7 @@ inline byte AdtsFrame::mpeg4SamplingFrequencyIndex() const
* \sa TagParser::Mpeg4ChannelConfigs * \sa TagParser::Mpeg4ChannelConfigs
* \sa TagParser::mpeg4SampleRateTable::channelConfigString() * \sa TagParser::mpeg4SampleRateTable::channelConfigString()
*/ */
inline byte AdtsFrame::mpeg4ChannelConfig() const constexpr byte AdtsFrame::mpeg4ChannelConfig() const
{ {
return (m_header2 >> 0x2E) & 0x7u; return (m_header2 >> 0x2E) & 0x7u;
} }
@ -99,7 +100,7 @@ inline byte AdtsFrame::mpeg4ChannelConfig() const
/*! /*!
* \brief Returns the size of the frame (including the header) in bytes. * \brief Returns the size of the frame (including the header) in bytes.
*/ */
inline uint16 AdtsFrame::totalSize() const constexpr uint16 AdtsFrame::totalSize() const
{ {
return (m_header2 >> 0x1D) & 0x1FFFu; return (m_header2 >> 0x1D) & 0x1FFFu;
} }
@ -107,7 +108,7 @@ inline uint16 AdtsFrame::totalSize() const
/*! /*!
* \brief Retruns the header size in bytes (9 if CRC is present; otherwise 7). * \brief Retruns the header size in bytes (9 if CRC is present; otherwise 7).
*/ */
inline byte AdtsFrame::headerSize() const constexpr byte AdtsFrame::headerSize() const
{ {
return hasCrc() ? 9 : 7; return hasCrc() ? 9 : 7;
} }
@ -115,7 +116,7 @@ inline byte AdtsFrame::headerSize() const
/*! /*!
* \brief Returns the data size (total size minus header size) in bytes. * \brief Returns the data size (total size minus header size) in bytes.
*/ */
inline uint16 AdtsFrame::dataSize() const constexpr uint16 AdtsFrame::dataSize() const
{ {
return totalSize() - headerSize(); return totalSize() - headerSize();
} }
@ -123,7 +124,7 @@ inline uint16 AdtsFrame::dataSize() const
/*! /*!
* \brief Returns the buffer fullness. * \brief Returns the buffer fullness.
*/ */
inline uint16 AdtsFrame::bufferFullness() const constexpr uint16 AdtsFrame::bufferFullness() const
{ {
return (m_header2 >> 0x12) & 0x7FFu; return (m_header2 >> 0x12) & 0x7FFu;
} }
@ -131,7 +132,7 @@ inline uint16 AdtsFrame::bufferFullness() const
/*! /*!
* \brief Returns the number of AAC frames (RDBs) in the ADTS frame. * \brief Returns the number of AAC frames (RDBs) in the ADTS frame.
*/ */
inline byte AdtsFrame::frameCount() const constexpr byte AdtsFrame::frameCount() const
{ {
return ((m_header2 >> 0x10) & 0x3u) + 0x1u; return ((m_header2 >> 0x10) & 0x3u) + 0x1u;
} }
@ -140,7 +141,7 @@ inline byte AdtsFrame::frameCount() const
* \brief Returns the CRC-16 checksum of the frame. * \brief Returns the CRC-16 checksum of the frame.
* \sa hasCrc() * \sa hasCrc()
*/ */
inline uint16 AdtsFrame::crc() const constexpr uint16 AdtsFrame::crc() const
{ {
return m_header2 & 0xFFFFu; return m_header2 & 0xFFFFu;
} }

View File

@ -23,15 +23,15 @@ typedef uint32 ugolomb;
typedef int32 sgolomb; typedef int32 sgolomb;
struct TAG_PARSER_EXPORT TimingInfo { struct TAG_PARSER_EXPORT TimingInfo {
TimingInfo(); constexpr TimingInfo();
uint32 unitsInTick; uint32 unitsInTick;
uint32 timeScale; uint32 timeScale;
byte isPresent; byte isPresent;
byte fixedFrameRate; byte fixedFrameRate;
int64 defaultDuration() const; constexpr int64 defaultDuration() const;
}; };
inline TimingInfo::TimingInfo() constexpr TimingInfo::TimingInfo()
: unitsInTick(0) : unitsInTick(0)
, timeScale(0) , timeScale(0)
, isPresent(0) , isPresent(0)
@ -39,13 +39,13 @@ inline TimingInfo::TimingInfo()
{ {
} }
inline int64 TimingInfo::defaultDuration() const constexpr int64 TimingInfo::defaultDuration() const
{ {
return 1000000000ll * unitsInTick / timeScale; return 1000000000ll * unitsInTick / timeScale;
} }
struct TAG_PARSER_EXPORT HrdParameters { struct TAG_PARSER_EXPORT HrdParameters {
HrdParameters(); constexpr HrdParameters();
ugolomb cpbCount; ugolomb cpbCount;
byte bitRateScale; byte bitRateScale;
byte cpbSizeScale; byte cpbSizeScale;
@ -57,7 +57,7 @@ struct TAG_PARSER_EXPORT HrdParameters {
void parse(IoUtilities::BitReader &reader); void parse(IoUtilities::BitReader &reader);
}; };
inline HrdParameters::HrdParameters() constexpr HrdParameters::HrdParameters()
: cpbCount(0) : cpbCount(0)
, bitRateScale(0) , bitRateScale(0)
, cpbSizeScale(0) , cpbSizeScale(0)
@ -69,7 +69,7 @@ inline HrdParameters::HrdParameters()
} }
struct TAG_PARSER_EXPORT SpsInfo { struct TAG_PARSER_EXPORT SpsInfo {
SpsInfo(); constexpr SpsInfo();
ugolomb id; ugolomb id;
byte profileIndication; byte profileIndication;
byte profileConstraints; byte profileConstraints;
@ -97,7 +97,7 @@ struct TAG_PARSER_EXPORT SpsInfo {
void parse(IoUtilities::BinaryReader &reader, uint32 maxSize); void parse(IoUtilities::BinaryReader &reader, uint32 maxSize);
}; };
inline SpsInfo::SpsInfo() constexpr SpsInfo::SpsInfo()
: id(0) : id(0)
, profileIndication(0) , profileIndication(0)
, profileConstraints(0) , profileConstraints(0)
@ -119,7 +119,7 @@ inline SpsInfo::SpsInfo()
} }
struct TAG_PARSER_EXPORT PpsInfo { struct TAG_PARSER_EXPORT PpsInfo {
PpsInfo(); constexpr PpsInfo();
ugolomb id; ugolomb id;
ugolomb spsId; ugolomb spsId;
byte picOrderPresent; byte picOrderPresent;
@ -128,7 +128,7 @@ struct TAG_PARSER_EXPORT PpsInfo {
void parse(IoUtilities::BinaryReader &reader, uint32 maxSize); void parse(IoUtilities::BinaryReader &reader, uint32 maxSize);
}; };
inline PpsInfo::PpsInfo() constexpr PpsInfo::PpsInfo()
: id(0) : id(0)
, spsId(0) , spsId(0)
, picOrderPresent(false) , picOrderPresent(false)
@ -137,7 +137,7 @@ inline PpsInfo::PpsInfo()
} }
struct TAG_PARSER_EXPORT SliceInfo { struct TAG_PARSER_EXPORT SliceInfo {
SliceInfo(); constexpr SliceInfo();
byte naluType; byte naluType;
byte naluRefIdc; byte naluRefIdc;
byte type; byte type;
@ -154,7 +154,7 @@ struct TAG_PARSER_EXPORT SliceInfo {
uint32 pps; uint32 pps;
}; };
inline SliceInfo::SliceInfo() constexpr SliceInfo::SliceInfo()
: naluType(0) : naluType(0)
, naluRefIdc(0) , naluRefIdc(0)
, type(0) , type(0)
@ -173,27 +173,27 @@ inline SliceInfo::SliceInfo()
} }
struct TAG_PARSER_EXPORT AvcFrame { struct TAG_PARSER_EXPORT AvcFrame {
AvcFrame(); constexpr AvcFrame();
uint64 start; uint64 start;
uint64 end; uint64 end;
uint64 ref1; uint64 ref1;
uint64 ref2; uint64 ref2;
bool keyframe;
bool hasProvidedTimecode;
SliceInfo sliceInfo; SliceInfo sliceInfo;
uint32 presentationOrder; uint32 presentationOrder;
uint32 decodeOrder; uint32 decodeOrder;
bool keyframe;
bool hasProvidedTimecode;
}; };
inline AvcFrame::AvcFrame() constexpr AvcFrame::AvcFrame()
: start(0) : start(0)
, end(0) , end(0)
, ref1(0) , ref1(0)
, ref2(0) , ref2(0)
, keyframe(false)
, hasProvidedTimecode(false)
, presentationOrder(0) , presentationOrder(0)
, decodeOrder(0) , decodeOrder(0)
, keyframe(false)
, hasProvidedTimecode(false)
{ {
} }

View File

@ -30,7 +30,7 @@ TAG_PARSER_EXPORT const char *diagLevelName(DiagLevel diagLevel);
/*! /*!
* \brief Sets \a lhs to \a rhs if \a rhs is more critical than \a lhs and returns \a lhs. * \brief Sets \a lhs to \a rhs if \a rhs is more critical than \a lhs and returns \a lhs.
*/ */
inline DiagLevel &operator|=(DiagLevel &lhs, const DiagLevel &rhs) constexpr DiagLevel &operator|=(DiagLevel &lhs, const DiagLevel &rhs)
{ {
if (lhs < rhs) { if (lhs < rhs) {
lhs = rhs; lhs = rhs;

View File

@ -28,16 +28,16 @@ constexpr bool operator!=(byte lhs, FlacMetaDataBlockType type)
class TAG_PARSER_EXPORT FlacMetaDataBlockHeader { class TAG_PARSER_EXPORT FlacMetaDataBlockHeader {
public: public:
FlacMetaDataBlockHeader(); constexpr FlacMetaDataBlockHeader();
void parseHeader(const char *buffer); void parseHeader(const char *buffer);
void makeHeader(std::ostream &outputStream); void makeHeader(std::ostream &outputStream);
byte isLast() const; constexpr byte isLast() const;
void setLast(byte last); void setLast(byte last);
byte type() const; constexpr byte type() const;
void setType(FlacMetaDataBlockType type); void setType(FlacMetaDataBlockType type);
uint32 dataSize() const; constexpr uint32 dataSize() const;
void setDataSize(uint32 dataSize); void setDataSize(uint32 dataSize);
private: private:
@ -49,7 +49,7 @@ private:
/*! /*!
* \brief Constructs a new FLAC "METADATA_BLOCK_HEADER". * \brief Constructs a new FLAC "METADATA_BLOCK_HEADER".
*/ */
inline FlacMetaDataBlockHeader::FlacMetaDataBlockHeader() constexpr FlacMetaDataBlockHeader::FlacMetaDataBlockHeader()
: m_last(0) : m_last(0)
, m_type(0) , m_type(0)
, m_dataSize(0) , m_dataSize(0)
@ -60,7 +60,7 @@ inline FlacMetaDataBlockHeader::FlacMetaDataBlockHeader()
* \brief Returns whether this is the last metadata block before the audio blocks. * \brief Returns whether this is the last metadata block before the audio blocks.
* \remarks The default value is 0/false. * \remarks The default value is 0/false.
*/ */
inline byte FlacMetaDataBlockHeader::isLast() const constexpr byte FlacMetaDataBlockHeader::isLast() const
{ {
return m_last; return m_last;
} }
@ -77,7 +77,7 @@ inline void FlacMetaDataBlockHeader::setLast(byte last)
* \brief Returns the block type. * \brief Returns the block type.
* \sa FlacMetaDataBlockType * \sa FlacMetaDataBlockType
*/ */
inline byte FlacMetaDataBlockHeader::type() const constexpr byte FlacMetaDataBlockHeader::type() const
{ {
return m_type; return m_type;
} }
@ -93,7 +93,7 @@ inline void FlacMetaDataBlockHeader::setType(FlacMetaDataBlockType type)
/*! /*!
* \brief Returns the length in bytes of the meta data (excluding the size of the header itself). * \brief Returns the length in bytes of the meta data (excluding the size of the header itself).
*/ */
inline uint32 FlacMetaDataBlockHeader::dataSize() const constexpr uint32 FlacMetaDataBlockHeader::dataSize() const
{ {
return m_dataSize; return m_dataSize;
} }
@ -109,19 +109,19 @@ inline void FlacMetaDataBlockHeader::setDataSize(uint32 dataSize)
class TAG_PARSER_EXPORT FlacMetaDataBlockStreamInfo { class TAG_PARSER_EXPORT FlacMetaDataBlockStreamInfo {
public: public:
FlacMetaDataBlockStreamInfo(); constexpr FlacMetaDataBlockStreamInfo();
void parse(const char *buffer); void parse(const char *buffer);
uint16 minBlockSize() const; constexpr uint16 minBlockSize() const;
uint16 maxBlockSize() const; constexpr uint16 maxBlockSize() const;
uint32 minFrameSize() const; constexpr uint32 minFrameSize() const;
uint32 maxFrameSize() const; constexpr uint32 maxFrameSize() const;
uint32 samplingFrequency() const; constexpr uint32 samplingFrequency() const;
byte channelCount() const; constexpr byte channelCount() const;
byte bitsPerSample() const; constexpr byte bitsPerSample() const;
uint64 totalSampleCount() const; constexpr uint64 totalSampleCount() const;
const char *md5Sum() const; constexpr const char *md5Sum() const;
private: private:
uint16 m_minBlockSize; uint16 m_minBlockSize;
@ -138,7 +138,7 @@ private:
/*! /*!
* \brief Constructs a new FLAC "METADATA_BLOCK_STREAMINFO". * \brief Constructs a new FLAC "METADATA_BLOCK_STREAMINFO".
*/ */
inline FlacMetaDataBlockStreamInfo::FlacMetaDataBlockStreamInfo() constexpr FlacMetaDataBlockStreamInfo::FlacMetaDataBlockStreamInfo()
: m_minBlockSize(0) : m_minBlockSize(0)
, m_maxBlockSize(0) , m_maxBlockSize(0)
, m_minFrameSize(0) , m_minFrameSize(0)
@ -154,7 +154,7 @@ inline FlacMetaDataBlockStreamInfo::FlacMetaDataBlockStreamInfo()
/*! /*!
* \brief Returns the minimum block size (in samples) used in the stream. * \brief Returns the minimum block size (in samples) used in the stream.
*/ */
inline uint16 FlacMetaDataBlockStreamInfo::minBlockSize() const constexpr uint16 FlacMetaDataBlockStreamInfo::minBlockSize() const
{ {
return m_minBlockSize; return m_minBlockSize;
} }
@ -164,7 +164,7 @@ inline uint16 FlacMetaDataBlockStreamInfo::minBlockSize() const
* *
* (Minimum blocksize == maximum blocksize) implies a fixed-blocksize stream. * (Minimum blocksize == maximum blocksize) implies a fixed-blocksize stream.
*/ */
inline uint16 FlacMetaDataBlockStreamInfo::maxBlockSize() const constexpr uint16 FlacMetaDataBlockStreamInfo::maxBlockSize() const
{ {
return m_maxBlockSize; return m_maxBlockSize;
} }
@ -174,7 +174,7 @@ inline uint16 FlacMetaDataBlockStreamInfo::maxBlockSize() const
* *
* May be 0 to imply the value is not known. * May be 0 to imply the value is not known.
*/ */
inline uint32 FlacMetaDataBlockStreamInfo::minFrameSize() const constexpr uint32 FlacMetaDataBlockStreamInfo::minFrameSize() const
{ {
return m_minFrameSize; return m_minFrameSize;
} }
@ -184,7 +184,7 @@ inline uint32 FlacMetaDataBlockStreamInfo::minFrameSize() const
* *
* May be 0 to imply the value is not known. * May be 0 to imply the value is not known.
*/ */
inline uint32 FlacMetaDataBlockStreamInfo::maxFrameSize() const constexpr uint32 FlacMetaDataBlockStreamInfo::maxFrameSize() const
{ {
return m_maxFrameSize; return m_maxFrameSize;
} }
@ -195,7 +195,7 @@ inline uint32 FlacMetaDataBlockStreamInfo::maxFrameSize() const
* Though 20 bits are available, the maximum sample rate is limited by the * Though 20 bits are available, the maximum sample rate is limited by the
* structure of frame headers to 655350Hz. Also, a value of 0 is invalid. * structure of frame headers to 655350Hz. Also, a value of 0 is invalid.
*/ */
inline uint32 FlacMetaDataBlockStreamInfo::samplingFrequency() const constexpr uint32 FlacMetaDataBlockStreamInfo::samplingFrequency() const
{ {
return m_samplingFrequency; return m_samplingFrequency;
} }
@ -205,7 +205,7 @@ inline uint32 FlacMetaDataBlockStreamInfo::samplingFrequency() const
* *
* FLAC supports from 1 to 8 channels . * FLAC supports from 1 to 8 channels .
*/ */
inline byte FlacMetaDataBlockStreamInfo::channelCount() const constexpr byte FlacMetaDataBlockStreamInfo::channelCount() const
{ {
return m_channelCount; return m_channelCount;
} }
@ -217,7 +217,7 @@ inline byte FlacMetaDataBlockStreamInfo::channelCount() const
* Currently the reference encoder and decoders only support up * Currently the reference encoder and decoders only support up
* to 24 bits per sample. * to 24 bits per sample.
*/ */
inline byte FlacMetaDataBlockStreamInfo::bitsPerSample() const constexpr byte FlacMetaDataBlockStreamInfo::bitsPerSample() const
{ {
return m_bitsPerSample; return m_bitsPerSample;
} }
@ -230,7 +230,7 @@ inline byte FlacMetaDataBlockStreamInfo::bitsPerSample() const
* *
* A value of zero here means the number of total samples is unknown. * A value of zero here means the number of total samples is unknown.
*/ */
inline uint64 FlacMetaDataBlockStreamInfo::totalSampleCount() const constexpr uint64 FlacMetaDataBlockStreamInfo::totalSampleCount() const
{ {
return m_totalSampleCount; return m_totalSampleCount;
} }
@ -241,7 +241,7 @@ inline uint64 FlacMetaDataBlockStreamInfo::totalSampleCount() const
* This allows the decoder to determine if an error exists in the * This allows the decoder to determine if an error exists in the
* audio data even when the error does not result in an invalid bitstream. * audio data even when the error does not result in an invalid bitstream.
*/ */
inline const char *FlacMetaDataBlockStreamInfo::md5Sum() const constexpr const char *FlacMetaDataBlockStreamInfo::md5Sum() const
{ {
return m_md5Sum; return m_md5Sum;
} }

View File

@ -9,14 +9,14 @@ class OggIterator;
class TAG_PARSER_EXPORT FlacToOggMappingHeader { class TAG_PARSER_EXPORT FlacToOggMappingHeader {
public: public:
FlacToOggMappingHeader(); constexpr FlacToOggMappingHeader();
void parseHeader(OggIterator &iterator); void parseHeader(OggIterator &iterator);
byte majorVersion() const; constexpr byte majorVersion() const;
byte minorVersion() const; constexpr byte minorVersion() const;
uint16 headerCount() const; constexpr uint16 headerCount() const;
const FlacMetaDataBlockStreamInfo &streamInfo() const; constexpr const FlacMetaDataBlockStreamInfo &streamInfo() const;
private: private:
byte m_majorVersion; byte m_majorVersion;
@ -28,7 +28,7 @@ private:
/*! /*!
* \brief Constructs a new FLAC identification header. * \brief Constructs a new FLAC identification header.
*/ */
inline FlacToOggMappingHeader::FlacToOggMappingHeader() constexpr FlacToOggMappingHeader::FlacToOggMappingHeader()
: m_majorVersion(0) : m_majorVersion(0)
, m_minorVersion(0) , m_minorVersion(0)
, m_headerCount(0) , m_headerCount(0)
@ -38,7 +38,7 @@ inline FlacToOggMappingHeader::FlacToOggMappingHeader()
/*! /*!
* \brief Returns the major version for the mapping (which should be 1 currently). * \brief Returns the major version for the mapping (which should be 1 currently).
*/ */
inline byte FlacToOggMappingHeader::majorVersion() const constexpr byte FlacToOggMappingHeader::majorVersion() const
{ {
return m_majorVersion; return m_majorVersion;
} }
@ -46,7 +46,7 @@ inline byte FlacToOggMappingHeader::majorVersion() const
/*! /*!
* \brief Returns the version for the mapping (which should be 0 currently). * \brief Returns the version for the mapping (which should be 0 currently).
*/ */
inline byte FlacToOggMappingHeader::minorVersion() const constexpr byte FlacToOggMappingHeader::minorVersion() const
{ {
return m_minorVersion; return m_minorVersion;
} }
@ -54,7 +54,7 @@ inline byte FlacToOggMappingHeader::minorVersion() const
/*! /*!
* \brief Returns the number of header (non-audio) packets, not including this one. * \brief Returns the number of header (non-audio) packets, not including this one.
*/ */
inline uint16 FlacToOggMappingHeader::headerCount() const constexpr uint16 FlacToOggMappingHeader::headerCount() const
{ {
return m_headerCount; return m_headerCount;
} }
@ -62,7 +62,7 @@ inline uint16 FlacToOggMappingHeader::headerCount() const
/*! /*!
* \brief Returns the stream info. * \brief Returns the stream info.
*/ */
inline const FlacMetaDataBlockStreamInfo &FlacToOggMappingHeader::streamInfo() const constexpr const FlacMetaDataBlockStreamInfo &FlacToOggMappingHeader::streamInfo() const
{ {
return m_streamInfo; return m_streamInfo;
} }

View File

@ -11,7 +11,7 @@ namespace TagParser {
class TAG_PARSER_EXPORT Id3Genres { class TAG_PARSER_EXPORT Id3Genres {
public: public:
static const char *stringFromIndex(int index); static inline const char *stringFromIndex(int index);
static int indexFromString(const std::string &genre); static int indexFromString(const std::string &genre);
static constexpr int genreCount(); static constexpr int genreCount();
static constexpr bool isIndexSupported(int index); static constexpr bool isIndexSupported(int index);

View File

@ -66,7 +66,7 @@ uint32 convertToLongId(uint32 id);
/*! /*!
* \brief Returns an indication whether the specified \a id is a long frame id. * \brief Returns an indication whether the specified \a id is a long frame id.
*/ */
inline bool isLongId(uint32 id) constexpr bool isLongId(uint32 id)
{ {
return (id & 0x00ffffff) != id; return (id & 0x00ffffff) != id;
} }
@ -74,7 +74,7 @@ inline bool isLongId(uint32 id)
/*! /*!
* \brief Returns an indication whether the specified \a id is a short frame id. * \brief Returns an indication whether the specified \a id is a short frame id.
*/ */
inline bool isShortId(uint32 id) constexpr bool isShortId(uint32 id)
{ {
return (id & 0x00ffffff) == id; return (id & 0x00ffffff) == id;
} }
@ -82,7 +82,7 @@ inline bool isShortId(uint32 id)
/*! /*!
* \brief Returns an indication whether the specified \a id is a text frame id. * \brief Returns an indication whether the specified \a id is a text frame id.
*/ */
inline bool isTextFrame(uint32 id) constexpr bool isTextFrame(uint32 id)
{ {
if (isShortId(id)) { if (isShortId(id)) {
return ((id & 0x00FF0000u) == 0x00540000u) && (id != Id3v2FrameIds::sUserDefinedText); return ((id & 0x00FF0000u) == 0x00540000u) && (id != Id3v2FrameIds::sUserDefinedText);

View File

@ -10,23 +10,23 @@ namespace TagParser {
class TAG_PARSER_EXPORT MatroskaOffsetStates { class TAG_PARSER_EXPORT MatroskaOffsetStates {
public: public:
MatroskaOffsetStates(uint64 initialValue); constexpr MatroskaOffsetStates(uint64 initialValue);
uint64 currentValue() const; constexpr uint64 currentValue() const;
void update(uint64 newValue); void update(uint64 newValue);
uint64 initialValue() const; constexpr uint64 initialValue() const;
private: private:
uint64 m_initialValue; uint64 m_initialValue;
uint64 m_currentValue; uint64 m_currentValue;
}; };
inline MatroskaOffsetStates::MatroskaOffsetStates(uint64 initialValue) constexpr MatroskaOffsetStates::MatroskaOffsetStates(uint64 initialValue)
: m_initialValue(initialValue) : m_initialValue(initialValue)
, m_currentValue(initialValue) , m_currentValue(initialValue)
{ {
} }
inline uint64 MatroskaOffsetStates::currentValue() const constexpr uint64 MatroskaOffsetStates::currentValue() const
{ {
return m_currentValue; return m_currentValue;
} }
@ -36,27 +36,27 @@ inline void MatroskaOffsetStates::update(uint64 newValue)
m_currentValue = newValue; m_currentValue = newValue;
} }
inline uint64 MatroskaOffsetStates::initialValue() const constexpr uint64 MatroskaOffsetStates::initialValue() const
{ {
return m_initialValue; return m_initialValue;
} }
class TAG_PARSER_EXPORT MatroskaReferenceOffsetPair : public MatroskaOffsetStates { class TAG_PARSER_EXPORT MatroskaReferenceOffsetPair : public MatroskaOffsetStates {
public: public:
MatroskaReferenceOffsetPair(uint64 referenceOffset, uint64 initialValue); constexpr MatroskaReferenceOffsetPair(uint64 referenceOffset, uint64 initialValue);
uint64 referenceOffset() const; constexpr uint64 referenceOffset() const;
private: private:
uint64 m_referenceOffset; uint64 m_referenceOffset;
}; };
inline MatroskaReferenceOffsetPair::MatroskaReferenceOffsetPair(uint64 referenceOffset, uint64 initialValue) constexpr MatroskaReferenceOffsetPair::MatroskaReferenceOffsetPair(uint64 referenceOffset, uint64 initialValue)
: MatroskaOffsetStates(initialValue) : MatroskaOffsetStates(initialValue)
, m_referenceOffset(referenceOffset) , m_referenceOffset(referenceOffset)
{ {
} }
inline uint64 MatroskaReferenceOffsetPair::referenceOffset() const constexpr uint64 MatroskaReferenceOffsetPair::referenceOffset() const
{ {
return m_referenceOffset; return m_referenceOffset;
} }

View File

@ -10,434 +10,434 @@ namespace TagParser {
*/ */
namespace MatroskaTagIds { namespace MatroskaTagIds {
inline TAG_PARSER_EXPORT const char *original() constexpr TAG_PARSER_EXPORT const char *original()
{ {
return "ORIGINAL"; return "ORIGINAL";
} }
inline TAG_PARSER_EXPORT const char *sample() constexpr TAG_PARSER_EXPORT const char *sample()
{ {
return "SAMPLE"; return "SAMPLE";
} }
inline TAG_PARSER_EXPORT const char *country() constexpr TAG_PARSER_EXPORT const char *country()
{ {
return "COUNTRY"; return "COUNTRY";
} }
inline TAG_PARSER_EXPORT const char *totalParts() constexpr TAG_PARSER_EXPORT const char *totalParts()
{ {
return "TOTAL_PARTS"; return "TOTAL_PARTS";
} }
inline TAG_PARSER_EXPORT const char *partNumber() constexpr TAG_PARSER_EXPORT const char *partNumber()
{ {
return "PART_NUMBER"; return "PART_NUMBER";
} }
inline TAG_PARSER_EXPORT const char *partOffset() constexpr TAG_PARSER_EXPORT const char *partOffset()
{ {
return "PART_OFFSET"; return "PART_OFFSET";
} }
inline TAG_PARSER_EXPORT const char *title() constexpr TAG_PARSER_EXPORT const char *title()
{ {
return "TITLE"; return "TITLE";
} }
inline TAG_PARSER_EXPORT const char *subtitle() constexpr TAG_PARSER_EXPORT const char *subtitle()
{ {
return "SUBTITLE"; return "SUBTITLE";
} }
inline TAG_PARSER_EXPORT const char *url() constexpr TAG_PARSER_EXPORT const char *url()
{ {
return "URL"; return "URL";
} }
inline TAG_PARSER_EXPORT const char *sortWith() constexpr TAG_PARSER_EXPORT const char *sortWith()
{ {
return "SORT_WITH"; return "SORT_WITH";
} }
inline TAG_PARSER_EXPORT const char *instruments() constexpr TAG_PARSER_EXPORT const char *instruments()
{ {
return "INSTRUMENTS"; return "INSTRUMENTS";
} }
inline TAG_PARSER_EXPORT const char *email() constexpr TAG_PARSER_EXPORT const char *email()
{ {
return "EMAIL"; return "EMAIL";
} }
inline TAG_PARSER_EXPORT const char *address() constexpr TAG_PARSER_EXPORT const char *address()
{ {
return "ADDRESS"; return "ADDRESS";
} }
inline TAG_PARSER_EXPORT const char *fax() constexpr TAG_PARSER_EXPORT const char *fax()
{ {
return "FAX"; return "FAX";
} }
inline TAG_PARSER_EXPORT const char *phone() constexpr TAG_PARSER_EXPORT const char *phone()
{ {
return "PHONE"; return "PHONE";
} }
inline TAG_PARSER_EXPORT const char *artist() constexpr TAG_PARSER_EXPORT const char *artist()
{ {
return "ARTIST"; return "ARTIST";
} }
inline TAG_PARSER_EXPORT const char *album() constexpr TAG_PARSER_EXPORT const char *album()
{ {
return "ALBUM"; return "ALBUM";
} }
inline TAG_PARSER_EXPORT const char *leadPerformer() constexpr TAG_PARSER_EXPORT const char *leadPerformer()
{ {
return "LEAD_PERFORMER"; return "LEAD_PERFORMER";
} }
inline TAG_PARSER_EXPORT const char *accompaniment() constexpr TAG_PARSER_EXPORT const char *accompaniment()
{ {
return "ACCOMPANIMENT"; return "ACCOMPANIMENT";
} }
inline TAG_PARSER_EXPORT const char *composer() constexpr TAG_PARSER_EXPORT const char *composer()
{ {
return "COMPOSER"; return "COMPOSER";
} }
inline TAG_PARSER_EXPORT const char *arranger() constexpr TAG_PARSER_EXPORT const char *arranger()
{ {
return "ARRANGER"; return "ARRANGER";
} }
inline TAG_PARSER_EXPORT const char *lyrics() constexpr TAG_PARSER_EXPORT const char *lyrics()
{ {
return "LYRICS"; return "LYRICS";
} }
inline TAG_PARSER_EXPORT const char *lyricist() constexpr TAG_PARSER_EXPORT const char *lyricist()
{ {
return "LYRICIST"; return "LYRICIST";
} }
inline TAG_PARSER_EXPORT const char *conductor() constexpr TAG_PARSER_EXPORT const char *conductor()
{ {
return "CONDUCTOR"; return "CONDUCTOR";
} }
inline TAG_PARSER_EXPORT const char *director() constexpr TAG_PARSER_EXPORT const char *director()
{ {
return "DIRECTOR"; return "DIRECTOR";
} }
inline TAG_PARSER_EXPORT const char *assistantDirector() constexpr TAG_PARSER_EXPORT const char *assistantDirector()
{ {
return "ASSISTANT_DIRECTOR"; return "ASSISTANT_DIRECTOR";
} }
inline TAG_PARSER_EXPORT const char *directorOfPhotography() constexpr TAG_PARSER_EXPORT const char *directorOfPhotography()
{ {
return "DIRECTOR_OF_PHOTOGRAPHY"; return "DIRECTOR_OF_PHOTOGRAPHY";
} }
inline TAG_PARSER_EXPORT const char *soundEngineer() constexpr TAG_PARSER_EXPORT const char *soundEngineer()
{ {
return "SOUND_ENGINEER"; return "SOUND_ENGINEER";
} }
inline TAG_PARSER_EXPORT const char *artDirector() constexpr TAG_PARSER_EXPORT const char *artDirector()
{ {
return "ART_DIRECTOR"; return "ART_DIRECTOR";
} }
inline TAG_PARSER_EXPORT const char *productionDesigner() constexpr TAG_PARSER_EXPORT const char *productionDesigner()
{ {
return "PRODUCTION_DESIGNER"; return "PRODUCTION_DESIGNER";
} }
inline TAG_PARSER_EXPORT const char *choregrapher() constexpr TAG_PARSER_EXPORT const char *choregrapher()
{ {
return "CHOREGRAPHER"; return "CHOREGRAPHER";
} }
inline TAG_PARSER_EXPORT const char *costumeDesigner() constexpr TAG_PARSER_EXPORT const char *costumeDesigner()
{ {
return "COSTUME_DESIGNER"; return "COSTUME_DESIGNER";
} }
inline TAG_PARSER_EXPORT const char *actor() constexpr TAG_PARSER_EXPORT const char *actor()
{ {
return "ACTOR"; return "ACTOR";
} }
inline TAG_PARSER_EXPORT const char *character() constexpr TAG_PARSER_EXPORT const char *character()
{ {
return "CHARACTER"; return "CHARACTER";
} }
inline TAG_PARSER_EXPORT const char *writtenBy() constexpr TAG_PARSER_EXPORT const char *writtenBy()
{ {
return "WRITTEN_BY"; return "WRITTEN_BY";
} }
inline TAG_PARSER_EXPORT const char *screenplayBy() constexpr TAG_PARSER_EXPORT const char *screenplayBy()
{ {
return "SCREENPLAY_BY"; return "SCREENPLAY_BY";
} }
inline TAG_PARSER_EXPORT const char *editedBy() constexpr TAG_PARSER_EXPORT const char *editedBy()
{ {
return "EDITED_BY"; return "EDITED_BY";
} }
inline TAG_PARSER_EXPORT const char *producer() constexpr TAG_PARSER_EXPORT const char *producer()
{ {
return "PRODUCER"; return "PRODUCER";
} }
inline TAG_PARSER_EXPORT const char *coproducer() constexpr TAG_PARSER_EXPORT const char *coproducer()
{ {
return "COPRODUCER"; return "COPRODUCER";
} }
inline TAG_PARSER_EXPORT const char *executiveProducer() constexpr TAG_PARSER_EXPORT const char *executiveProducer()
{ {
return "EXECUTIVE_PRODUCER"; return "EXECUTIVE_PRODUCER";
} }
inline TAG_PARSER_EXPORT const char *distributedBy() constexpr TAG_PARSER_EXPORT const char *distributedBy()
{ {
return "DISTRIBUTED_BY"; return "DISTRIBUTED_BY";
} }
inline TAG_PARSER_EXPORT const char *masteredBy() constexpr TAG_PARSER_EXPORT const char *masteredBy()
{ {
return "MASTERED_BY"; return "MASTERED_BY";
} }
inline TAG_PARSER_EXPORT const char *encodedBy() constexpr TAG_PARSER_EXPORT const char *encodedBy()
{ {
return "ENCODED_BY"; return "ENCODED_BY";
} }
inline TAG_PARSER_EXPORT const char *mixedBy() constexpr TAG_PARSER_EXPORT const char *mixedBy()
{ {
return "MIXED_BY"; return "MIXED_BY";
} }
inline TAG_PARSER_EXPORT const char *remixedBy() constexpr TAG_PARSER_EXPORT const char *remixedBy()
{ {
return "REMIXED_BY"; return "REMIXED_BY";
} }
inline TAG_PARSER_EXPORT const char *productionStudio() constexpr TAG_PARSER_EXPORT const char *productionStudio()
{ {
return "PRODUCTION_STUDIO"; return "PRODUCTION_STUDIO";
} }
inline TAG_PARSER_EXPORT const char *thanksTo() constexpr TAG_PARSER_EXPORT const char *thanksTo()
{ {
return "THANKS_TO"; return "THANKS_TO";
} }
inline TAG_PARSER_EXPORT const char *publisher() constexpr TAG_PARSER_EXPORT const char *publisher()
{ {
return "PUBLISHER"; return "PUBLISHER";
} }
inline TAG_PARSER_EXPORT const char *label() constexpr TAG_PARSER_EXPORT const char *label()
{ {
return "LABEL"; return "LABEL";
} }
inline TAG_PARSER_EXPORT const char *genre() constexpr TAG_PARSER_EXPORT const char *genre()
{ {
return "GENRE"; return "GENRE";
} }
inline TAG_PARSER_EXPORT const char *mood() constexpr TAG_PARSER_EXPORT const char *mood()
{ {
return "MOOD"; return "MOOD";
} }
inline TAG_PARSER_EXPORT const char *originalMediaType() constexpr TAG_PARSER_EXPORT const char *originalMediaType()
{ {
return "ORIGINAL_TAG_PARSER_TYPE"; return "ORIGINAL_TAG_PARSER_TYPE";
} }
inline TAG_PARSER_EXPORT const char *contentType() constexpr TAG_PARSER_EXPORT const char *contentType()
{ {
return "CONTENT_TYPE"; return "CONTENT_TYPE";
} }
inline TAG_PARSER_EXPORT const char *subject() constexpr TAG_PARSER_EXPORT const char *subject()
{ {
return "SUBJECT"; return "SUBJECT";
} }
inline TAG_PARSER_EXPORT const char *description() constexpr TAG_PARSER_EXPORT const char *description()
{ {
return "DESCRIPTION"; return "DESCRIPTION";
} }
inline TAG_PARSER_EXPORT const char *keywords() constexpr TAG_PARSER_EXPORT const char *keywords()
{ {
return "KEYWORDS"; return "KEYWORDS";
} }
inline TAG_PARSER_EXPORT const char *summary() constexpr TAG_PARSER_EXPORT const char *summary()
{ {
return "SUMMARY"; return "SUMMARY";
} }
inline TAG_PARSER_EXPORT const char *synopsis() constexpr TAG_PARSER_EXPORT const char *synopsis()
{ {
return "SYNOPSIS"; return "SYNOPSIS";
} }
inline TAG_PARSER_EXPORT const char *initialKey() constexpr TAG_PARSER_EXPORT const char *initialKey()
{ {
return "INITIAL_KEY"; return "INITIAL_KEY";
} }
inline TAG_PARSER_EXPORT const char *period() constexpr TAG_PARSER_EXPORT const char *period()
{ {
return "PERIOD"; return "PERIOD";
} }
inline TAG_PARSER_EXPORT const char *lawRating() constexpr TAG_PARSER_EXPORT const char *lawRating()
{ {
return "LAW_RATING"; return "LAW_RATING";
} }
inline TAG_PARSER_EXPORT const char *icra() constexpr TAG_PARSER_EXPORT const char *icra()
{ {
return "ICRA"; return "ICRA";
} }
inline TAG_PARSER_EXPORT const char *dateRelease() constexpr TAG_PARSER_EXPORT const char *dateRelease()
{ {
return "DATE_RELEASED"; return "DATE_RELEASED";
} }
inline TAG_PARSER_EXPORT const char *dateRecorded() constexpr TAG_PARSER_EXPORT const char *dateRecorded()
{ {
return "DATE_RECORDED"; return "DATE_RECORDED";
} }
inline TAG_PARSER_EXPORT const char *dateEncoded() constexpr TAG_PARSER_EXPORT const char *dateEncoded()
{ {
return "DATE_ENCODED"; return "DATE_ENCODED";
} }
inline TAG_PARSER_EXPORT const char *dateTagged() constexpr TAG_PARSER_EXPORT const char *dateTagged()
{ {
return "DATE_TAGGED"; return "DATE_TAGGED";
} }
inline TAG_PARSER_EXPORT const char *dateDigitized() constexpr TAG_PARSER_EXPORT const char *dateDigitized()
{ {
return "DATE_DIGITIZED"; return "DATE_DIGITIZED";
} }
inline TAG_PARSER_EXPORT const char *dateWritten() constexpr TAG_PARSER_EXPORT const char *dateWritten()
{ {
return "DATE_WRITTEN"; return "DATE_WRITTEN";
} }
inline TAG_PARSER_EXPORT const char *datePurchased() constexpr TAG_PARSER_EXPORT const char *datePurchased()
{ {
return "DATE_PURCHASED"; return "DATE_PURCHASED";
} }
inline TAG_PARSER_EXPORT const char *recordingLocation() constexpr TAG_PARSER_EXPORT const char *recordingLocation()
{ {
return "RECORDING_LOCATION"; return "RECORDING_LOCATION";
} }
inline TAG_PARSER_EXPORT const char *compositionLocation() constexpr TAG_PARSER_EXPORT const char *compositionLocation()
{ {
return "COMPOSITION_LOCATION"; return "COMPOSITION_LOCATION";
} }
inline TAG_PARSER_EXPORT const char *composerNationality() constexpr TAG_PARSER_EXPORT const char *composerNationality()
{ {
return "COMPOSER_NATIONALITY"; return "COMPOSER_NATIONALITY";
} }
inline TAG_PARSER_EXPORT const char *comment() constexpr TAG_PARSER_EXPORT const char *comment()
{ {
return "COMMENT"; return "COMMENT";
} }
inline TAG_PARSER_EXPORT const char *playCounter() constexpr TAG_PARSER_EXPORT const char *playCounter()
{ {
return "PLAY_COUNTER"; return "PLAY_COUNTER";
} }
inline TAG_PARSER_EXPORT const char *rating() constexpr TAG_PARSER_EXPORT const char *rating()
{ {
return "RATING"; return "RATING";
} }
inline TAG_PARSER_EXPORT const char *encoder() constexpr TAG_PARSER_EXPORT const char *encoder()
{ {
return "ENCODER"; return "ENCODER";
} }
inline TAG_PARSER_EXPORT const char *encoderSettings() constexpr TAG_PARSER_EXPORT const char *encoderSettings()
{ {
return "ENCODER_SETTINGS"; return "ENCODER_SETTINGS";
} }
inline TAG_PARSER_EXPORT const char *bps() constexpr TAG_PARSER_EXPORT const char *bps()
{ {
return "BPS"; return "BPS";
} }
inline TAG_PARSER_EXPORT const char *fps() constexpr TAG_PARSER_EXPORT const char *fps()
{ {
return "FPS"; return "FPS";
} }
inline TAG_PARSER_EXPORT const char *bpm() constexpr TAG_PARSER_EXPORT const char *bpm()
{ {
return "BPM"; return "BPM";
} }
inline TAG_PARSER_EXPORT const char *duration() constexpr TAG_PARSER_EXPORT const char *duration()
{ {
return "DURATION"; return "DURATION";
} }
inline TAG_PARSER_EXPORT const char *language() constexpr TAG_PARSER_EXPORT const char *language()
{ {
return "LANGUAGE"; return "LANGUAGE";
} }
inline TAG_PARSER_EXPORT const char *numberOfFrames() constexpr TAG_PARSER_EXPORT const char *numberOfFrames()
{ {
return "NUMBER_OF_FRAMES"; return "NUMBER_OF_FRAMES";
} }
inline TAG_PARSER_EXPORT const char *numberOfBytes() constexpr TAG_PARSER_EXPORT const char *numberOfBytes()
{ {
return "NUMBER_OF_BYTES"; return "NUMBER_OF_BYTES";
} }
inline TAG_PARSER_EXPORT const char *measure() constexpr TAG_PARSER_EXPORT const char *measure()
{ {
return "MEASURE"; return "MEASURE";
} }
inline TAG_PARSER_EXPORT const char *tuning() constexpr TAG_PARSER_EXPORT const char *tuning()
{ {
return "TUNING"; return "TUNING";
} }
inline TAG_PARSER_EXPORT const char *replaygainGain() constexpr TAG_PARSER_EXPORT const char *replaygainGain()
{ {
return "REPLAYGAIN_GAIN"; return "REPLAYGAIN_GAIN";
} }
inline TAG_PARSER_EXPORT const char *replaygainPeak() constexpr TAG_PARSER_EXPORT const char *replaygainPeak()
{ {
return "REPLAYGAIN_PEAK"; return "REPLAYGAIN_PEAK";
} }
inline TAG_PARSER_EXPORT const char *identifiers() constexpr TAG_PARSER_EXPORT const char *identifiers()
{ {
return "Identifiers"; return "Identifiers";
} }
inline TAG_PARSER_EXPORT const char *isrc() constexpr TAG_PARSER_EXPORT const char *isrc()
{ {
return "ISRC"; return "ISRC";
} }
inline TAG_PARSER_EXPORT const char *mcdi() constexpr TAG_PARSER_EXPORT const char *mcdi()
{ {
return "MCDI"; return "MCDI";
} }
inline TAG_PARSER_EXPORT const char *isbn() constexpr TAG_PARSER_EXPORT const char *isbn()
{ {
return "ISBN"; return "ISBN";
} }
inline TAG_PARSER_EXPORT const char *barcode() constexpr TAG_PARSER_EXPORT const char *barcode()
{ {
return "BARCODE"; return "BARCODE";
} }
inline TAG_PARSER_EXPORT const char *catalogNumber() constexpr TAG_PARSER_EXPORT const char *catalogNumber()
{ {
return "CATALOG_NUMBER"; return "CATALOG_NUMBER";
} }
inline TAG_PARSER_EXPORT const char *labelCode() constexpr TAG_PARSER_EXPORT const char *labelCode()
{ {
return "LABEL_CODE"; return "LABEL_CODE";
} }
inline TAG_PARSER_EXPORT const char *lccn() constexpr TAG_PARSER_EXPORT const char *lccn()
{ {
return "LCCN"; return "LCCN";
} }
inline TAG_PARSER_EXPORT const char *purchaseItem() constexpr TAG_PARSER_EXPORT const char *purchaseItem()
{ {
return "PURCHASE_ITEM"; return "PURCHASE_ITEM";
} }
inline TAG_PARSER_EXPORT const char *purchaseInfo() constexpr TAG_PARSER_EXPORT const char *purchaseInfo()
{ {
return "PURCHASE_INFO"; return "PURCHASE_INFO";
} }
inline TAG_PARSER_EXPORT const char *purchaseOwner() constexpr TAG_PARSER_EXPORT const char *purchaseOwner()
{ {
return "PURCHASE_OWNER"; return "PURCHASE_OWNER";
} }
inline TAG_PARSER_EXPORT const char *purchasePrice() constexpr TAG_PARSER_EXPORT const char *purchasePrice()
{ {
return "PURCHASE_PRICE"; return "PURCHASE_PRICE";
} }
inline TAG_PARSER_EXPORT const char *purchaseCurrency() constexpr TAG_PARSER_EXPORT const char *purchaseCurrency()
{ {
return "PURCHASE_CURRENCY"; return "PURCHASE_CURRENCY";
} }
inline TAG_PARSER_EXPORT const char *copyright() constexpr TAG_PARSER_EXPORT const char *copyright()
{ {
return "COPYRIGHT"; return "COPYRIGHT";
} }
inline TAG_PARSER_EXPORT const char *productionCopyright() constexpr TAG_PARSER_EXPORT const char *productionCopyright()
{ {
return "PRODUCTION_COPYRIGHT"; return "PRODUCTION_COPYRIGHT";
} }
inline TAG_PARSER_EXPORT const char *license() constexpr TAG_PARSER_EXPORT const char *license()
{ {
return "LICENSE"; return "LICENSE";
} }
inline TAG_PARSER_EXPORT const char *termsOfUse() constexpr TAG_PARSER_EXPORT const char *termsOfUse()
{ {
return "TERMS_OF_USE"; return "TERMS_OF_USE";
} }
@ -447,32 +447,32 @@ inline TAG_PARSER_EXPORT const char *termsOfUse()
* \sa https://github.com/mbunkus/mkvtoolnix/wiki/Automatic-tag-generation * \sa https://github.com/mbunkus/mkvtoolnix/wiki/Automatic-tag-generation
*/ */
namespace TrackSpecific { namespace TrackSpecific {
inline TAG_PARSER_EXPORT const char *numberOfBytes() constexpr TAG_PARSER_EXPORT const char *numberOfBytes()
{ {
return "NUMBER_OF_BYTES"; return "NUMBER_OF_BYTES";
} }
inline TAG_PARSER_EXPORT const char *numberOfFrames() constexpr TAG_PARSER_EXPORT const char *numberOfFrames()
{ {
return "NUMBER_OF_FRAMES"; return "NUMBER_OF_FRAMES";
} }
inline TAG_PARSER_EXPORT const char *duration() constexpr TAG_PARSER_EXPORT const char *duration()
{ {
return "DURATION"; return "DURATION";
} }
/// \brief The track's bit rate in bits per second. /// \brief The track's bit rate in bits per second.
inline TAG_PARSER_EXPORT const char *bitrate() constexpr TAG_PARSER_EXPORT const char *bitrate()
{ {
return "BPS"; return "BPS";
} }
inline TAG_PARSER_EXPORT const char *writingApp() constexpr TAG_PARSER_EXPORT const char *writingApp()
{ {
return "_STATISTICS_WRITING_APP"; return "_STATISTICS_WRITING_APP";
} }
inline TAG_PARSER_EXPORT const char *writingDate() constexpr TAG_PARSER_EXPORT const char *writingDate()
{ {
return "_STATISTICS_WRITING_DATE_UTC"; return "_STATISTICS_WRITING_DATE_UTC";
} }
inline TAG_PARSER_EXPORT const char *statisticsTags() constexpr TAG_PARSER_EXPORT const char *statisticsTags()
{ {
return "_STATISTICS_TAGS"; return "_STATISTICS_TAGS";
} }
@ -483,7 +483,7 @@ inline TAG_PARSER_EXPORT const char *statisticsTags()
/*! /*!
* \brief Returns the general TagTargetLevel for the Matroska specific \a targetLevelValue. * \brief Returns the general TagTargetLevel for the Matroska specific \a targetLevelValue.
*/ */
inline TAG_PARSER_EXPORT TagTargetLevel matroskaTagTargetLevel(uint64 targetLevelValue) constexpr TAG_PARSER_EXPORT TagTargetLevel matroskaTagTargetLevel(uint64 targetLevelValue)
{ {
return targetLevelValue > 70 ? TagTargetLevel::Collection : static_cast<TagTargetLevel>(targetLevelValue / 10); return targetLevelValue > 70 ? TagTargetLevel::Collection : static_cast<TagTargetLevel>(targetLevelValue / 10);
} }
@ -491,7 +491,7 @@ inline TAG_PARSER_EXPORT TagTargetLevel matroskaTagTargetLevel(uint64 targetLeve
/*! /*!
* \brief Returns the Matroska specific target level value for the specified general \a targetLevel. * \brief Returns the Matroska specific target level value for the specified general \a targetLevel.
*/ */
inline TAG_PARSER_EXPORT uint64 matroskaTagTargetLevelValue(TagTargetLevel targetLevel) constexpr TAG_PARSER_EXPORT uint64 matroskaTagTargetLevelValue(TagTargetLevel targetLevel)
{ {
return static_cast<uint64>(targetLevel) * 10; return static_cast<uint64>(targetLevel) * 10;
} }

View File

@ -242,16 +242,16 @@ enum AudioFormatExtensions : unsigned char { SpectralBandReplication = 1, Parame
class TAG_PARSER_EXPORT MediaFormat { class TAG_PARSER_EXPORT MediaFormat {
public: public:
MediaFormat(GeneralMediaFormat general = GeneralMediaFormat::Unknown, unsigned char sub = 0, unsigned char extension = 0); constexpr MediaFormat(GeneralMediaFormat general = GeneralMediaFormat::Unknown, unsigned char sub = 0, unsigned char extension = 0);
const char *name() const; const char *name() const;
const char *abbreviation() const; const char *abbreviation() const;
const char *shortAbbreviation() const; const char *shortAbbreviation() const;
const char *extensionName() const; const char *extensionName() const;
operator bool() const; constexpr operator bool() const;
MediaFormat &operator+=(const MediaFormat &other); constexpr MediaFormat &operator+=(const MediaFormat &other);
bool operator==(GeneralMediaFormat general) const; constexpr bool operator==(GeneralMediaFormat general) const;
bool operator!=(GeneralMediaFormat general) const; constexpr bool operator!=(GeneralMediaFormat general) const;
GeneralMediaFormat general; GeneralMediaFormat general;
unsigned char sub; unsigned char sub;
@ -261,7 +261,7 @@ public:
/*! /*!
* \brief Constructs a new media format. * \brief Constructs a new media format.
*/ */
inline MediaFormat::MediaFormat(GeneralMediaFormat general, unsigned char sub, unsigned char extension) constexpr MediaFormat::MediaFormat(GeneralMediaFormat general, unsigned char sub, unsigned char extension)
: general(general) : general(general)
, sub(sub) , sub(sub)
, extension(extension) , extension(extension)
@ -271,7 +271,7 @@ inline MediaFormat::MediaFormat(GeneralMediaFormat general, unsigned char sub, u
/*! /*!
* \brief "Adds" information from another instance to the object. * \brief "Adds" information from another instance to the object.
*/ */
inline MediaFormat &MediaFormat::operator+=(const MediaFormat &other) constexpr MediaFormat &MediaFormat::operator+=(const MediaFormat &other)
{ {
if (other) { if (other) {
general = other.general; general = other.general;
@ -288,7 +288,7 @@ inline MediaFormat &MediaFormat::operator+=(const MediaFormat &other)
/*! /*!
* \brief Returns whether the media format is the specified general media format. * \brief Returns whether the media format is the specified general media format.
*/ */
inline bool MediaFormat::operator==(GeneralMediaFormat general) const constexpr bool MediaFormat::operator==(GeneralMediaFormat general) const
{ {
return this->general == general; return this->general == general;
} }
@ -296,7 +296,7 @@ inline bool MediaFormat::operator==(GeneralMediaFormat general) const
/*! /*!
* \brief Returns whether the media format is not the specified general media format. * \brief Returns whether the media format is not the specified general media format.
*/ */
inline bool MediaFormat::operator!=(GeneralMediaFormat general) const constexpr bool MediaFormat::operator!=(GeneralMediaFormat general) const
{ {
return this->general != general; return this->general != general;
} }
@ -304,7 +304,7 @@ inline bool MediaFormat::operator!=(GeneralMediaFormat general) const
/*! /*!
* \brief Returns whether the media format is known. * \brief Returns whether the media format is known.
*/ */
inline MediaFormat::operator bool() const constexpr MediaFormat::operator bool() const
{ {
return general != GeneralMediaFormat::Unknown; return general != GeneralMediaFormat::Unknown;
} }

View File

@ -48,7 +48,7 @@ public:
static void seekBackAndWriteAtomSize(std::ostream &stream, const std::ostream::pos_type &startOffset); static void seekBackAndWriteAtomSize(std::ostream &stream, const std::ostream::pos_type &startOffset);
static void seekBackAndWriteAtomSize64(std::ostream &stream, const std::ostream::pos_type &startOffset); static void seekBackAndWriteAtomSize64(std::ostream &stream, const std::ostream::pos_type &startOffset);
static void addHeaderSize(uint64 &dataSize); static constexpr void addHeaderSize(uint64 &dataSize);
static void makeHeader(uint64 size, uint32 id, IoUtilities::BinaryWriter &writer); static void makeHeader(uint64 size, uint32 id, IoUtilities::BinaryWriter &writer);
protected: protected:
@ -78,7 +78,7 @@ inline std::string Mp4Atom::idToString() const
/*! /*!
* \brief Adds the header size to the specified \a data size. * \brief Adds the header size to the specified \a data size.
*/ */
inline void Mp4Atom::addHeaderSize(uint64 &dataSize) constexpr void Mp4Atom::addHeaderSize(uint64 &dataSize)
{ {
dataSize += (dataSize < 0xFFFFFFF7 ? 8 : 16); dataSize += (dataSize < 0xFFFFFFF7 ? 8 : 16);
} }

View File

@ -38,7 +38,7 @@ struct TrackHeaderInfo {
friend class Mp4Track; friend class Mp4Track;
private: private:
TrackHeaderInfo(); constexpr TrackHeaderInfo();
/// \brief Specifies the size which is required for <i>making a new</i> track header based one the existing one. /// \brief Specifies the size which is required for <i>making a new</i> track header based one the existing one.
uint64 requiredSize; uint64 requiredSize;
@ -56,12 +56,13 @@ private:
bool discardBuffer; bool discardBuffer;
}; };
inline TrackHeaderInfo::TrackHeaderInfo() constexpr TrackHeaderInfo::TrackHeaderInfo()
: requiredSize(100) : requiredSize(100)
, canUseExisting(false) , canUseExisting(false)
, truncated(false) , truncated(false)
, version(0) , version(0)
, versionUnknown(false) , versionUnknown(false)
, additionalDataOffset(0)
, discardBuffer(false) , discardBuffer(false)
{ {
} }

View File

@ -36,31 +36,31 @@ enum class XingHeaderFlags {
class TAG_PARSER_EXPORT MpegAudioFrame { class TAG_PARSER_EXPORT MpegAudioFrame {
public: public:
MpegAudioFrame(); constexpr MpegAudioFrame();
void parseHeader(IoUtilities::BinaryReader &reader); void parseHeader(IoUtilities::BinaryReader &reader);
bool isValid() const; constexpr bool isValid() const;
double mpegVersion() const; double mpegVersion() const;
int layer() const; int layer() const;
bool isProtectedByCrc() const; constexpr bool isProtectedByCrc() const;
uint32 bitrate() const; uint32 bitrate() const;
uint32 samplingFrequency() const; uint32 samplingFrequency() const;
uint32 paddingSize() const; constexpr uint32 paddingSize() const;
MpegChannelMode channelMode() const; MpegChannelMode channelMode() const;
bool hasCopyright() const; constexpr bool hasCopyright() const;
bool isOriginal() const; constexpr bool isOriginal() const;
uint32 sampleCount() const; uint32 sampleCount() const;
uint32 size() const; uint32 size() const;
bool isXingHeaderAvailable() const; constexpr bool isXingHeaderAvailable() const;
XingHeaderFlags xingHeaderFlags() const; constexpr XingHeaderFlags xingHeaderFlags() const;
bool isXingFramefieldPresent() const; constexpr bool isXingFramefieldPresent() const;
bool isXingBytesfieldPresent() const; constexpr bool isXingBytesfieldPresent() const;
bool isXingTocFieldPresent() const; constexpr bool isXingTocFieldPresent() const;
bool isXingQualityIndicatorFieldPresent() const; constexpr bool isXingQualityIndicatorFieldPresent() const;
uint32 xingFrameCount() const; constexpr uint32 xingFrameCount() const;
uint32 xingBytesfield() const; constexpr uint32 xingBytesfield() const;
uint32 xingQualityIndicator() const; constexpr uint32 xingQualityIndicator() const;
private: private:
static const uint64 m_xingHeaderOffset; static const uint64 m_xingHeaderOffset;
@ -77,7 +77,7 @@ private:
/*! /*!
* \brief Constructs a new frame. * \brief Constructs a new frame.
*/ */
inline MpegAudioFrame::MpegAudioFrame() constexpr MpegAudioFrame::MpegAudioFrame()
: m_header(0) : m_header(0)
, m_xingHeader(0) , m_xingHeader(0)
, m_xingHeaderFlags(XingHeaderFlags::None) , m_xingHeaderFlags(XingHeaderFlags::None)
@ -90,7 +90,7 @@ inline MpegAudioFrame::MpegAudioFrame()
/*! /*!
* \brief Returns an indication whether the frame is valid. * \brief Returns an indication whether the frame is valid.
*/ */
inline bool MpegAudioFrame::isValid() const constexpr bool MpegAudioFrame::isValid() const
{ {
return (m_header & m_sync) == m_sync; return (m_header & m_sync) == m_sync;
} }
@ -98,7 +98,7 @@ inline bool MpegAudioFrame::isValid() const
/*! /*!
* \brief Returns an indication whether the frame is protected by CRC. * \brief Returns an indication whether the frame is protected by CRC.
*/ */
inline bool MpegAudioFrame::isProtectedByCrc() const constexpr bool MpegAudioFrame::isProtectedByCrc() const
{ {
return (m_header & 0x10000u) != 0x10000u; return (m_header & 0x10000u) != 0x10000u;
} }
@ -108,16 +108,17 @@ inline bool MpegAudioFrame::isProtectedByCrc() const
*/ */
inline uint32 MpegAudioFrame::bitrate() const inline uint32 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 m_bitrateTable[mpegVersion() == 1.0 ? 0 : 1][layer() - 1][(m_header & 0xf000u) >> 12];
else } else {
return 0; return 0;
}
} }
/*! /*!
* \brief Returns the padding size if known; otherwise returns 0. * \brief Returns the padding size if known; otherwise returns 0.
*/ */
inline uint32 MpegAudioFrame::paddingSize() const constexpr uint32 MpegAudioFrame::paddingSize() const
{ {
if (isValid()) { if (isValid()) {
return (m_header & 0x60000u) == 0x60000u ? 4u : 1u * (m_header & 0x200u); return (m_header & 0x60000u) == 0x60000u ? 4u : 1u * (m_header & 0x200u);
@ -129,7 +130,7 @@ inline uint32 MpegAudioFrame::paddingSize() const
/*! /*!
* \brief Returns an indication whether the frame is copyrighted. * \brief Returns an indication whether the frame is copyrighted.
*/ */
inline bool MpegAudioFrame::hasCopyright() const constexpr bool MpegAudioFrame::hasCopyright() const
{ {
return (m_header & 0x8u) == 0x8u; return (m_header & 0x8u) == 0x8u;
} }
@ -137,17 +138,17 @@ inline bool MpegAudioFrame::hasCopyright() const
/*! /*!
* \brief Returns an indication whether the frame labeled as original. * \brief Returns an indication whether the frame labeled as original.
*/ */
inline bool MpegAudioFrame::isOriginal() const constexpr bool MpegAudioFrame::isOriginal() const
{ {
return (m_header & 0x4u) == 0x4u; return (m_header & 0x4u) == 0x4u;
} }
inline XingHeaderFlags operator|(XingHeaderFlags lhs, XingHeaderFlags rhs) constexpr XingHeaderFlags operator|(XingHeaderFlags lhs, XingHeaderFlags rhs)
{ {
return static_cast<XingHeaderFlags>(static_cast<int>(lhs) | static_cast<int>(rhs)); return static_cast<XingHeaderFlags>(static_cast<int>(lhs) | static_cast<int>(rhs));
} }
inline XingHeaderFlags operator&(XingHeaderFlags lhs, XingHeaderFlags rhs) constexpr XingHeaderFlags operator&(XingHeaderFlags lhs, XingHeaderFlags rhs)
{ {
return static_cast<XingHeaderFlags>(static_cast<int>(lhs) & static_cast<int>(rhs)); return static_cast<XingHeaderFlags>(static_cast<int>(lhs) & static_cast<int>(rhs));
} }
@ -155,7 +156,7 @@ inline XingHeaderFlags operator&(XingHeaderFlags lhs, XingHeaderFlags rhs)
/*! /*!
* \brief Returns an indication whether a Xing header is present. * \brief Returns an indication whether a Xing header is present.
*/ */
inline bool MpegAudioFrame::isXingHeaderAvailable() const constexpr bool MpegAudioFrame::isXingHeaderAvailable() const
{ {
return ((m_xingHeader & 0x58696e6700000000uL) == 0x58696e6700000000uL) || ((m_xingHeader & 0x496e666f00000000uL) == 0x496e666f00000000uL); return ((m_xingHeader & 0x58696e6700000000uL) == 0x58696e6700000000uL) || ((m_xingHeader & 0x496e666f00000000uL) == 0x496e666f00000000uL);
} }
@ -163,7 +164,7 @@ inline bool MpegAudioFrame::isXingHeaderAvailable() const
/*! /*!
* \brief Returns the Xing header flags. * \brief Returns the Xing header flags.
*/ */
inline XingHeaderFlags MpegAudioFrame::xingHeaderFlags() const constexpr XingHeaderFlags MpegAudioFrame::xingHeaderFlags() const
{ {
return m_xingHeaderFlags; return m_xingHeaderFlags;
} }
@ -171,7 +172,7 @@ inline XingHeaderFlags MpegAudioFrame::xingHeaderFlags() const
/*! /*!
* \brief Returns an indication whether the Xing frame field is present. * \brief Returns an indication whether the Xing frame field is present.
*/ */
inline bool MpegAudioFrame::isXingFramefieldPresent() const constexpr bool MpegAudioFrame::isXingFramefieldPresent() const
{ {
return (isXingHeaderAvailable()) ? ((m_xingHeaderFlags & XingHeaderFlags::HasFramesField) == XingHeaderFlags::HasFramesField) : false; return (isXingHeaderAvailable()) ? ((m_xingHeaderFlags & XingHeaderFlags::HasFramesField) == XingHeaderFlags::HasFramesField) : false;
} }
@ -179,7 +180,7 @@ inline bool MpegAudioFrame::isXingFramefieldPresent() const
/*! /*!
* \brief Returns an indication whether the Xing bytes field is present. * \brief Returns an indication whether the Xing bytes field is present.
*/ */
inline bool MpegAudioFrame::isXingBytesfieldPresent() const constexpr bool MpegAudioFrame::isXingBytesfieldPresent() const
{ {
return (isXingHeaderAvailable()) ? ((m_xingHeaderFlags & XingHeaderFlags::HasFramesField) == XingHeaderFlags::HasFramesField) : false; return (isXingHeaderAvailable()) ? ((m_xingHeaderFlags & XingHeaderFlags::HasFramesField) == XingHeaderFlags::HasFramesField) : false;
} }
@ -187,7 +188,7 @@ inline bool MpegAudioFrame::isXingBytesfieldPresent() const
/*! /*!
* \brief Returns an indication whether the Xing TOC is present. * \brief Returns an indication whether the Xing TOC is present.
*/ */
inline bool MpegAudioFrame::isXingTocFieldPresent() const constexpr bool MpegAudioFrame::isXingTocFieldPresent() const
{ {
return (isXingHeaderAvailable()) ? ((m_xingHeaderFlags & XingHeaderFlags::HasTocField) == XingHeaderFlags::HasTocField) : false; return (isXingHeaderAvailable()) ? ((m_xingHeaderFlags & XingHeaderFlags::HasTocField) == XingHeaderFlags::HasTocField) : false;
} }
@ -195,7 +196,7 @@ inline bool MpegAudioFrame::isXingTocFieldPresent() const
/*! /*!
* \brief Returns an indication whether the Xing quality indicator field is present. * \brief Returns an indication whether the Xing quality indicator field is present.
*/ */
inline bool MpegAudioFrame::isXingQualityIndicatorFieldPresent() const constexpr bool MpegAudioFrame::isXingQualityIndicatorFieldPresent() const
{ {
return (isXingHeaderAvailable()) ? ((m_xingHeaderFlags & XingHeaderFlags::HasQualityIndicator) == XingHeaderFlags::HasQualityIndicator) : false; return (isXingHeaderAvailable()) ? ((m_xingHeaderFlags & XingHeaderFlags::HasQualityIndicator) == XingHeaderFlags::HasQualityIndicator) : false;
} }
@ -203,7 +204,7 @@ inline bool MpegAudioFrame::isXingQualityIndicatorFieldPresent() const
/*! /*!
* \brief Returns an indication whether the Xing frame count is present. * \brief Returns an indication whether the Xing frame count is present.
*/ */
inline uint32 MpegAudioFrame::xingFrameCount() const constexpr uint32 MpegAudioFrame::xingFrameCount() const
{ {
return m_xingFramefield; return m_xingFramefield;
} }
@ -211,7 +212,7 @@ inline uint32 MpegAudioFrame::xingFrameCount() const
/*! /*!
* \brief Returns the Xing bytes field if known; otherwise returns 0. * \brief Returns the Xing bytes field if known; otherwise returns 0.
*/ */
inline uint32 MpegAudioFrame::xingBytesfield() const constexpr uint32 MpegAudioFrame::xingBytesfield() const
{ {
return m_xingBytesfield; return m_xingBytesfield;
} }
@ -219,7 +220,7 @@ inline uint32 MpegAudioFrame::xingBytesfield() const
/*! /*!
* \brief Returns the Xing quality indicator if known; otherwise returns 0. * \brief Returns the Xing quality indicator if known; otherwise returns 0.
*/ */
inline uint32 MpegAudioFrame::xingQualityIndicator() const constexpr uint32 MpegAudioFrame::xingQualityIndicator() const
{ {
return m_xingQualityIndicator; return m_xingQualityIndicator;
} }

View File

@ -25,7 +25,7 @@ class OggContainer;
* \brief The OggParameter struct holds the OGG parameter for a VorbisComment. * \brief The OggParameter struct holds the OGG parameter for a VorbisComment.
*/ */
struct TAG_PARSER_EXPORT OggParameter { struct TAG_PARSER_EXPORT OggParameter {
OggParameter(); constexpr OggParameter();
void set(std::size_t pageIndex, std::size_t segmentIndex, bool lastMetaDataBlock, GeneralMediaFormat streamFormat = GeneralMediaFormat::Vorbis); void set(std::size_t pageIndex, std::size_t segmentIndex, bool lastMetaDataBlock, GeneralMediaFormat streamFormat = GeneralMediaFormat::Vorbis);
std::size_t firstPageIndex; std::size_t firstPageIndex;
@ -41,7 +41,7 @@ struct TAG_PARSER_EXPORT OggParameter {
* \brief Creates new parameters. * \brief Creates new parameters.
* \remarks The OggContainer class is responsible for assigning sane values. * \remarks The OggContainer class is responsible for assigning sane values.
*/ */
inline OggParameter::OggParameter() constexpr OggParameter::OggParameter()
: firstPageIndex(0) : firstPageIndex(0)
, firstSegmentIndex(0) , firstSegmentIndex(0)
, lastPageIndex(0) , lastPageIndex(0)

View File

@ -11,16 +11,16 @@ class OggIterator;
class TAG_PARSER_EXPORT OpusIdentificationHeader { class TAG_PARSER_EXPORT OpusIdentificationHeader {
public: public:
OpusIdentificationHeader(); constexpr OpusIdentificationHeader();
void parseHeader(OggIterator &iterator); void parseHeader(OggIterator &iterator);
byte version() const; constexpr byte version() const;
byte channels() const; constexpr byte channels() const;
uint16 preSkip() const; constexpr uint16 preSkip() const;
uint32 sampleRate() const; constexpr uint32 sampleRate() const;
uint16 outputGain() const; constexpr uint16 outputGain() const;
byte channelMap() const; constexpr byte channelMap() const;
private: private:
byte m_version; byte m_version;
@ -34,9 +34,10 @@ private:
/*! /*!
* \brief Constructs a new Opus identification header. * \brief Constructs a new Opus identification header.
*/ */
inline OpusIdentificationHeader::OpusIdentificationHeader() constexpr OpusIdentificationHeader::OpusIdentificationHeader()
: m_version(0) : m_version(0)
, m_channels(0) , m_channels(0)
, m_preSkip(0)
, m_sampleRate(0) , m_sampleRate(0)
, m_outputGain(0) , m_outputGain(0)
, m_channelMap(0) , m_channelMap(0)
@ -46,7 +47,7 @@ inline OpusIdentificationHeader::OpusIdentificationHeader()
/*! /*!
* \brief Returns the version (which should be 1 currently). * \brief Returns the version (which should be 1 currently).
*/ */
inline byte OpusIdentificationHeader::version() const constexpr byte OpusIdentificationHeader::version() const
{ {
return m_version; return m_version;
} }
@ -54,7 +55,7 @@ inline byte OpusIdentificationHeader::version() const
/*! /*!
* \brief Returns the number of channels for the Opus stream. * \brief Returns the number of channels for the Opus stream.
*/ */
inline byte OpusIdentificationHeader::channels() const constexpr byte OpusIdentificationHeader::channels() const
{ {
return m_channels; return m_channels;
} }
@ -66,7 +67,7 @@ inline byte OpusIdentificationHeader::channels() const
* output when starting playback, and also the number to subtract from a * output when starting playback, and also the number to subtract from a
* page's granule position to calculate its PCM sample position. * page's granule position to calculate its PCM sample position.
*/ */
inline uint16 OpusIdentificationHeader::preSkip() const constexpr uint16 OpusIdentificationHeader::preSkip() const
{ {
return m_preSkip; return m_preSkip;
} }
@ -76,7 +77,7 @@ inline uint16 OpusIdentificationHeader::preSkip() const
* \remarks This is not the sample rate to use for playback of the encoded data. * \remarks This is not the sample rate to use for playback of the encoded data.
* \sa https://wiki.xiph.org/OggOpus * \sa https://wiki.xiph.org/OggOpus
*/ */
inline uint32 OpusIdentificationHeader::sampleRate() const constexpr uint32 OpusIdentificationHeader::sampleRate() const
{ {
return m_sampleRate; return m_sampleRate;
} }
@ -87,7 +88,7 @@ inline uint32 OpusIdentificationHeader::sampleRate() const
* This is a gain to be applied by the decoder. Virtually all players and media frameworks * This is a gain to be applied by the decoder. Virtually all players and media frameworks
* should apply it by default. * should apply it by default.
*/ */
inline uint16 OpusIdentificationHeader::outputGain() const constexpr uint16 OpusIdentificationHeader::outputGain() const
{ {
return m_outputGain; return m_outputGain;
} }
@ -99,7 +100,7 @@ inline uint16 OpusIdentificationHeader::outputGain() const
* encoded in each Opus packet. * encoded in each Opus packet.
* \sa https://wiki.xiph.org/OggOpus * \sa https://wiki.xiph.org/OggOpus
*/ */
inline byte OpusIdentificationHeader::channelMap() const constexpr byte OpusIdentificationHeader::channelMap() const
{ {
return m_channelMap; return m_channelMap;
} }

View File

@ -10,147 +10,147 @@ namespace TagParser {
*/ */
namespace VorbisCommentIds { namespace VorbisCommentIds {
inline TAG_PARSER_EXPORT const char *trackNumber() constexpr TAG_PARSER_EXPORT const char *trackNumber()
{ {
return "TRACKNUMBER"; return "TRACKNUMBER";
} }
inline TAG_PARSER_EXPORT const char *diskNumber() constexpr TAG_PARSER_EXPORT const char *diskNumber()
{ {
return "DISCNUMBER"; return "DISCNUMBER";
} }
inline TAG_PARSER_EXPORT const char *part() constexpr TAG_PARSER_EXPORT const char *part()
{ {
return "PART"; return "PART";
} }
inline TAG_PARSER_EXPORT const char *partNumber() constexpr TAG_PARSER_EXPORT const char *partNumber()
{ {
return "PARTNUMBER"; return "PARTNUMBER";
} }
inline TAG_PARSER_EXPORT const char *title() constexpr TAG_PARSER_EXPORT const char *title()
{ {
return "TITLE"; return "TITLE";
} }
inline TAG_PARSER_EXPORT const char *version() constexpr TAG_PARSER_EXPORT const char *version()
{ {
return "VERSION"; return "VERSION";
} }
inline TAG_PARSER_EXPORT const char *artist() constexpr TAG_PARSER_EXPORT const char *artist()
{ {
return "ARTIST"; return "ARTIST";
} }
inline TAG_PARSER_EXPORT const char *album() constexpr TAG_PARSER_EXPORT const char *album()
{ {
return "ALBUM"; return "ALBUM";
} }
inline TAG_PARSER_EXPORT const char *label() constexpr TAG_PARSER_EXPORT const char *label()
{ {
return "LABEL"; return "LABEL";
} }
inline TAG_PARSER_EXPORT const char *labelNo() constexpr TAG_PARSER_EXPORT const char *labelNo()
{ {
return "LABELNO"; return "LABELNO";
} }
inline TAG_PARSER_EXPORT const char *language() constexpr TAG_PARSER_EXPORT const char *language()
{ {
return "LANGUAGE"; return "LANGUAGE";
} }
inline TAG_PARSER_EXPORT const char *performer() constexpr TAG_PARSER_EXPORT const char *performer()
{ {
return "PERFORMER"; return "PERFORMER";
} }
inline TAG_PARSER_EXPORT const char *composer() constexpr TAG_PARSER_EXPORT const char *composer()
{ {
return "COMPOSER"; return "COMPOSER";
} }
inline TAG_PARSER_EXPORT const char *ensemble() constexpr TAG_PARSER_EXPORT const char *ensemble()
{ {
return "ENSEMBLE"; return "ENSEMBLE";
} }
inline TAG_PARSER_EXPORT const char *arranger() constexpr TAG_PARSER_EXPORT const char *arranger()
{ {
return "ARRANGER"; return "ARRANGER";
} }
inline TAG_PARSER_EXPORT const char *lyricist() constexpr TAG_PARSER_EXPORT const char *lyricist()
{ {
return "LYRICIST"; return "LYRICIST";
} }
inline TAG_PARSER_EXPORT const char *author() constexpr TAG_PARSER_EXPORT const char *author()
{ {
return "AUTHOR"; return "AUTHOR";
} }
inline TAG_PARSER_EXPORT const char *conductor() constexpr TAG_PARSER_EXPORT const char *conductor()
{ {
return "CONDUCTOR"; return "CONDUCTOR";
} }
inline TAG_PARSER_EXPORT const char *encoder() constexpr TAG_PARSER_EXPORT const char *encoder()
{ {
return "ENCODER"; return "ENCODER";
} }
inline TAG_PARSER_EXPORT const char *publisher() constexpr TAG_PARSER_EXPORT const char *publisher()
{ {
return "PUBLISHER"; return "PUBLISHER";
} }
inline TAG_PARSER_EXPORT const char *genre() constexpr TAG_PARSER_EXPORT const char *genre()
{ {
return "GENRE"; return "GENRE";
} }
inline TAG_PARSER_EXPORT const char *originalMediaType() constexpr TAG_PARSER_EXPORT const char *originalMediaType()
{ {
return "ORIGINAL_TAG_PARSER_TYPE"; return "ORIGINAL_TAG_PARSER_TYPE";
} }
inline TAG_PARSER_EXPORT const char *contentType() constexpr TAG_PARSER_EXPORT const char *contentType()
{ {
return "CONTENT_TYPE"; return "CONTENT_TYPE";
} }
inline TAG_PARSER_EXPORT const char *subject() constexpr TAG_PARSER_EXPORT const char *subject()
{ {
return "SUBJECT"; return "SUBJECT";
} }
inline TAG_PARSER_EXPORT const char *description() constexpr TAG_PARSER_EXPORT const char *description()
{ {
return "DESCRIPTION"; return "DESCRIPTION";
} }
inline TAG_PARSER_EXPORT const char *isrc() constexpr TAG_PARSER_EXPORT const char *isrc()
{ {
return "ISRC"; return "ISRC";
} }
inline TAG_PARSER_EXPORT const char *eanupn() constexpr TAG_PARSER_EXPORT const char *eanupn()
{ {
return "EAN/UPN"; return "EAN/UPN";
} }
inline TAG_PARSER_EXPORT const char *comment() constexpr TAG_PARSER_EXPORT const char *comment()
{ {
return "COMMENT"; return "COMMENT";
} }
inline TAG_PARSER_EXPORT const char *encoderSettings() constexpr TAG_PARSER_EXPORT const char *encoderSettings()
{ {
return "ENCODING"; return "ENCODING";
} }
inline TAG_PARSER_EXPORT const char *date() constexpr TAG_PARSER_EXPORT const char *date()
{ {
return "DATE"; return "DATE";
} }
inline TAG_PARSER_EXPORT const char *location() constexpr TAG_PARSER_EXPORT const char *location()
{ {
return "LOCATION"; return "LOCATION";
} }
inline TAG_PARSER_EXPORT const char *license() constexpr TAG_PARSER_EXPORT const char *license()
{ {
return "LICENSE"; return "LICENSE";
} }
inline TAG_PARSER_EXPORT const char *copyright() constexpr TAG_PARSER_EXPORT const char *copyright()
{ {
return "COPYRIGHT"; return "COPYRIGHT";
} }
inline TAG_PARSER_EXPORT const char *opus() constexpr TAG_PARSER_EXPORT const char *opus()
{ {
return "OPUS"; return "OPUS";
} }
inline TAG_PARSER_EXPORT const char *sourceMedia() constexpr TAG_PARSER_EXPORT const char *sourceMedia()
{ {
return "SOURCEMEDIA"; return "SOURCEMEDIA";
} }
inline TAG_PARSER_EXPORT const char *cover() constexpr TAG_PARSER_EXPORT const char *cover()
{ {
return "METADATA_BLOCK_PICTURE"; return "METADATA_BLOCK_PICTURE";
} }

View File

@ -11,18 +11,18 @@ class OggIterator;
class TAG_PARSER_EXPORT VorbisIdentificationHeader { class TAG_PARSER_EXPORT VorbisIdentificationHeader {
public: public:
VorbisIdentificationHeader(); constexpr VorbisIdentificationHeader();
void parseHeader(OggIterator &iterator); void parseHeader(OggIterator &iterator);
uint32 version() const; constexpr uint32 version() const;
byte channels() const; constexpr byte channels() const;
uint32 sampleRate() const; constexpr uint32 sampleRate() const;
uint32 maxBitrate() const; constexpr uint32 maxBitrate() const;
uint32 nominalBitrate() const; constexpr uint32 nominalBitrate() const;
uint32 minBitrate() const; constexpr uint32 minBitrate() const;
byte blockSize() const; constexpr byte blockSize() const;
byte framingFlag() const; constexpr byte framingFlag() const;
private: private:
uint32 m_version; uint32 m_version;
@ -38,7 +38,7 @@ private:
/*! /*!
* \brief Constructs a new Vorbis identification header. * \brief Constructs a new Vorbis identification header.
*/ */
inline VorbisIdentificationHeader::VorbisIdentificationHeader() constexpr VorbisIdentificationHeader::VorbisIdentificationHeader()
: m_version(0) : m_version(0)
, m_channels(0) , m_channels(0)
, m_sampleRate(0) , m_sampleRate(0)
@ -50,42 +50,42 @@ inline VorbisIdentificationHeader::VorbisIdentificationHeader()
{ {
} }
inline uint32 VorbisIdentificationHeader::version() const constexpr uint32 VorbisIdentificationHeader::version() const
{ {
return m_version; return m_version;
} }
inline byte VorbisIdentificationHeader::channels() const constexpr byte VorbisIdentificationHeader::channels() const
{ {
return m_channels; return m_channels;
} }
inline uint32 VorbisIdentificationHeader::sampleRate() const constexpr uint32 VorbisIdentificationHeader::sampleRate() const
{ {
return m_sampleRate; return m_sampleRate;
} }
inline uint32 VorbisIdentificationHeader::maxBitrate() const constexpr uint32 VorbisIdentificationHeader::maxBitrate() const
{ {
return m_maxBitrate; return m_maxBitrate;
} }
inline uint32 VorbisIdentificationHeader::nominalBitrate() const constexpr uint32 VorbisIdentificationHeader::nominalBitrate() const
{ {
return m_nominalBitrate; return m_nominalBitrate;
} }
inline uint32 VorbisIdentificationHeader::minBitrate() const constexpr uint32 VorbisIdentificationHeader::minBitrate() const
{ {
return m_minBitrate; return m_minBitrate;
} }
inline byte VorbisIdentificationHeader::blockSize() const constexpr byte VorbisIdentificationHeader::blockSize() const
{ {
return m_blockSize; return m_blockSize;
} }
inline byte VorbisIdentificationHeader::framingFlag() const constexpr byte VorbisIdentificationHeader::framingFlag() const
{ {
return m_framingFlag; return m_framingFlag;
} }

View File

@ -18,19 +18,6 @@ namespace TagParser {
* \brief The WaveFormatHeader class parses the WAVEFORMATEX structure defined by MS. * \brief The WaveFormatHeader class parses the WAVEFORMATEX structure defined by MS.
*/ */
/*!
* \brief Constructs a new WaveFormatHeader.
*/
WaveFormatHeader::WaveFormatHeader()
: formatTag(0)
, channelCount(0)
, sampleRate(0)
, bytesPerSecond(0)
, chunkSize(0)
, bitsPerSample(0)
{
}
/*! /*!
* \brief Parses the WAVE "fmt " header segment using the specified \a reader. * \brief Parses the WAVE "fmt " header segment using the specified \a reader.
* \remarks Reads 16 bytes from the associated stream. * \remarks Reads 16 bytes from the associated stream.

View File

@ -7,11 +7,11 @@ namespace TagParser {
class TAG_PARSER_EXPORT WaveFormatHeader { class TAG_PARSER_EXPORT WaveFormatHeader {
public: public:
WaveFormatHeader(); constexpr WaveFormatHeader();
void parse(IoUtilities::BinaryReader &reader); void parse(IoUtilities::BinaryReader &reader);
MediaFormat format() const; MediaFormat format() const;
uint32 bitrate() const; constexpr uint32 bitrate() const;
uint16 formatTag; uint16 formatTag;
uint16 channelCount; uint16 channelCount;
@ -21,10 +21,23 @@ public:
uint16 bitsPerSample; uint16 bitsPerSample;
}; };
/*!
* \brief Constructs a new WaveFormatHeader.
*/
constexpr WaveFormatHeader::WaveFormatHeader()
: formatTag(0)
, channelCount(0)
, sampleRate(0)
, bytesPerSecond(0)
, chunkSize(0)
, bitsPerSample(0)
{
}
/*! /*!
* \brief Calculates the bitrate from the header data. * \brief Calculates the bitrate from the header data.
*/ */
inline uint32 WaveFormatHeader::bitrate() const constexpr uint32 WaveFormatHeader::bitrate() const
{ {
return bitsPerSample * sampleRate * channelCount; return bitsPerSample * sampleRate * channelCount;
} }