1#ifndef TAG_PARSER_MP4TRACK_H
2#define TAG_PARSER_MP4TRACK_H
128 const std::vector<std::uint32_t> &
sampleSizes()
const;
161 void updateChunkOffsets(
const std::vector<std::int64_t> &oldMdatOffsets,
const std::vector<std::int64_t> &newMdatOffsets);
173 std::uint64_t accumulateSampleSizes(std::size_t &sampleIndex, std::size_t count,
Diagnostics &diag);
174 void addChunkSizeEntries(
175 std::vector<std::uint64_t> &chunkSizeTable, std::size_t count, std::size_t &sampleIndex, std::uint32_t
sampleCount,
Diagnostics &diag);
178 std::tuple<std::uint64_t, std::uint64_t> calculateSampleTableSize(
Diagnostics &diag)
const;
191 std::uint32_t m_rawMediaType;
192 std::uint16_t m_framesPerSample;
193 std::vector<std::uint32_t> m_sampleSizes;
194 unsigned int m_chunkOffsetSize;
195 std::uint32_t m_chunkCount;
196 std::uint32_t m_sampleToChunkEntryCount;
197 std::uint64_t m_rawTkhdCreationTime;
198 std::uint64_t m_rawMdhdCreationTime;
199 std::uint64_t m_rawTkhdModificationTime;
200 std::uint64_t m_rawMdhdModificationTime;
201 std::uint64_t m_rawTkhdDuration;
202 std::uint64_t m_rawMdhdDuration;
203 std::unique_ptr<Mpeg4ElementaryStreamInfo> m_esInfo;
204 std::unique_ptr<AvcConfiguration> m_avcConfig;
205 std::unique_ptr<Av1Configuration> m_av1Config;
206 mutable std::unique_ptr<TrackHeaderInfo> m_trackHeaderInfo;
226 return m_sampleSizes;
239 return m_chunkOffsetSize;
264 return m_sampleToChunkEntryCount;
276 return m_esInfo.get();
287 return m_avcConfig.get();
298 return m_av1Config.get();
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.
std::uint64_t size() const
Returns the size in bytes if known; otherwise returns 0.
std::uint64_t startOffset() const
Returns the start offset of the track in the associated stream.
AbstractTrack(std::istream &inputStream, std::ostream &outputStream, std::uint64_t startOffset)
Constructs a new track.
std::uint64_t sampleCount() const
Returns the number of samples/frames if known; otherwise returns 0.
CppUtilities::BinaryReader & reader()
Returns a binary reader for the associated stream.
The Diagnostics class is a container for DiagMessage.
The Mp4Atom class helps to parse MP4 files.
static std::unique_ptr< Mpeg4VideoSpecificConfig > parseVideoSpecificConfig(CppUtilities::BinaryReader &reader, std::uint64_t startOffset, std::uint64_t size, Diagnostics &diag)
Parses the video specific configuration for the track.
static std::unique_ptr< Mpeg4ElementaryStreamInfo > parseMpeg4ElementaryStreamInfo(CppUtilities::BinaryReader &reader, Mp4Atom *esDescAtom, Diagnostics &diag)
Reads the MPEG-4 elementary stream descriptor for the track.
const Av1Configuration * av1Configuration() const
Returns the AV1 configuration.
std::uint32_t chunkCount() const
Returns the number of chunks denoted by the stco/co64 atom.
void setChunkOffsetSize(unsigned int chunkOffsetSize)
Sets the size of a single chunk offset denotation within the stco/co64 atom.
std::vector< std::tuple< std::uint32_t, std::uint32_t, std::uint32_t > > readSampleToChunkTable(Diagnostics &diag)
Reads the sample to chunk table.
static void addInfo(const AvcConfiguration &avcConfig, AbstractTrack &track)
Adds the information from the specified avcConfig to the specified track.
std::vector< std::uint64_t > readChunkSizes(TagParser::Diagnostics &diag)
Reads the chunk sizes from the stsz (sample sizes) and stsc (samples per chunk) atom.
Mp4Track(Mp4Atom &trakAtom)
Constructs a new track for the specified trakAtom.
void updateChunkOffsets(const std::vector< std::int64_t > &oldMdatOffsets, const std::vector< std::int64_t > &newMdatOffsets)
Updates the chunk offsets of the track.
void internalParseHeader(Diagnostics &diag, AbortableProgressFeedback &progress) override
This method is internally called to parse header information.
void makeSampleTable(Diagnostics &diag)
Makes the sample table (stbl atom) for the track.
std::uint64_t requiredSize(Diagnostics &diag) const
Returns the number of bytes written when calling makeTrack().
TrackType type() const override
Returns the type of the track if known; otherwise returns TrackType::Unspecified.
std::uint32_t sampleToChunkEntryCount() const
Returns the number of "sample to chunk" entries within the stsc atom.
const std::vector< std::uint32_t > & sampleSizes() const
Returns the sample size table for the track.
void makeMedia(Diagnostics &diag)
Makes the media information (mdia atom) for the track.
std::uint64_t chunkOffsetAtomSize(Diagnostics &diag) const
Returns the size of the stco/co64 atom for this track based on the parsed/assigned chunkOffsetSize() ...
std::vector< std::uint64_t > readChunkOffsets(bool parseFragments, Diagnostics &diag)
Reads the chunk offsets from the stco atom and fragments if parseFragments is true.
unsigned int chunkOffsetSize() const
Returns the size of a single chunk offset denotation within the stco/co64 atom.
const Mpeg4ElementaryStreamInfo * mpeg4ElementaryStreamInfo() const
Returns information about the MPEG-4 elementary stream.
void makeTrackHeader(Diagnostics &diag)
Makes the track header (tkhd atom) for the track.
void bufferTrackAtoms(Diagnostics &diag)
Buffers all atoms required by the makeTrack() method.
void makeMediaInfo(Diagnostics &diag)
Makes a media information (minf atom) for the track.
const AvcConfiguration * avcConfiguration() const
Returns the AVC configuration.
Mp4Atom & trakAtom()
Returns the trak atom for the current instance.
void makeTrack(Diagnostics &diag)
Makes the track entry ("trak"-atom) for the track.
static std::unique_ptr< Mpeg4AudioSpecificConfig > parseAudioSpecificConfig(std::istream &stream, std::uint64_t startOffset, std::uint64_t size, Diagnostics &diag)
Parses the audio specific configuration for the track.
void updateChunkOffset(std::uint32_t chunkIndex, std::uint64_t offset)
Updates a particular chunk offset.
std::uint32_t sampleFrequency
std::uint16_t layerLength
std::uint32_t extensionSampleFrequency
std::uint8_t resilienceFlags
std::uint8_t extensionChannelConfiguration
std::uint16_t coreCoderDelay
std::uint8_t extensionSampleFrequencyIndex
std::uint8_t channelConfiguration
std::uint8_t extensionFlag
Mpeg4AudioSpecificConfig()
std::uint8_t sampleFrequencyIndex
std::uint8_t audioObjectType
std::uint8_t extensionAudioObjectType
std::uint8_t numOfSubFrame
The Mpeg4Descriptor class helps to parse MPEG-4 descriptors.
The Mpeg4ElementaryStreamInfo class holds MPEG-4 elementary stream info parsed using Mp4Track::parseM...
std::unique_ptr< Mpeg4AudioSpecificConfig > audioSpecificConfig
std::uint8_t priority() const
bool dependencyFlag() const
std::uint32_t averageBitrate
std::uint8_t decCfgDescFlags
Mpeg4ElementaryStreamInfo()
std::uint8_t streamTypeId() const
std::uint16_t dependsOnId
std::uint8_t objectTypeId
std::unique_ptr< Mpeg4VideoSpecificConfig > videoSpecificConfig
Mpeg4VideoSpecificConfig()
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Contains all classes and functions of the TagInfo library.
TrackType
The TrackType enum specifies the underlying file type of a track and the concrete class of the track ...
The Av1Configuration struct provides a parser for AV1 configuration found in ISOBMFF files.
The AvcConfiguration struct provides a parser for AVC configuration.
The Mp4Timings struct holds timing values found in multiple MP4 atoms.