-
- file << " </pgc>\n";
- }
-
- file <<
- " </menus>\n"
- " </vmgm>\n";
-
- // Generate a titleset for each video. This appears to make
- // jumping to titles a whole lot simpler.
- for (std::size_t video_num = 1;
- video_num <= video_paths_.size();
- ++video_num)
- {
- file <<
- " <titleset>\n"
- // Generate a dummy menu so that the menu button on the
- // remote control will work.
- " <menus>\n"
- " <pgc entry='root'>\n"
- " <pre> jump vmgm menu; </pre>\n"
- " </pgc>\n"
- " </menus>\n"
- " <titles>\n"
- " <pgc>\n"
- // Record calling page/menu.
- " <pre> g12 = g1; </pre>\n"
- // FIXME: Should XML-escape the path
- " <vob file='" << video_paths_[video_num - 1]
- << "'/>\n"
- // If page/menu location has not been changed during the
- // video, change the location to be the following
- // link/button when returning to it. In any case,
- // return to a page/menu.
- " <post> if (g1 eq g12) g1 = g1 + " << link_mult
- << "; call menu; </post>\n"
- " </pgc>\n"
- " </titles>\n"
- " </titleset>\n";
- }
-
- file <<
- "</dvdauthor>\n";
- }
-
- void generate_page_dispatch(std::ostream & file, int indent,
- int first_page, int last_page)
- {
- if (first_page == 1 && last_page == 1)
- {
- // The dispatch code is *on* page 1 so we must not dispatch to
- // page 1 since that would cause an infinite loop. This case
- // should be unreachable if there is more than one page due
- // to the following case.
- }
- else if (first_page == 1 && last_page == 2)
- {
- // dvdauthor doesn't allow empty blocks or null statements so
- // when selecting between pages 1 and 2 we don't use an "else"
- // part. We must use braces so that a following "else" will
- // match the right "if".
- file << std::setw(indent) << "" << "{\n"
- << std::setw(indent) << "" << "if (g0 eq 2)\n"
- << std::setw(indent + 2) << "" << "jump menu 2;\n"
- << std::setw(indent) << "" << "}\n";
- }
- else if (first_page == last_page)
- {
- file << std::setw(indent) << ""
- << "jump menu " << first_page << ";\n";
- }
- else
- {
- int middle = (first_page + last_page) / 2;
- file << std::setw(indent) << "" << "if (g0 le " << middle << ")\n";
- generate_page_dispatch(file, indent + 2, first_page, middle);
- file << std::setw(indent) << "" << "else\n";
- generate_page_dispatch(file, indent + 2, middle + 1, last_page);
+ 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");