Tag Parser: adts/adtsstream.cpp Source File

Tag Parser 12.5.3 C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags

Loading...
Searching...
No Matches
adtsstream.cpp
Go to the documentation of this file.
1#include "./adtsstream.h"
2
3#include "../mp4/mp4ids.h"
4
5#include "../exceptions.h"
6
7#include <string>
8
9using namespace std;
10
11namespace TagParser {
12
17
18 void AdtsStream::internalParseHeader(Diagnostics &diag, AbortableProgressFeedback &progress)
19{
20 CPP_UTILITIES_UNUSED(diag)
21 CPP_UTILITIES_UNUSED(progress)
22
23 //static const string context("parsing ADTS frame header");
24 if (!m_istream) {
25 throw NoDataFoundException();
26 }
27 // parse frame header
28 m_istream->seekg(static_cast<std::streamoff>(m_startOffset), ios_base::beg);
29 m_firstFrame.parseHeader(m_reader);
30 m_format = Mpeg4AudioObjectIds::idToMediaFormat(m_firstFrame.mpeg4AudioObjectId());
31 m_channelCount = Mpeg4ChannelConfigs::channelCount(m_channelConfig = m_firstFrame.mpeg4ChannelConfig());
32 std::uint8_t sampleRateIndex = m_firstFrame.mpeg4SamplingFrequencyIndex();
33 m_samplingFrequency = sampleRateIndex < sizeof(mpeg4SamplingFrequencyTable) ? mpeg4SamplingFrequencyTable[sampleRateIndex] : 0;
34}
35
36} // namespace TagParser
adtsstream.h
TagParser::AbortableProgressFeedback
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.
Definition progressfeedback.h:186
TagParser::AbstractTrack::m_channelCount
std::uint16_t m_channelCount
Definition abstracttrack.h:217
TagParser::AbstractTrack::m_channelConfig
std::uint8_t m_channelConfig
Definition abstracttrack.h:218
TagParser::AbstractTrack::m_reader
CppUtilities::BinaryReader m_reader
Definition abstracttrack.h:194
TagParser::AbstractTrack::m_startOffset
std::uint64_t m_startOffset
Definition abstracttrack.h:196
TagParser::AbstractTrack::m_format
MediaFormat m_format
Definition abstracttrack.h:198
TagParser::AbstractTrack::m_istream
std::istream * m_istream
Definition abstracttrack.h:192
TagParser::AbstractTrack::m_samplingFrequency
std::uint32_t m_samplingFrequency
Definition abstracttrack.h:213
TagParser::AdtsStream::internalParseHeader
void internalParseHeader(Diagnostics &diag, AbortableProgressFeedback &progress) override
This method is internally called to parse header information.
Definition adtsstream.cpp:18
TagParser::Diagnostics
The Diagnostics class is a container for DiagMessage.
Definition diagnostics.h:156
TagParser::NoDataFoundException
The exception that is thrown when the data to be parsed holds no parsable information (e....
Definition exceptions.h:18
exceptions.h
mp4ids.h
TagParser::Mpeg4AudioObjectIds::idToMediaFormat
TAG_PARSER_EXPORT MediaFormat idToMediaFormat(std::uint8_t mpeg4AudioObjectId, bool sbrPresent=false, bool psPresent=false)
Definition mp4ids.cpp:373
TagParser::Mpeg4ChannelConfigs::channelCount
TAG_PARSER_EXPORT std::uint8_t channelCount(std::uint8_t config)
Returns the channel count for the specified MPEG-4 channel config.
Definition mp4ids.cpp:466
TagParser
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
TagParser::mpeg4SamplingFrequencyTable
std::uint32_t mpeg4SamplingFrequencyTable[13]
Definition mp4ids.cpp:429