Added support for SimpleBlocks for timecode extraction mode.

This commit is contained in:
Moritz Bunkus 2008-09-22 17:22:37 +00:00
parent c79e4235de
commit c2e680ba3f
2 changed files with 33 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2008-09-22 Moritz Bunkus <moritz@bunkus.org>
* mkvextract: new feature: Added support for handling SimpleBlocks
for timecode extraction.
2008-09-21 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: Reading raw (E)AC3 files bigger than 2 GB was

View File

@ -162,6 +162,28 @@ handle_blockgroup(KaxBlockGroup &blockgroup,
block->NumberFrames()));
}
static void
handle_simpleblock(KaxSimpleBlock &simpleblock,
KaxCluster &cluster) {
if (0 == simpleblock.NumberFrames())
return;
simpleblock.SetParent(cluster);
vector<timecode_extractor_t>::iterator extractor;
// Do we need this simple block?
mxforeach(extractor, timecode_extractors)
if (simpleblock.TrackNum() == extractor->m_tid)
break;
if (timecode_extractors.end() == extractor)
return;
// Pass the block to the extractor.
int i;
for (i = 0; simpleblock.NumberFrames() > i; ++i)
extractor->m_timecodes.push_back((int64_t)(simpleblock.GlobalTimecode() + i * (double)extractor->m_default_duration));
}
void
extract_timecodes(const string &file_name,
vector<track_spec_t> &tspecs,
@ -303,6 +325,12 @@ extract_timecodes(const string &file_name,
handle_blockgroup(*static_cast<KaxBlockGroup *>(l2), *cluster,
tc_scale);
} else if (EbmlId(*l2) == KaxSimpleBlock::ClassInfos.GlobalId) {
show_element(l2, 2, _("Simple block"));
l2->Read(*es, KaxSimpleBlock::ClassInfos.Context, upper_lvl_el, l3, true);
handle_simpleblock(*static_cast<KaxSimpleBlock *>(l2), *cluster);
} else
l2->SkipData(*es, l2->Generic().Context);