MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / chapter_list_export_xml

Function chapter_list_export_xml

gtk/src/chapters.c:203–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203static void
204chapter_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
231static void
232chapter_list_export (GtkFileChooser *chooser,

Callers 1

chapter_list_exportFunction · 0.85

Calls 3

pts_to_xml_timeFunction · 0.85
chapter_time_endFunction · 0.85
ghb_dict_get_stringFunction · 0.85

Tested by

no test coverage detected