From 1c2274cff3c96be57b01dad8fc3b66d34a284d26 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 25 Jul 2003 11:30:06 +0000 Subject: [PATCH] Support for KaxTagMultiLegalContent. --- doc/matroska-tags.xml | 1 + doc/matroskatags.dtd | 3 ++- src/mkvinfo.cpp | 10 ++++++++++ src/tagparser.h | 3 +++ src/tagparser_end.cpp | 3 +++ src/tagparser_start.cpp | 30 +++++++++++++++++++++--------- src/tagwriter.cpp | 3 +++ 7 files changed, 43 insertions(+), 10 deletions(-) diff --git a/doc/matroska-tags.xml b/doc/matroska-tags.xml index ccf90e471..a7ff1f78d 100644 --- a/doc/matroska-tags.xml +++ b/doc/matroska-tags.xml @@ -118,6 +118,7 @@ 3 URL
Address
+ (C) Content diff --git a/doc/matroskatags.dtd b/doc/matroskatags.dtd index 9d244dea5..b365a1765 100644 --- a/doc/matroskatags.dtd +++ b/doc/matroskatags.dtd @@ -159,8 +159,9 @@ Type, URL*, Address?, + Content?, MultiComment*)> - + I_O()); show_element(l5, 5, "URL: %s", string(l_URL).c_str()); + } else if (EbmlId(*l5) == + KaxTagMultiLegalContent:: + ClassInfos.GlobalId) { + KaxTagMultiLegalContent &l_content = + *static_cast(l5); + l_content.ReadData(es->I_O()); + str = UTFstring_to_cstr(UTFstring(l_content)); + show_element(l5, 5, "Content: %s", str); + safefree(str); + } else if (!is_ebmlvoid(l5, 5, upper_lvl_el) && !parse_multicomment(es, l5, 5, upper_lvl_el, l6)) diff --git a/src/tagparser.h b/src/tagparser.h index c90e8f429..cbdc6b227 100644 --- a/src/tagparser.h +++ b/src/tagparser.h @@ -106,6 +106,7 @@ using namespace libmatroska; #define E_MultiLegal 69 #define E_Legal 70 #define E_LegalType 71 +#define E_LegalContent 80 #define E_MultiTitle 72 #define E_Title 73 #define E_TitleType 74 @@ -115,6 +116,8 @@ using namespace libmatroska; #define E_CommentName 78 #define E_Comments 79 +// MAX: 80 + typedef struct { XML_Parser parser; diff --git a/src/tagparser_end.cpp b/src/tagparser_end.cpp index 0d700e5c4..1d0f60906 100644 --- a/src/tagparser_end.cpp +++ b/src/tagparser_end.cpp @@ -496,6 +496,9 @@ void end_level4(parser_data_t *pdata, const char *name) { else if (!strcmp(name, "Address")) el_get_utf8string(pdata, &GetChild (*pdata->legal)); + else if (!strcmp(name, "Content")) + el_get_utf8string(pdata, &GetChild + (*pdata->legal)); } else if (parent == E_Title) { if (!strcmp(name, "Type")) diff --git a/src/tagparser_start.cpp b/src/tagparser_start.cpp index 7fade7430..85ce20297 100644 --- a/src/tagparser_start.cpp +++ b/src/tagparser_start.cpp @@ -203,7 +203,8 @@ void start_level3(parser_data_t *pdata, const char *name) { pdata->track_uid = &GetEmptyChild(*pdata->targets); else pdata->track_uid = - &GetNextEmptyChild(*pdata->targets, *pdata->track_uid); + &GetNextEmptyChild(*pdata->targets, + *pdata->track_uid); pdata->parents->push_back(E_TrackUID); } else if (!strcmp(name, "ChapterUID")) { if (pdata->chapter_uid == NULL) @@ -249,7 +250,8 @@ void start_level3(parser_data_t *pdata, const char *name) { pdata->keywords = &GetEmptyChild(*pdata->general); else pdata->keywords = - &GetNextEmptyChild(*pdata->general, *pdata->keywords); + &GetNextEmptyChild(*pdata->general, + *pdata->keywords); pdata->parents->push_back(E_Keywords); } else if (!strcmp(name, "Mood")) { check_instances(pdata->general, KaxTagMood); @@ -292,14 +294,16 @@ void start_level3(parser_data_t *pdata, const char *name) { pdata->audio_genre = &GetEmptyChild(*pdata->genres); else pdata->audio_genre = - &GetNextEmptyChild(*pdata->genres, *pdata->audio_genre); + &GetNextEmptyChild(*pdata->genres, + *pdata->audio_genre); pdata->parents->push_back(E_AudioGenre); } else if (!strcmp(name, "VideoGenre")) { if (pdata->video_genre == NULL) pdata->video_genre = &GetEmptyChild(*pdata->genres); else pdata->video_genre = - &GetNextEmptyChild(*pdata->genres, *pdata->video_genre); + &GetNextEmptyChild(*pdata->genres, + *pdata->video_genre); pdata->parents->push_back(E_VideoGenre); } else if (!strcmp(name, "SubGenre")) { check_instances(pdata->genres, KaxTagSubGenre); @@ -481,7 +485,8 @@ void start_level4(parser_data_t *pdata, const char *name) { pdata->m_price = &GetEmptyChild(*pdata->commercial); else pdata->m_price = - &GetNextEmptyChild(*pdata->commercial, *pdata->m_price); + &GetNextEmptyChild(*pdata->commercial, + *pdata->m_price); pdata->parents->push_back(E_MultiPrice); } else perror_nochild(); @@ -515,7 +520,8 @@ void start_level4(parser_data_t *pdata, const char *name) { pdata->e_url = &GetEmptyChild(*pdata->entity); else pdata->e_url = - &GetNextEmptyChild(*pdata->entity, *pdata->e_url); + &GetNextEmptyChild(*pdata->entity, + *pdata->e_url); pdata->parents->push_back(E_URL); } else if (!strcmp(name, "Email")) { if (pdata->e_email == NULL) @@ -558,11 +564,15 @@ void start_level4(parser_data_t *pdata, const char *name) { pdata->l_url = &GetEmptyChild(*pdata->legal); else pdata->l_url = - &GetNextEmptyChild(*pdata->legal, *pdata->l_url); + &GetNextEmptyChild(*pdata->legal, + *pdata->l_url); pdata->parents->push_back(E_URL); } else if (!strcmp(name, "Address")) { check_instances(pdata->legal, KaxTagMultiLegalAddress); pdata->parents->push_back(E_Address); + } else if (!strcmp(name, "Content")) { + check_instances(pdata->legal, KaxTagMultiLegalContent); + pdata->parents->push_back(E_LegalContent); } else perror_nochild(); @@ -589,14 +599,16 @@ void start_level4(parser_data_t *pdata, const char *name) { pdata->t_url = &GetEmptyChild(*pdata->title); else pdata->t_url = - &GetNextEmptyChild(*pdata->title, *pdata->t_url); + &GetNextEmptyChild(*pdata->title, + *pdata->t_url); pdata->parents->push_back(E_URL); } else if (!strcmp(name, "Email")) { if (pdata->t_email == NULL) pdata->t_email = &GetEmptyChild(*pdata->title); else pdata->t_email = - &GetNextEmptyChild(*pdata->title, *pdata->t_email); + &GetNextEmptyChild(*pdata->title, + *pdata->t_email); pdata->parents->push_back(E_Email); } else if (!strcmp(name, "Language")) { check_instances(pdata->title, KaxTagMultiTitleLanguage); diff --git a/src/tagwriter.cpp b/src/tagwriter.cpp index a55aa05a7..90459beab 100644 --- a/src/tagwriter.cpp +++ b/src/tagwriter.cpp @@ -203,6 +203,9 @@ static void handle_level4(EbmlElement *e) { else if (is_id(KaxTagMultiLegalAddress)) pr_us("Address"); + + else if (is_id(KaxTagMultiLegalContent)) + pr_us("Content"); else if (is_id(KaxTagMultiTitleType)) pr_ui("Type");