summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2006-09-05 13:25:25 +0000
committerBastien Nocera <hadess@src.gnome.org>2006-09-05 13:25:25 +0000
commitb55960997c07fef6a87a57de66352b19e0daa605 (patch)
treed6a7cf537adad096c07c62558dde8516353dbd08
parent4b1041a90eb5246a0d9cb758f8b345fe8ee538e5 (diff)
downloadtotem-b55960997c07fef6a87a57de66352b19e0daa605.tar.gz
Use the top-level title from the SMIL playlist if there isn't an
2006-09-05 Bastien Nocera <hadess@hadess.net> * src/plparse/totem-pl-parser.c: (parse_smil_entry), (parse_smil_head), (parse_smil_entries): Use the top-level title from the SMIL playlist if there isn't an entry-specific one (Closes: #329451)
-rw-r--r--ChangeLog7
-rw-r--r--src/plparse/totem-pl-parser.c42
2 files changed, 44 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 145641a60..84ad01c47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2006-09-05 Bastien Nocera <hadess@hadess.net>
+ * src/plparse/totem-pl-parser.c: (parse_smil_entry),
+ (parse_smil_head), (parse_smil_entries): Use the top-level
+ title from the SMIL playlist if there isn't an entry-specific
+ one (Closes: #329451)
+
+2006-09-05 Bastien Nocera <hadess@hadess.net>
+
* src/plparse/totem-pl-parser.c: (totem_pl_parser_is_asf):
Fix possible buffer overflow that would cause a crash in the
ASF recognition code (Closes: #354284)
diff --git a/src/plparse/totem-pl-parser.c b/src/plparse/totem-pl-parser.c
index 478541803..cf7d0eb08 100644
--- a/src/plparse/totem-pl-parser.c
+++ b/src/plparse/totem-pl-parser.c
@@ -1553,7 +1553,7 @@ parse_smil_video_entry (TotemPlParser *parser, char *base,
static gboolean
parse_smil_entry (TotemPlParser *parser, char *base, xmlDocPtr doc,
- xmlNodePtr parent)
+ xmlNodePtr parent, xmlChar *parent_title)
{
xmlNodePtr node;
xmlChar *title, *url;
@@ -1574,7 +1574,9 @@ parse_smil_entry (TotemPlParser *parser, char *base, xmlDocPtr doc,
if (url != NULL) {
if (parse_smil_video_entry (parser,
- base, (char *)url, (char *)title) != FALSE)
+ base, (char *)url,
+ title ? (char *)title
+ : (char *)parent_title) != FALSE)
retval = TOTEM_PL_PARSER_RESULT_SUCCESS;
}
@@ -1584,7 +1586,7 @@ parse_smil_entry (TotemPlParser *parser, char *base, xmlDocPtr doc,
xmlFree (url);
} else {
if (parse_smil_entry (parser,
- base, doc, node) != FALSE)
+ base, doc, node, parent_title) != FALSE)
retval = TOTEM_PL_PARSER_RESULT_SUCCESS;
}
}
@@ -1592,12 +1594,37 @@ parse_smil_entry (TotemPlParser *parser, char *base, xmlDocPtr doc,
return retval;
}
+static xmlChar *
+parse_smil_head (TotemPlParser *parser, xmlDocPtr doc, xmlNodePtr parent)
+{
+ xmlNodePtr node;
+ xmlChar *title = NULL;
+
+ for (node = parent->children; node != NULL; node = node->next) {
+ if (g_ascii_strcasecmp ((char *)node->name, "meta") == 0) {
+ xmlChar *prop;
+ prop = xmlGetProp (node, (const xmlChar *)"name");
+ if (prop != NULL && g_ascii_strcasecmp ((char *)prop, "title") == 0) {
+ title = xmlGetProp (node, (const xmlChar *)"content");
+ if (title != NULL) {
+ xmlFree (prop);
+ break;
+ }
+ }
+ xmlFree (prop);
+ }
+ }
+
+ return title;
+}
+
static gboolean
parse_smil_entries (TotemPlParser *parser, char *base, xmlDocPtr doc,
xmlNodePtr parent)
{
xmlNodePtr node;
TotemPlParserResult retval = TOTEM_PL_PARSER_RESULT_ERROR;
+ xmlChar *title = NULL;
for (node = parent->children; node != NULL; node = node->next) {
if (node->name == NULL)
@@ -1605,12 +1632,17 @@ parse_smil_entries (TotemPlParser *parser, char *base, xmlDocPtr doc,
if (g_ascii_strcasecmp ((char *)node->name, "body") == 0) {
if (parse_smil_entry (parser, base,
- doc, node) != FALSE)
+ doc, node, title) != FALSE)
retval = TOTEM_PL_PARSER_RESULT_SUCCESS;
+ } else if (title == NULL) {
+ if (g_ascii_strcasecmp ((char *)node->name, "head") == 0)
+ title = parse_smil_head (parser, doc, node);
}
-
}
+ if (title != NULL)
+ xmlFree (title);
+
return retval;
}