bool DumpGui::init(int argc, char **argv[]) { char c; int origopterr = opterr; if (_xid) { log_error (_("Ignoring request to display in X11 window")); } optind = 0; opterr = 0; while ((c = getopt (argc, *argv, "D:")) != -1) { if (c == 'D') { _file_output = optarg; } } opterr = origopterr; if (_file_output == NULL) { std::cout << _("# FATAL: No filename given with -D argument.") << std::endl; return false; } #ifdef HAVE_SIGNAL_H signal(SIGINT, terminate_signal); signal(SIGTERM, terminate_signal); #endif init_dumpfile(); _agg_renderer = create_render_handler_agg(_pixelformat); set_render_handler(_agg_renderer); return true; }
bool DumpGui::init(int argc, char **argv[]) { int origopterr = opterr; if (_xid) { log_error(_("Ignoring request to display in X11 window")); } optind = 0; opterr = 0; char c; while ((c = getopt(argc, *argv, "D:S:T:")) != -1) { if (c == 'D') { // Terminate if no filename is given. if (!optarg) { std::cout << _("# FATAL: No filename given with -D argument.") << std::endl; return false; } std::vector<std::string> file_fps; boost::split(file_fps, optarg, boost::is_any_of("@"), boost::token_compress_on); _fileOutput = file_fps[0]; if ( file_fps.size() > 1 ) { _fileOutputFPS = boost::lexical_cast<unsigned int>(file_fps[1]); } } else if (c == 'S') { // Terminate if no filename is given. if (!optarg) { std::cout << _("# FATAL: No sleep ms value given with -S argument.") << std::endl; return false; } // we take milliseconds _sleepUS = std::atoi(optarg) * 1000; } else if (c == 'T') { // Terminate if no filename is given. if (!optarg) { std::cerr << _("# FATAL: No trigger value given with -T argument.\n"); return false; } // we take milliseconds _startTrigger = optarg; } } opterr = origopterr; std::signal(SIGINT, terminate_signal); std::signal(SIGTERM, terminate_signal); init_dumpfile(); if (_startTrigger.empty()) _started = true; _renderer.reset(create_Renderer_agg(_pixelformat.c_str())); _runResources.setRenderer(_renderer); sound::sound_handler* mixer = _runResources.soundHandler(); media::MediaHandler* mh = _runResources.mediaHandler(); _soundHandler.reset(new sound::NullSoundHandler(mh, mixer)); _runResources.setSoundHandler(_soundHandler); // We know what type of renderer it is. _agg_renderer = static_cast<Renderer_agg_base*>(_renderer.get()); return true; }