mkvmerge: don't add chapter names if generation name template is empty

Part of the implementation of #2275.
This commit is contained in:
Moritz Bunkus 2018-08-21 13:53:46 +02:00
parent 64a52f7590
commit 964042cf30
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
4 changed files with 24 additions and 4 deletions

View File

@ -7,6 +7,10 @@
* MKVToolNix GUI: the GUI will no longer automatically resize the columns in
tree and list views to match the content size. Instead it remembers and
restores the widths set by the user. Implements #2353.
* mkvmerge: chapter generation: if the name template given by
`--generate-chapters-name-template` is empty, no names (`ChapterDisplay`
master elements with `ChapterString`/`ChapterLanguage` children) will be
generated for the chapter atoms. Part of the implementation of #2275.
## Bug fixes

View File

@ -1383,9 +1383,11 @@ prepare_additional_chapter_atoms_for_rendering() {
for (auto const &additional_chapter : s_additional_chapter_atoms) {
auto atom = cons<KaxChapterAtom>(new KaxChapterUID, create_unique_number(UNIQUE_CHAPTER_IDS),
new KaxChapterTimeStart, (std::get<0>(additional_chapter) - offset).to_ns(),
cons<KaxChapterDisplay>(new KaxChapterString, std::get<1>(additional_chapter),
new KaxChapterLanguage, std::get<2>(additional_chapter)));
new KaxChapterTimeStart, (std::get<0>(additional_chapter) - offset).to_ns());
if (!std::get<1>(additional_chapter).empty())
atom->PushElement(*cons<KaxChapterDisplay>(new KaxChapterString, std::get<1>(additional_chapter),
new KaxChapterLanguage, std::get<2>(additional_chapter)));
edition.PushElement(*atom);
}

View File

@ -154,7 +154,7 @@ T_305ui_locale_en_US:23026ac2ed9767541e89f2261bcf8b60-0136434e2e22ebcc806ee944cd
T_306ui_locale_de_DE:5c2281373b0f5d9d7145cca6b2391db7-fe29d5dd8da942a9deb4aac92b2f0514:passed:20111016-192531:0.06032807
T_307ui_locale_es_ES:3f230a5da62a4650a8874bde6cb3c0e7-343c6efff52830d0484900df270904fb:passed:20111016-192531:0.061216592
T_308ui_locale_fr_FR:e2ca7f37e22b01b97a3895258fa753e8-8f926266b31c591810d92b84e2bbaa81:passed:20111016-192531:0.139937014
T_309ui_locale_it_IT:a668340c643c0975e8df7977ffbdacde-c1f64d8ae20baee5fd96efac1df1bf29:passed:20111016-192531:0.075701663
T_309ui_locale_it_IT:a668340c643c0975e8df7977ffbdacde-c1f64d8ae20baee5fd96efac1df1bf29:failed:20111016-192531:0.075701663
T_310ui_locale_ja_JP:bbd7198ee176df0a36ae6818471e4204-77e6f10efd219fb9ae9e79254cee32b6:passed:20111016-192531:0.070177897
T_311ui_locale_lt_LT:23026ac2ed9767541e89f2261bcf8b60-0136434e2e22ebcc806ee944cdd2b853:passed:20111016-192531:0.054643172
T_312ui_locale_nl_NL:df36526d5fccc2757166fc6cf2455060-82da9222562a7c5746bf76ec6ae82c1e:passed:20111016-192532:0.061745399
@ -495,3 +495,4 @@ T_646ogg_opus_gap_page_missing:c3c8ff65984de89ce37c2f03520ae83f:passed:20180621-
T_647recode_textsubs_from_matroska:2e63dc90381d8f5191b852aac6cc3b05-b297cba0182c465fa537abd668f1e6a0:passed:20180621-194122:0.024017386
T_648append_matroska_first_timestamp_not_zero:80d6193277012fde546499d832b4bab3:passed:20180724-210331:0.023501574
T_649unsupported_file_types:ok-ok-ok-ok-ok:passed:20180806-201225:0.045725267
T_650chapter_generation_no_names:65b6db53e376326e7e2f3d1c04caf63d-ok:passed:20180821-140249:0.030599141

View File

@ -0,0 +1,13 @@
#!/usr/bin/ruby -w
# T_650chapter_generation_no_names
describe "mkvmerge / generate chapters without names"
test_merge "data/simple/v.mp3", args: "--generate-chapters interval:10s --generate-chapters-name-template ''", :keep_tmp => true
test :chapter_names do
extract "#{tmp} > #{tmp}-2", :mode => :chapters
content = IO.readlines("#{tmp}-2").join("")
ok = %r{ChapterAtom}.match(content) && !%r{Chapter(Display|String|Language)}.match(content)
fail "chapter content is bad" if !ok
"ok"
end