Move `maxFullParseSize()` to `MediaFileInfo` as non-static member
This commit is contained in:
parent
6f321b7b00
commit
5745632af7
|
@ -35,8 +35,6 @@ namespace TagParser {
|
|||
* \brief Implementation of GenericContainer<MediaFileInfo, MatroskaTag, MatroskaTrack, EbmlElement>.
|
||||
*/
|
||||
|
||||
std::uint64_t MatroskaContainer::m_maxFullParseSize = 0x3200000; // FIXME v11: move to MediaFileInfo
|
||||
|
||||
/*!
|
||||
* \brief Constructs a new container for the specified \a fileInfo at the specified \a startOffset.
|
||||
*/
|
||||
|
@ -564,7 +562,7 @@ void MatroskaContainer::internalParseHeader(Diagnostics &diag, AbortableProgress
|
|||
}
|
||||
}
|
||||
// -> stop if tracks and tags have been found or the file exceeds the max. size to fully process
|
||||
if (((!m_tracksElements.empty() && !m_tagsElements.empty()) || fileInfo().size() > m_maxFullParseSize)
|
||||
if (((!m_tracksElements.empty() && !m_tagsElements.empty()) || fileInfo().size() > fileInfo().maxFullParseSize())
|
||||
&& !m_segmentInfoElements.empty()) {
|
||||
goto finish;
|
||||
}
|
||||
|
|
|
@ -31,8 +31,6 @@ public:
|
|||
std::uint64_t maxSizeLength() const;
|
||||
const std::vector<std::unique_ptr<MatroskaSeekInfo>> &seekInfos() const;
|
||||
|
||||
static std::uint64_t maxFullParseSize();
|
||||
void setMaxFullParseSize(std::uint64_t maxFullParseSize);
|
||||
const std::vector<std::unique_ptr<MatroskaEditionEntry>> &editionEntires() const;
|
||||
MatroskaChapter *chapter(std::size_t index) override;
|
||||
std::size_t chapterCount() const override;
|
||||
|
@ -72,7 +70,6 @@ private:
|
|||
std::vector<std::unique_ptr<MatroskaEditionEntry>> m_editionEntries;
|
||||
std::vector<std::unique_ptr<MatroskaAttachment>> m_attachments;
|
||||
std::size_t m_segmentCount;
|
||||
static std::uint64_t m_maxFullParseSize;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -99,33 +96,6 @@ inline const std::vector<std::unique_ptr<MatroskaSeekInfo>> &MatroskaContainer::
|
|||
return m_seekInfos;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the maximal file size for a "full parse" in byte.
|
||||
*
|
||||
* The "Tags" element (which holds the tag information) is commonly at the end of a Matroska file. Hence the
|
||||
* parser needs to walk through the entire file to find the tag information if no "SeekHead" element is present
|
||||
* which might causes long loading times. To avoid this a maximal file size for a "full parse" can be specified.
|
||||
* The disadvantage is that the parser relies on the presence of a SeekHead element on larger files to retrieve
|
||||
* tag information.
|
||||
*
|
||||
* The default value is 50 MiB.
|
||||
*
|
||||
* \sa setMaxFullParseSize()
|
||||
*/
|
||||
inline std::uint64_t MatroskaContainer::maxFullParseSize()
|
||||
{
|
||||
return m_maxFullParseSize;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the maximal file size for a "full parse" in byte.
|
||||
* \sa maxFullParseSize()
|
||||
*/
|
||||
inline void MatroskaContainer::setMaxFullParseSize(std::uint64_t maxFullParseSize)
|
||||
{
|
||||
m_maxFullParseSize = maxFullParseSize;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the edition entries.
|
||||
*/
|
||||
|
|
|
@ -96,6 +96,7 @@ MediaFileInfo::MediaFileInfo(std::string &&path)
|
|||
, m_indexPosition(ElementPosition::BeforeData)
|
||||
, m_fileHandlingFlags(MediaFileHandlingFlags::ForceRewrite | MediaFileHandlingFlags::ForceTagPosition | MediaFileHandlingFlags::ForceIndexPosition
|
||||
| MediaFileHandlingFlags::NormalizeKnownTagFieldIds | MediaFileHandlingFlags::PreserveRawTimingValues)
|
||||
, m_maxFullParseSize(0x3200000)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -187,6 +187,8 @@ public:
|
|||
void setIndexPosition(ElementPosition indexPosition);
|
||||
bool forceIndexPosition() const;
|
||||
void setForceIndexPosition(bool forceTagPosition);
|
||||
std::uint64_t maxFullParseSize() const;
|
||||
void setMaxFullParseSize(std::uint64_t maxFullParseSize);
|
||||
|
||||
protected:
|
||||
void invalidated() override;
|
||||
|
@ -230,6 +232,7 @@ private:
|
|||
ElementPosition m_tagPosition;
|
||||
ElementPosition m_indexPosition;
|
||||
MediaFileHandlingFlags m_fileHandlingFlags;
|
||||
std::uint64_t m_maxFullParseSize;
|
||||
std::unique_ptr<MediaFileInfoPrivate> m_p;
|
||||
};
|
||||
|
||||
|
@ -706,6 +709,33 @@ inline void MediaFileInfo::setForceIndexPosition(bool forceIndexPosition)
|
|||
CppUtilities::modFlagEnum(m_fileHandlingFlags, MediaFileHandlingFlags::ForceIndexPosition, forceIndexPosition);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the maximal file size for a "full parse" in byte.
|
||||
* \remarks
|
||||
* So far this is Matroska-specific: The "Tags" element (which holds the tag information) is commonly at the end
|
||||
* of a Matroska file. Hence the parser needs to walk through the entire file to find the tag information if no
|
||||
* "SeekHead" element is present which might causes long loading times. To avoid this a maximal file size for a
|
||||
* "full parse" can be specified. The disadvantage is that the parser relies on the presence of a SeekHead element
|
||||
* on larger files to retrieve tag information.
|
||||
*
|
||||
* The default value is 50 MiB.
|
||||
*
|
||||
* \sa setMaxFullParseSize()
|
||||
*/
|
||||
inline std::uint64_t MediaFileInfo::maxFullParseSize() const
|
||||
{
|
||||
return m_maxFullParseSize;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the maximal file size for a "full parse" in byte.
|
||||
* \sa maxFullParseSize()
|
||||
*/
|
||||
inline void MediaFileInfo::setMaxFullParseSize(std::uint64_t maxFullParseSize)
|
||||
{
|
||||
m_maxFullParseSize = maxFullParseSize;
|
||||
}
|
||||
|
||||
} // namespace TagParser
|
||||
|
||||
#endif // TAG_PARSER_MEDIAINFO_H
|
||||
|
|
Loading…
Reference in New Issue