- command_stream << "pngtopnm "
- << background_temp_->get_name()
- << " | ppmtoy4m -v0 -n1 -F"
- << frame_params_.rate_numer
- << ":" << frame_params_.rate_denom
- << " -A" << frame_params_.pixel_ratio_width
- << ":" << frame_params_.pixel_ratio_height
- << (" -Ip -S420_mpeg2"
- " | mpeg2enc -v0 -f8 -a2 -o/dev/stdout"
- " | mplex -v0 -f8 -o/dev/stdout /dev/stdin"
- " | spumux -v0 -mdvd ")
- << state->spumux_temp.get_name()
- << " > "
- << contents_.menus[menu_num].vob_temp->get_name();
- std::string command(command_stream.str());
- const char * argv[] = {
- "/bin/sh", "-c", command.c_str(), 0
- };
- std::cout << "running " << argv[2] << std::endl;
- int command_result;
- Glib::spawn_sync(".",
- Glib::ArrayHandle<std::string>(
- argv, sizeof(argv)/sizeof(argv[0]),
- Glib::OWNERSHIP_NONE),
- Glib::SPAWN_STDOUT_TO_DEV_NULL,
- SigC::Slot0<void>(),
- 0, 0,
- &command_result);
- if (command_result != 0)
- throw std::runtime_error("spumux pipeline failed");
- }
- }
-
- void generate_menu_dispatch(std::ostream &, int indent,
- int first_menu, int last_menu);
-
- void webdvd_window::generate_dvd()
- {
- temp_file temp("webdvd-dvdauthor-");
- temp.close();
- std::ofstream file(temp.get_name().c_str());
-
- // We generate code that uses registers in the following way:
- //
- // g0: button destination (when jumping to menu 1), then scratch
- // g1: current location
- // g2-g11: location history (g2 = most recent)
- // g12: location that last linked to a video
- //
- // All locations are divided into two bitfields: the least
- // significant 10 bits are a page/menu number and the most
- // significant 6 bits are a link/button number, and numbering
- // starts at 1, not 0. This is done for compatibility with
- // the encoding of the s8 (button) register.
- //
- static const int button_mult = dvd::reg_s8_button_mult;
- static const int menu_mask = button_mult - 1;
- static const int button_mask = (1 << dvd::reg_bits) - button_mult;
- static const int location_bias = button_mult + 1;
-
- file <<
- "<dvdauthor>\n"
- " <vmgm>\n"
- " <menus>\n";
-
- for (std::size_t menu_num = 0;
- menu_num != contents_.menus.size();
- ++menu_num)
- {
- dvd_contents::menu & menu = contents_.menus[menu_num];
-
- if (menu_num == 0)