Tag Parser 12.4.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
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) {
26 }
27 // parse frame header
28 m_istream->seekg(static_cast<std::streamoff>(m_startOffset), ios_base::beg);
29 m_firstFrame.parseHeader(m_reader);
32 std::uint8_t sampleRateIndex = m_firstFrame.mpeg4SamplingFrequencyIndex();
33 m_samplingFrequency = sampleRateIndex < sizeof(mpeg4SamplingFrequencyTable) ? mpeg4SamplingFrequencyTable[sampleRateIndex] : 0;
34}
35
36} // namespace TagParser
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.
CppUtilities::BinaryReader m_reader
std::uint32_t m_samplingFrequency
constexpr std::uint8_t mpeg4ChannelConfig() const
Returns the MPEG-4 channel configuration.
Definition adtsframe.h:95
void parseHeader(CppUtilities::BinaryReader &reader)
Parses the header read using the specified reader.
Definition adtsframe.cpp:21
constexpr std::uint8_t mpeg4AudioObjectId() const
Returns the MPEG-4 audio object type ID.
Definition adtsframe.h:76
constexpr std::uint8_t mpeg4SamplingFrequencyIndex() const
Returns the MPEG-4 sample rate index.
Definition adtsframe.h:85
void internalParseHeader(Diagnostics &diag, AbortableProgressFeedback &progress) override
This method is internally called to parse header information.
The Diagnostics class is a container for DiagMessage.
The exception that is thrown when the data to be parsed holds no parsable information (e....
TAG_PARSER_EXPORT MediaFormat idToMediaFormat(std::uint8_t mpeg4AudioObjectId, bool sbrPresent=false, bool psPresent=false)
Definition mp4ids.cpp:373
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
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
std::uint32_t mpeg4SamplingFrequencyTable[13]
Definition mp4ids.cpp:429