From f4d1a9d351d7d0db38507c9ab58f38a02ae2077f Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 7 Jun 2005 09:05:44 +0000 Subject: [PATCH] If a OGM style chapter file contains empty chapter names ("CHAPTER01NAME=" without something after the "=") then this chapter's timecode is used as the name instead of aborting. --- ChangeLog | 7 +++++++ src/common/chapters.cpp | 10 ++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8a06becf9..6f6370510 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-06-07 Moritz Bunkus + + * mkvmerge: bug fix: If a OGM style chapter file contains empty + chapter names ('CHAPTER01NAME=' without something after the '=') + then this chapter's timecode is used as the name instead of + aborting. + 2005-06-05 Moritz Bunkus * mkvmerge: new feature: Added splitting after specific diff --git a/src/common/chapters.cpp b/src/common/chapters.cpp index 06c08ba79..85d76cd88 100644 --- a/src/common/chapters.cpp +++ b/src/common/chapters.cpp @@ -58,12 +58,11 @@ string default_chapter_country; isseparator(s + 18) && \ isthreedigits(s + 19)) /** Does \c s point to a valid OGM style chapter name entry? */ -#define ischapternameline(s) ((strlen(s) >= 15) && \ +#define ischapternameline(s) ((strlen(s) >= 14) && \ ischapter(s) && \ istwodigits(s + 7) && \ isname(s + 9) && \ - isequal(s + 13) && \ - !isblanktab(*(s + 14))) + isequal(s + 13)) /** \brief Format an error message and throw an exception. @@ -187,7 +186,7 @@ parse_simple_chapters(mm_text_io_c *in, KaxChapterAtom *atom; KaxChapterDisplay *display; int64_t start, hour, minute, second, msecs; - string name, line, use_language; + string name, line, use_language, s_timecode; int mode, num, cc_utf8; bool do_convert; UTFstring wchar_string; @@ -247,11 +246,14 @@ parse_simple_chapters(mm_text_io_c *in, start = msecs + second * 1000 + minute * 1000 * 60 + hour * 1000 * 60 * 60; mode = 1; + s_timecode = line.substr(10); } else { if (!ischapternameline(line.c_str())) chapter_error("'%s' is not a CHAPTERxxNAME=... line.", line.c_str()); name = line.substr(14); + if (name == "") + name = s_timecode; mode = 0; if ((start >= min_tc) && ((start <= max_tc) || (max_tc == -1))) {