Tag Parser
9.1.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
Go to the documentation of this file.
3 #include "../exceptions.h"
4 #include "../mediaformat.h"
30 void MpegAudioFrameStream::internalParseHeader(
Diagnostics &diag)
32 static const string context(
"parsing MPEG audio frame header");
37 m_istream->seekg(-128, ios_base::end);
38 if (m_reader.readUInt24BE() == 0x544147) {
39 m_size = static_cast<std::uint64_t>(m_istream->tellg()) - 3u - m_startOffset;
41 m_size = static_cast<std::uint64_t>(m_istream->tellg()) + 125u - m_startOffset;
43 m_istream->seekg(static_cast<streamoff>(m_startOffset), ios_base::beg);
45 m_frames.emplace_back();
48 addInfo(frame, *
this);
51 if (m_size && xingSize != m_size) {
52 diag.emplace_back(DiagLevel::Warning,
53 "Real length of MPEG audio frames is not equal with value provided by Xing header. The Xing header value will be used.", context);
60 m_duration = TimeSpan::fromSeconds(static_cast<double>(m_size) / (m_bytesPerSecond = static_cast<std::uint32_t>(m_bitrate * 125)));
std::uint32_t m_samplingFrequency
std::uint32_t samplingFrequency() const
Returns the sampeling frequency of the frame if known; otherwise returns 0.
void parseHeader(CppUtilities::BinaryReader &reader, Diagnostics &diag)
Parses the header read using the specified reader.
int layer() const
Returns the MPEG layer if known (1, 2, or 3); otherwise returns 0.
The MpegAudioFrame class is used to parse MPEG audio frames.
The Diagnostics class is a container for DiagMessage.
Contains all classes and functions of the TagInfo library.
std::uint16_t bitrate() const
Returns the bitrate of the frame if known; otherwise returns 0.
std::uint32_t sampleCount() const
Returns the sample count if known; otherwise returns 0.
constexpr bool isXingBytesfieldPresent() const
Returns an indication whether the Xing bytes field is present.
The AbstractTrack class parses and stores technical information about video, audio and other kinds of...
std::uint16_t m_channelCount
constexpr std::uint32_t xingFrameCount() const
Returns an indication whether the Xing frame count is present.
MpegChannelMode channelMode() const
Returns the channel mode if known; otherwise returns MpegChannelMode::Unspecifed.
constexpr bool isXingFramefieldPresent() const
Returns an indication whether the Xing frame field is present.
constexpr std::uint32_t xingBytesfield() const
Returns the Xing bytes field if known; otherwise returns 0.
The exception that is thrown when the data to be parsed holds no parsable information (e....
std::uint8_t m_channelConfig
double mpegVersion() const
Returns the MPEG version if known (1.0, 2.0 or 2.5); otherwise returns 0.