2018-03-06 23:09:15 +01:00
|
|
|
#ifndef TAG_PARSER_MATROSKASEEKINFO_H
|
|
|
|
#define TAG_PARSER_MATROSKASEEKINFO_H
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2015-09-06 19:57:33 +02:00
|
|
|
#include "./ebmlelement.h"
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
#include <utility>
|
|
|
|
|
2018-03-06 23:09:15 +01:00
|
|
|
namespace TagParser {
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2018-03-07 01:17:50 +01:00
|
|
|
class TAG_PARSER_EXPORT MatroskaSeekInfo {
|
2015-04-22 19:22:01 +02:00
|
|
|
public:
|
|
|
|
MatroskaSeekInfo();
|
|
|
|
|
2019-06-17 19:11:00 +02:00
|
|
|
const std::vector<EbmlElement *> &seekHeadElements() const;
|
2019-03-13 19:06:42 +01:00
|
|
|
const std::vector<std::pair<EbmlElement::IdentifierType, std::uint64_t>> &info() const;
|
|
|
|
std::vector<std::pair<EbmlElement::IdentifierType, std::uint64_t>> &info();
|
|
|
|
void shift(std::uint64_t start, std::int64_t amount);
|
2019-06-17 19:11:20 +02:00
|
|
|
void parse(EbmlElement *seekHeadElements, Diagnostics &diag, std::size_t maxIndirection = 1);
|
2018-03-05 17:49:29 +01:00
|
|
|
void make(std::ostream &stream, Diagnostics &diag);
|
2019-03-13 19:06:42 +01:00
|
|
|
std::uint64_t minSize() const;
|
|
|
|
std::uint64_t maxSize() const;
|
|
|
|
std::uint64_t actualSize() const;
|
|
|
|
bool push(unsigned int index, EbmlElement::IdentifierType id, std::uint64_t offset);
|
2015-04-22 19:22:01 +02:00
|
|
|
void clear();
|
|
|
|
|
|
|
|
private:
|
2019-06-17 19:11:00 +02:00
|
|
|
std::vector<EbmlElement *> m_seekHeadElements;
|
|
|
|
std::vector<std::unique_ptr<EbmlElement>> m_additionalSeekHeadElements;
|
2019-03-13 19:06:42 +01:00
|
|
|
std::vector<std::pair<EbmlElement::IdentifierType, std::uint64_t>> m_info;
|
2015-04-22 19:22:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Constructs a new MatroskaSeekInfo.
|
|
|
|
*/
|
2018-03-07 01:17:50 +01:00
|
|
|
inline MatroskaSeekInfo::MatroskaSeekInfo()
|
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
2019-06-17 19:11:00 +02:00
|
|
|
* \brief Returns a pointer to the seek head elements the seek information is composed of.
|
|
|
|
* \remarks This list is initially empty. When calling parse() it is at least populated with the specified seek head element (ownership remains
|
|
|
|
* by the caller). In case that seek table references another seek table those elements are also returned (the MatroskaSeekInfo has ownership).
|
2015-04-22 19:22:01 +02:00
|
|
|
*/
|
2019-06-17 19:11:00 +02:00
|
|
|
inline const std::vector<EbmlElement *> &MatroskaSeekInfo::seekHeadElements() const
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
2019-06-17 19:11:00 +02:00
|
|
|
return m_seekHeadElements;
|
2015-04-22 19:22:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns the seek information gathered when the parse() method was called.
|
|
|
|
* \returns Returns the seek information as pairs of element IDs and the associated offsets (relative to the beginning of the file).
|
|
|
|
*/
|
2019-03-13 19:06:42 +01:00
|
|
|
inline const std::vector<std::pair<EbmlElement::IdentifierType, std::uint64_t>> &MatroskaSeekInfo::info() const
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
|
|
|
return m_info;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns a mutable version of the seek information gathered when the parse() method was called.
|
|
|
|
* \returns Returns the seek information as pairs of element IDs and the associated offsets (relative to the beginning of the file).
|
|
|
|
*/
|
2019-03-13 19:06:42 +01:00
|
|
|
inline std::vector<std::pair<EbmlElement::IdentifierType, std::uint64_t>> &MatroskaSeekInfo::info()
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
|
|
|
return m_info;
|
|
|
|
}
|
|
|
|
|
2018-03-07 01:17:50 +01:00
|
|
|
} // namespace TagParser
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2018-03-06 23:09:15 +01:00
|
|
|
#endif // TAG_PARSER_MATROSKASEEKINFO_H
|