3 #include "../exceptions.h" 4 #include "../mediaformat.h" 32 void MpegAudioFrameStream::internalParseHeader()
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(m_startOffset, ios_base::beg);
47 m_frames.emplace_back();
50 addInfo(frame, *
this);
53 if(m_size && xingSize != m_size) {
54 addNotification(NotificationType::Warning,
"Real length of MPEG audio frames is not equal with value provided by Xing header. The Xing header value will be used.", context);
61 m_duration = TimeSpan::fromSeconds(static_cast<double>(m_size) / (m_bytesPerSecond = m_bitrate * 125));
Contains utility classes helping to read and write streams.