From a80fac0c4fed899cd5f7503cf4080c30f611e341 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 21 Dec 2005 02:41:49 +0000 Subject: [PATCH] Changed webdvd_window::generate_dvd() into a free function. --- webdvd.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/webdvd.cpp b/webdvd.cpp index 26e4260..e809968 100644 --- a/webdvd.cpp +++ b/webdvd.cpp @@ -202,6 +202,9 @@ namespace std::vector titles; }; + void generate_dvd(const dvd_contents & contents, + const std::string & output_dir); + class webdvd_window : public Gtk::Window { public: @@ -224,7 +227,6 @@ namespace void process_links(nsIPresShell * pres_shell, nsIPresContext * pres_context, nsIDOMWindow * dom_window); - void generate_dvd(); video::frame_params frame_params_; std::string output_dir_; @@ -481,7 +483,7 @@ namespace page_queue_.pop(); if (page_queue_.empty()) { - generate_dvd(); + generate_dvd(contents_, output_dir_); return false; } else @@ -798,7 +800,8 @@ namespace } } - void webdvd_window::generate_dvd() + void generate_dvd(const dvd_contents & contents, + const std::string & output_dir) { temp_file temp("webdvd-dvdauthor-"); temp.close(); @@ -826,10 +829,10 @@ namespace " <menus>\n"; for (std::size_t menu_num = 0; - menu_num != contents_.menus.size(); + menu_num != contents.menus.size(); ++menu_num) { - dvd_contents::menu & menu = contents_.menus[menu_num]; + const dvd_contents::menu & menu = contents.menus[menu_num]; if (menu_num == 0) { @@ -875,7 +878,7 @@ namespace menu_incr != 0; menu_incr /= 2) { - if (menu_num + menu_incr < contents_.menus.size() + if (menu_num + menu_incr < contents.menus.size() && (menu_num & (menu_incr * 2 - 1)) == 0) { file << @@ -908,7 +911,7 @@ namespace // first button. const std::vector<dvd_contents::pgc_ref> & dest_menu_entries = - contents_.menus[dest_menu_num].entries; + contents.menus[dest_menu_num].entries; dvd_contents::pgc_ref this_pgc( dvd_contents::menu_pgc, menu_num); std::size_t dest_button_num = dest_menu_entries.size(); @@ -946,7 +949,7 @@ namespace // jumping to titles a whole lot simpler (but limits us to 99 // titles). for (std::size_t title_num = 0; - title_num != contents_.titles.size(); + title_num != contents.titles.size(); ++title_num) { file << @@ -962,7 +965,7 @@ namespace " <pgc>\n" // Record calling location. " <pre> g12 = g1; </pre>\n" - << contents_.titles[title_num].vob_list << + << contents.titles[title_num].vob_list << // If the menu location has not been changed during // the title, set the location to be the following // button in the menu. In any case, return to some @@ -982,7 +985,7 @@ namespace { const char * argv[] = { "dvdauthor", - "-o", output_dir_.c_str(), + "-o", output_dir.c_str(), "-x", temp.get_name().c_str(), 0 }; -- 2.39.5