chapter handling: don't drop sub-chapters while merging chapters

This commit is contained in:
Moritz Bunkus 2015-02-02 21:47:39 +01:00
parent f7abfaa8ab
commit 690e0f6ee1
4 changed files with 25 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2015-02-02 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: Appending chapters with the same chapter UID
was dropping all sub-chapters from the one of the two merged
chapters. Now the sub-chapters are merged recursively as well.
* mkvmerge: bug fix: The wrong Codec ID was written when reading
PCM tracks from Matroska files in Big Endian byte order. Fixes
#1113.

View File

@ -743,6 +743,21 @@ merge_chapter_entries(EbmlMaster &master) {
if ((-1 == end_tc) || (merge_end_tc > end_tc))
end_tc = merge_end_tc;
// Move all chapter atoms from the merged entry into the target
// entry so that they will be merged recursively as well.
auto merge_child_idx = 0u;
auto num_children = merge_this->ListSize();
while (merge_child_idx < num_children) {
if (Is<KaxChapterAtom>((*merge_this)[merge_child_idx])) {
atom->PushElement(*(*merge_this)[merge_child_idx]);
merge_this->Remove(merge_child_idx);
--num_children;
} else
++merge_child_idx;
}
mxverb(3, boost::format("chapters: merge_entries: found one at %1% with %2%, %3%; merged to %4%, %5%\n") % merge_idx % merge_start_tc % merge_end_tc % start_tc % end_tc);
// Finally remove the entry itself.

View File

@ -304,3 +304,4 @@ T_455he_aacv2_ps:2fbfac35fa7785f8e500f1708da4ec4f:passed:20150101-152553:0.07596
T_456tta:4b92a305f440778a3128685cefd4bd5d-a3f2a14c15e709027c05445ac91b0659:passed:20150103-140714:0.148697252
T_457mpeg_ts_all_pmts_with_crc_errors:0fefd1b95985d5f5deea17d20e05f6e9:passed:20150104-133628:1.586689715
T_458pcm_big_endian_in_matroska:c83ea37c1a80696b342859467d863f2a:passed:20150202-193826:0.080955865
T_459append_chapters_same_uid_with_sub_chapters:656362feddd9e89d28df6078361bf9d0:passed:20150202-214722:0.072671062

View File

@ -0,0 +1,5 @@
#!/usr/bin/ruby -w
# T_459append_chapters_same_uid_with_sub_chapters
describe "mkvmerge / append chapters with the same UIDs containing sub-chapters"
test_merge "data/mkv/split-with-sub-chapters-001.mka + data/mkv/split-with-sub-chapters-002.mka"