mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 20:01:53 +00:00
Automatically add missing/defaulted mandatory elements to the XML output when extracting chapters.
This commit is contained in:
parent
fa59cc4b98
commit
e199b01d2c
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2003-10-26 Moritz Bunkus <moritz@bunkus.org>
|
||||
|
||||
* mkvextract: bug fix: Add all the mandatory elements when
|
||||
extracting chapters so that the resulting XML can always be used
|
||||
directly with mkvmerge again without having to manually add
|
||||
e.g. ChapterLanguage.
|
||||
|
||||
* mkvmerge: bug fix; Handle audio tracks from Matroska files with
|
||||
the CodecID A_MS/ACM correctly.
|
||||
|
||||
2003-10-25 Moritz Bunkus <moritz@bunkus.org>
|
||||
|
||||
* mkvmerge: Changes to use libmatroska's new lacing code.
|
||||
|
@ -196,9 +196,6 @@ void write_chapters_simple(int &chapter_num, KaxChapters *chapters,
|
||||
|
||||
// {{{ XML chapter output
|
||||
|
||||
#define is_id(ref) (e->Generic().GlobalId == ref::ClassInfos.GlobalId)
|
||||
#define is_id2(e, ref) (e->Generic().GlobalId == ref::ClassInfos.GlobalId)
|
||||
|
||||
static FILE *o;
|
||||
|
||||
static void pt(int level, const char *tag) {
|
||||
@ -215,9 +212,12 @@ static void write_chapter_display_xml(KaxChapterDisplay *display, int level) {
|
||||
int i;
|
||||
EbmlElement *e;
|
||||
char *s;
|
||||
bool string_found, language_found;
|
||||
|
||||
pt(level, "<ChapterDisplay>\n");
|
||||
|
||||
language_found = false;
|
||||
string_found = false;
|
||||
for (i = 0; i < display->ListSize(); i++) {
|
||||
e = (*display)[i];
|
||||
if (is_id(KaxChapterString)) {
|
||||
@ -226,11 +226,13 @@ static void write_chapter_display_xml(KaxChapterDisplay *display, int level) {
|
||||
<EbmlUnicodeString *>(e)).c_str());
|
||||
mxprint(o, "%s</ChapterString>\n", s);
|
||||
safefree(s);
|
||||
string_found = true;
|
||||
|
||||
} else if (is_id(KaxChapterLanguage)) {
|
||||
pt(level + 1, "<ChapterLanguage>");
|
||||
mxprint(o, "%s</ChapterLanguage>\n", string(*static_cast
|
||||
<EbmlString *>(e)).c_str());
|
||||
language_found = true;
|
||||
|
||||
|
||||
} else if (is_id(KaxChapterCountry)) {
|
||||
@ -244,6 +246,11 @@ static void write_chapter_display_xml(KaxChapterDisplay *display, int level) {
|
||||
|
||||
}
|
||||
|
||||
if (!string_found)
|
||||
pt(level + 1, "<ChapterString></ChapterString>\n");
|
||||
if (!language_found)
|
||||
pt(level + 1, "<ChapterLanguage>eng</ChapterLanguage>\n");
|
||||
|
||||
pt(level, "</ChapterDisplay>\n");
|
||||
}
|
||||
|
||||
@ -272,9 +279,11 @@ static void write_chapter_atom_xml(KaxChapterAtom *atom, int level) {
|
||||
int i;
|
||||
EbmlElement *e;
|
||||
uint64_t v;
|
||||
bool start_time_found;
|
||||
|
||||
pt(level, "<ChapterAtom>\n");
|
||||
|
||||
start_time_found = false;
|
||||
for (i = 0; i < atom->ListSize(); i++) {
|
||||
e = (*atom)[i];
|
||||
if (is_id(KaxChapterUID)) {
|
||||
@ -288,6 +297,7 @@ static void write_chapter_atom_xml(KaxChapterAtom *atom, int level) {
|
||||
mxprint(o, "%02llu:%02llu:%02llu.%03llu</ChapterTimeStart>\n",
|
||||
v / 1000 / 60 / 60, (v / 1000 / 60) % 60, (v / 1000) % 60,
|
||||
v % 1000);
|
||||
start_time_found = true;
|
||||
|
||||
} else if (is_id(KaxChapterTimeEnd)) {
|
||||
pt(level + 1, "<ChapterTimeEnd>");
|
||||
@ -307,6 +317,9 @@ static void write_chapter_atom_xml(KaxChapterAtom *atom, int level) {
|
||||
|
||||
}
|
||||
|
||||
if (!start_time_found)
|
||||
pt(level + 1, "<ChapterTimeStart>00:00:00.000</ChapterTimeStart>\n");
|
||||
|
||||
pt(level, "</ChapterAtom>\n");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user