kax_info_cptr ebml_segmentinfo_converter_c::parse_file(std::string const &file_name, bool throw_on_error) { auto parse = [&]() -> std::shared_ptr<KaxInfo> { auto master = ebml_segmentinfo_converter_c{}.to_ebml(file_name, "Info"); fix_mandatory_segmentinfo_elements(master.get()); return std::dynamic_pointer_cast<KaxInfo>(master); }; if (throw_on_error) return parse(); try { return parse(); } catch (mtx::mm_io::exception &ex) { mxerror(boost::format(Y("The XML segmentinfo file '%1%' could not be read.\n")) % file_name); } catch (mtx::xml::xml_parser_x &ex) { mxerror(boost::format(Y("The XML segmentinfo file '%1%' contains an error at position %3%: %2%\n")) % file_name % ex.result().description() % ex.result().offset); } catch (mtx::xml::exception &ex) { mxerror(boost::format(Y("The XML segmentinfo file '%1%' contains an error: %2%\n")) % file_name % ex.what()); } return kax_info_cptr{}; }
void he_top_level_page_c::do_modifications() { he_page_base_c::do_modifications(); if (is_id(m_l1_element, KaxInfo)) fix_mandatory_segmentinfo_elements(m_l1_element); else if (is_id(m_l1_element, KaxTracks)) fix_mandatory_segment_tracks_elements(m_l1_element); m_l1_element->UpdateSize(true); }