Merged 2109

This commit is contained in:
Moritz Bunkus 2004-08-29 21:29:31 +00:00
parent 13a621c0c3
commit 194e6e1205
2 changed files with 56 additions and 30 deletions

View File

@ -1,3 +1,14 @@
2004-08-29 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: new feature: The chapter and tag parsers accept XML
element attributes instead of sub-elements for those sub-elements
that only contain data. Example for a "simple tag":
<Simple Name="ARTIST" String="Tori Amos"/>
* mkvmerge: bug fix: The automatic MIME type detection based on
the file name extension was using the file name extension as the
MIME type.
2004-08-28 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge, mkvinfo: new feature: Added the four new PixelCrop

View File

@ -197,41 +197,17 @@ add_data(void *user_data,
(*pdata->bin) += s[i];
}
static void end_element(void *user_data, const char *name);
static void
start_element(void *user_data,
const char *name,
const char **atts) {
parser_data_t *pdata;
add_new_element(parser_data_t *pdata,
const char *name,
int parent_idx) {
EbmlElement *e;
EbmlMaster *m;
int elt_idx, parent_idx, i;
int elt_idx, i;
bool found;
pdata = (parser_data_t *)user_data;
if (atts[0] != NULL)
xmlp_error(pdata, "Attributes are not allowed.");
if (pdata->data_allowed)
xmlp_error(pdata, "<%s> is not a valid child element of <%s>.", name,
xmlp_pname);
pdata->data_allowed = false;
if (pdata->bin != NULL)
die("start_element: pdata->bin != NULL");
if (pdata->depth == 0) {
if (pdata->done_reading)
xmlp_error(pdata, "More than one root element found.");
if (strcmp(name, pdata->mapping[0].name))
xmlp_error(pdata, "The root element must be <%s>.",
pdata->mapping[0].name);
parent_idx = 0;
} else
parent_idx = (*pdata->parent_idxs)[pdata->parent_idxs->size() - 1];
elt_idx = parent_idx;
found = false;
while (pdata->mapping[elt_idx].name != NULL) {
@ -299,6 +275,45 @@ start_element(void *user_data,
(pdata->depth)++;
}
static void
start_element(void *user_data,
const char *name,
const char **atts) {
parser_data_t *pdata;
int parent_idx, i;
pdata = (parser_data_t *)user_data;
if (pdata->data_allowed)
xmlp_error(pdata, "<%s> is not a valid child element of <%s>.", name,
xmlp_pname);
pdata->data_allowed = false;
if (pdata->bin != NULL)
die("start_element: pdata->bin != NULL");
if (pdata->depth == 0) {
if (pdata->done_reading)
xmlp_error(pdata, "More than one root element found.");
if (strcmp(name, pdata->mapping[0].name))
xmlp_error(pdata, "The root element must be <%s>.",
pdata->mapping[0].name);
parent_idx = 0;
} else
parent_idx = (*pdata->parent_idxs)[pdata->parent_idxs->size() - 1];
add_new_element(pdata, name, parent_idx);
parent_idx = (*pdata->parent_idxs)[pdata->parent_idxs->size() - 1];
for (i = 0; (atts[i] != NULL) && (atts[i + 1] != NULL); i += 2) {
pdata->bin = new string(atts[i + 1]);
add_new_element(pdata, atts[i], parent_idx);
end_element(pdata, atts[i]);
}
}
static void
end_element(void *user_data,
const char *name) {