improved document title / segment count API
This commit is contained in:
parent
b3bd28ae86
commit
949a88c678
|
@ -412,6 +412,23 @@ size_t AbstractContainer::attachmentCount() const
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns whether the title property is supported.
|
||||
*/
|
||||
bool AbstractContainer::supportsTitle() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the number of segments.
|
||||
*/
|
||||
size_t AbstractContainer::segmentCount() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Discards all parsing results.
|
||||
*/
|
||||
|
|
|
@ -76,6 +76,8 @@ public:
|
|||
uint64 doctypeReadVersion() const;
|
||||
const std::vector<std::string> &titles() const;
|
||||
void setTitle(const std::string &title, std::size_t segmentIndex = 0);
|
||||
virtual bool supportsTitle() const;
|
||||
virtual std::size_t segmentCount() const;
|
||||
ChronoUtilities::TimeSpan duration() const;
|
||||
ChronoUtilities::DateTime creationTime() const;
|
||||
ChronoUtilities::DateTime modificationTime() const;
|
||||
|
|
|
@ -48,7 +48,8 @@ uint64 MatroskaContainer::m_maxFullParseSize = 0x3200000;
|
|||
MatroskaContainer::MatroskaContainer(MediaFileInfo &fileInfo, uint64 startOffset) :
|
||||
GenericContainer<MediaFileInfo, MatroskaTag, MatroskaTrack, EbmlElement>(fileInfo, startOffset),
|
||||
m_maxIdLength(4),
|
||||
m_maxSizeLength(8)
|
||||
m_maxSizeLength(8),
|
||||
m_segmentCount(0)
|
||||
{
|
||||
m_version = 1;
|
||||
m_readVersion = 1;
|
||||
|
@ -81,6 +82,7 @@ void MatroskaContainer::reset()
|
|||
m_seekInfos.clear();
|
||||
m_editionEntries.clear();
|
||||
m_attachments.clear();
|
||||
m_segmentCount = 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -345,6 +347,7 @@ void MatroskaContainer::internalParseHeader()
|
|||
m_segmentInfoElements.clear();
|
||||
m_tagsElements.clear();
|
||||
m_seekInfos.clear();
|
||||
m_segmentCount = 0;
|
||||
uint64 currentOffset = 0;
|
||||
vector<MatroskaSeekInfo>::size_type seekInfosIndex = 0;
|
||||
// loop through all top level elements
|
||||
|
@ -402,6 +405,7 @@ void MatroskaContainer::internalParseHeader()
|
|||
}
|
||||
break;
|
||||
case MatroskaIds::Segment:
|
||||
++m_segmentCount;
|
||||
for(EbmlElement *subElement = topLevelElement->firstChild(); subElement; subElement = subElement->nextSibling()) {
|
||||
try {
|
||||
subElement->parse();
|
||||
|
|
|
@ -42,6 +42,9 @@ public:
|
|||
MatroskaAttachment *attachment(std::size_t index);
|
||||
std::size_t attachmentCount() const;
|
||||
|
||||
virtual bool supportsTitle() const;
|
||||
virtual std::size_t segmentCount() const;
|
||||
|
||||
void reset();
|
||||
|
||||
protected:
|
||||
|
@ -67,6 +70,7 @@ private:
|
|||
std::vector<std::unique_ptr<MatroskaSeekInfo> > m_seekInfos;
|
||||
std::vector<std::unique_ptr<MatroskaEditionEntry> > m_editionEntries;
|
||||
std::vector<std::unique_ptr<MatroskaAttachment> > m_attachments;
|
||||
std::size_t m_segmentCount;
|
||||
static uint64 m_maxFullParseSize;
|
||||
};
|
||||
|
||||
|
@ -139,6 +143,16 @@ inline std::size_t MatroskaContainer::attachmentCount() const
|
|||
return m_attachments.size();
|
||||
}
|
||||
|
||||
inline bool MatroskaContainer::supportsTitle() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
inline std::size_t MatroskaContainer::segmentCount() const
|
||||
{
|
||||
return m_segmentInfoElements.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // MATROSKACONTAINER_H
|
||||
|
|
Loading…
Reference in New Issue