]> git.decadent.org.uk Git - videolink.git/blobdiff - generate_dvd.cpp
Corrected formula in menu_duration_seconds. It looks like any sufficiently large...
[videolink.git] / generate_dvd.cpp
index 7f496c23e2b2a71d97411f80f6f27308b475ed1b..5d357e6d39c385fe6eb76a89551bd5c115340e64 100644 (file)
@@ -88,8 +88,8 @@ namespace
     double menu_duration_seconds(const video::frame_params & params)
     {
        return double(menu_duration_frames(params))
-           * double(params.rate_numer)
-           / double(params.rate_denom);
+           / double(params.rate_numer)
+           * double(params.rate_denom);
     }
 
     void throw_length_error(const char * limit_type, std::size_t limit)
@@ -98,6 +98,13 @@ namespace
        oss << "exceeded DVD limit: " << limit_type << " > " << limit;
        throw std::length_error(oss.str());
     }
+
+    // dvdauthor uses some menu numbers to represent entry points -
+    // distinct from the actual numbers of the menus assigned as those
+    // entry points - resulting in a practical limit of 119 per
+    // domain.  This seems to be an oddity of the parser that could be
+    // fixed, but for now we'll have to work with it.
+    const unsigned dvdauthor_anonymous_menus_max = dvd::domain_pgcs_max - 8;
 }
 
 dvd_generator::dvd_generator(const video::frame_params & frame_params,
@@ -111,8 +118,8 @@ dvd_generator::pgc_ref dvd_generator::add_menu()
 {
     pgc_ref next_menu(menu_pgc, menus_.size());
 
-    if (next_menu.index == dvd::domain_pgcs_max)
-       throw_length_error("number of menus", dvd::domain_pgcs_max);
+    if (next_menu.index == dvdauthor_anonymous_menus_max)
+       throw_length_error("number of menus", dvdauthor_anonymous_menus_max);
 
     menus_.resize(next_menu.index + 1);
     return next_menu;