| 201 | } |
| 202 | |
| 203 | static void |
| 204 | chapter_list_export_xml (const gchar *filename, GhbValue *chapter_dict) |
| 205 | { |
| 206 | GhbValue *chapter; |
| 207 | xmlDocPtr doc; |
| 208 | xmlNodePtr node, node2, node3; |
| 209 | int n_chapters; |
| 210 | gint64 time_pts = 0; |
| 211 | |
| 212 | n_chapters = ghb_array_len(chapter_dict); |
| 213 | doc = xmlNewDoc((const xmlChar *) "1.0"); |
| 214 | xmlCreateIntSubset(doc, (const xmlChar *) "Chapters", NULL, (const xmlChar *) "matroskachapters.dtd"); |
| 215 | node = xmlNewDocNode(doc, NULL, (const xmlChar *) "Chapters", NULL); |
| 216 | xmlDocSetRootElement(doc, node); |
| 217 | node = xmlNewChild(node, NULL, (const xmlChar *) "EditionEntry", NULL); |
| 218 | for (int index = 0; index < n_chapters; index++) |
| 219 | { |
| 220 | chapter = ghb_array_get(chapter_dict, index); |
| 221 | node2 = xmlNewChild(node, NULL, (const xmlChar *) "ChapterAtom", NULL); |
| 222 | xmlNewChild(node2, NULL, (const xmlChar *) "ChapterTimeStart", (const xmlChar *) pts_to_xml_time(time_pts)); |
| 223 | xmlNewChild(node2, NULL, (const xmlChar *) "ChapterTimeEnd", (const xmlChar *) chapter_time_end(chapter, &time_pts)); |
| 224 | node3 = xmlNewChild(node2, NULL, (const xmlChar *) "ChapterDisplay", NULL); |
| 225 | xmlNewChild(node3, NULL, (const xmlChar *) "ChapterString", (const xmlChar *) ghb_dict_get_string(chapter, "Name")); |
| 226 | } |
| 227 | xmlSaveFormatFileEnc(filename, doc, "UTF-8", 1); |
| 228 | xmlFreeDoc(doc); |
| 229 | } |
| 230 | |
| 231 | static void |
| 232 | chapter_list_export (GtkFileChooser *chooser, |
no test coverage detected