Scale the duration to ns precision when reading Matroska files.

This commit is contained in:
Moritz Bunkus 2004-02-11 08:12:09 +00:00
parent d9587bd3c1
commit 670d896647
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2004-02-11 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: When reading Matroska files the durations
attached to blocks were lost (e.g. for subtitle tracks).
2004-02-09 Moritz Bunkus <moritz@bunkus.org> 2004-02-09 Moritz Bunkus <moritz@bunkus.org>
* Released v0.8.3. * Released v0.8.3.

View File

@ -1655,7 +1655,7 @@ kax_reader_c::read(generic_packetizer_c *) {
duration = static_cast<KaxBlockDuration *> duration = static_cast<KaxBlockDuration *>
(block_group->FindFirstElt(KaxBlockDuration::ClassInfos, false)); (block_group->FindFirstElt(KaxBlockDuration::ClassInfos, false));
if (duration != NULL) if (duration != NULL)
block_duration = (int64_t)uint64(*duration) / block_duration = (int64_t)uint64(*duration) * tc_scale /
block->NumberFrames(); block->NumberFrames();
else if (block_track->v_frate != 0) else if (block_track->v_frate != 0)
block_duration = (int64_t)(1000000000.0 / block_track->v_frate); block_duration = (int64_t)(1000000000.0 / block_track->v_frate);
@ -1679,7 +1679,7 @@ kax_reader_c::read(generic_packetizer_c *) {
duration = static_cast<KaxBlockDuration *> duration = static_cast<KaxBlockDuration *>
(block_group->FindFirstElt(KaxBlockDuration::ClassInfos, false)); (block_group->FindFirstElt(KaxBlockDuration::ClassInfos, false));
if (duration != NULL) if (duration != NULL)
block_duration = (int64_t)uint64(*duration) / block_duration = (int64_t)uint64(*duration) * tc_scale /
block->NumberFrames(); block->NumberFrames();
else if (block_track->v_frate != 0) else if (block_track->v_frate != 0)
block_duration = (int64_t)(1000000000.0 / block_track->v_frate); block_duration = (int64_t)(1000000000.0 / block_track->v_frate);