3 #include "../exceptions.h" 4 #include "../mediaformat.h" 32 void MpegAudioFrameStream::internalParseHeader(
Diagnostics &diag)
34 static const string context(
"parsing MPEG audio frame header");
39 m_istream->seekg(-128, ios_base::end);
40 if (m_reader.readUInt24BE() == 0x544147) {
41 m_size =
static_cast<uint64
>(m_istream->tellg()) - 3u - m_startOffset;
43 m_size =
static_cast<uint64
>(m_istream->tellg()) + 125u - m_startOffset;
45 m_istream->seekg(static_cast<streamoff>(m_startOffset), ios_base::beg);
47 m_frames.emplace_back();
50 addInfo(frame, *
this);
53 if (m_size && xingSize != m_size) {
54 diag.emplace_back(DiagLevel::Warning,
55 "Real length of MPEG audio frames is not equal with value provided by Xing header. The Xing header value will be used.", context);
60 ? ((
static_cast<double>(m_size) * 8.0)
63 m_duration = TimeSpan::fromSeconds(static_cast<double>(m_size) / (m_bytesPerSecond = static_cast<uint32>(m_bitrate * 125)));
uint32 sampleCount() const
Returns the sample count if known; otherwise returns 0.
void parseHeader(IoUtilities::BinaryReader &reader)
Parses the header read using the specified reader.
The MpegAudioFrame class is used to parse MPEG audio frames.
double mpegVersion() const
Returns the MPEG version if known (1.0, 2.0 or 2.5); otherwise returns 0.
MpegChannelMode channelMode() const
Returns the channel mode if known; otherwise returns MpegChannelMode::Unspecifed. ...
bool isXingBytesfieldPresent() const
Returns an indication whether the Xing bytes 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.
bool isXingFramefieldPresent() const
Returns an indication whether the Xing frame field is present.
uint32 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.
The AbstractTrack class parses and stores technical information about video, audio and other kinds of...
uint32 xingFrameCount() const
Returns an indication whether the Xing frame count is present.
uint32 m_samplingFrequency
Contains all classes and functions of the TagInfo library.
uint32 bitrate() const
Returns the bitrate of the frame if known; otherwise returns 0.
uint32 samplingFrequency() const
Returns the sampeling frequency of the frame if known; otherwise returns 0.
The Diagnostics class is a container for DiagMessage.