static void run(options_cptr &options) { console_kax_analyzer_cptr analyzer; try { if (!kax_analyzer_c::probe(options->m_file_name)) mxerror(boost::format("The file '%1%' is not a Matroska file or it could not be found.\n") % options->m_file_name); analyzer = console_kax_analyzer_cptr(new console_kax_analyzer_c(options->m_file_name)); } catch (mtx::mm_io::exception &ex) { mxerror(boost::format("The file '%1%' could not be opened for reading and writing: %1.\n") % options->m_file_name % ex); } mxinfo(boost::format("%1%\n") % Y("The file is being analyzed.")); analyzer->set_show_progress(options->m_show_progress); bool ok = false; try { ok = analyzer ->set_parse_mode(options->m_parse_mode) .set_open_mode(MODE_WRITE) .set_throw_on_error(true) .process(); } catch (mtx::mm_io::exception &ex) { mxerror(boost::format(Y("The file '%1%' could not be opened for reading and writing, or a read/write operation on it failed: %2%.\n")) % options->m_file_name % ex); } catch (...) { } if (!ok) mxerror(Y("This file could not be opened or parsed.\n")); options->find_elements(analyzer.get()); options->validate(); if (debugging_c::requested("dump_options")) { mxinfo("\nDumping options after file and element analysis\n\n"); options->dump_info(); } options->execute(*analyzer); if (has_content_been_modified(options)) { mxinfo(Y("The changes are written to the file.\n")); write_changes(options, analyzer.get()); mxinfo(Y("Done.\n")); } else mxinfo(Y("No changes were made.\n")); mxexit(); }
static void run(options_cptr &options) { console_kax_analyzer_cptr analyzer; try { if (!kax_analyzer_c::probe(options->m_file_name)) mxerror(boost::format("The file '%1%' is not a Matroska file or it could not be found.\n") % options->m_file_name); analyzer = console_kax_analyzer_cptr(new console_kax_analyzer_c(options->m_file_name)); } catch (...) { mxerror(boost::format("The file '%1%' could not be opened for read/write access.\n") % options->m_file_name); } mxinfo(Y("The file is analyzed.\n")); analyzer->set_show_progress(options->m_show_progress); if (!analyzer->process(options->m_parse_mode)) mxerror(Y("This file could not be opened or parsed.\n")); options->find_elements(analyzer.get_object()); options->validate(); if (debugging_requested("dump_options")) { mxinfo("\nDumping options after file and element analysis\n\n"); options->dump_info(); } options->execute(); mxinfo(Y("The changes are written to the file.\n")); write_changes(options, analyzer.get_object()); mxinfo(Y("Done.\n")); mxexit(0); }