vttdemux: add support for WebVTT chapters
Change-Id: If5e12ff7057ce4217907ef91d493e1bcd8a72656
This commit is contained in:
@@ -4526,6 +4526,18 @@ long long Chapters::Atom::GetStopTimecode() const
|
||||
}
|
||||
|
||||
|
||||
long long Chapters::Atom::GetStartTime(const Chapters* pChapters) const
|
||||
{
|
||||
return GetTime(pChapters, m_start_timecode);
|
||||
}
|
||||
|
||||
|
||||
long long Chapters::Atom::GetStopTime(const Chapters* pChapters) const
|
||||
{
|
||||
return GetTime(pChapters, m_stop_timecode);
|
||||
}
|
||||
|
||||
|
||||
int Chapters::Atom::GetDisplayCount() const
|
||||
{
|
||||
return m_displays_count;
|
||||
@@ -4651,6 +4663,37 @@ long Chapters::Atom::Parse(
|
||||
}
|
||||
|
||||
|
||||
long long Chapters::Atom::GetTime(
|
||||
const Chapters* pChapters,
|
||||
long long timecode)
|
||||
{
|
||||
if (pChapters == NULL)
|
||||
return -1;
|
||||
|
||||
Segment* const pSegment = pChapters->m_pSegment;
|
||||
|
||||
if (pSegment == NULL) // weird
|
||||
return -1;
|
||||
|
||||
const SegmentInfo* const pInfo = pSegment->GetInfo();
|
||||
|
||||
if (pInfo == NULL)
|
||||
return -1;
|
||||
|
||||
const long long timecode_scale = pInfo->GetTimeCodeScale();
|
||||
|
||||
if (timecode_scale < 1) // weird
|
||||
return -1;
|
||||
|
||||
if (timecode < 0)
|
||||
return -1;
|
||||
|
||||
const long long result = timecode_scale * timecode;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
long Chapters::Atom::ParseDisplay(
|
||||
IMkvReader* pReader,
|
||||
long long pos,
|
||||
|
||||
Reference in New Issue
Block a user