Exemple #1
0
int main (int argc, char **argv) {

#ifdef USE_SSI_LEAK_DETECTOR
	{
#endif

	char info[1024];
	ssi_sprint (info, "\n%s\n\nbuild version: %s\n\n", SSI_COPYRIGHT, SSI_VERSION);
#if _WIN32||_WIN64
	//set up windows event listener to catch console close event
	if (SetConsoleCtrlHandler((PHANDLER_ROUTINE)ConsoleHandler,TRUE)==FALSE)
		ssi_print("WARNING: Unable to install console handler!\n");

	//**** READ COMMAND LINE ****//
#endif
	CmdArgParser cmd;
	cmd.info (info);

	ssi_char_t *filepath = 0;	
	ssi_char_t *debugpath = 0;
	ssi_char_t *configpaths = 0;
	bool init_only, debug_to_file, export_dlls, show_close_but, savepipe;
	
	cmd.addText("\nArguments:");
	cmd.addSCmdArg("filepath", &filepath, "path to pipeline");	

	cmd.addText ("\nOptions:");
	cmd.addSCmdOption ("-config", &configpaths, "", "paths to global config files (seperated by ;) []");		
	cmd.addBCmdOption ("-save", &savepipe, false, "save pipeline after applying config files [false]");		
	cmd.addBCmdOption ("-init", &init_only, false, "only initialize pipepline [false]");		
	cmd.addBCmdOption ("-dbg2file", &debug_to_file, false, "debug to file [false] (deprecated, use -debug instead)");
	cmd.addSCmdOption ("-debug", &debugpath, "", "debug to file or udp socket if set to <host>:<port> [""]");
	cmd.addBCmdOption ("-export", &export_dlls, false, "copy registered dlls to the folder of the executable [false]");
	cmd.addBCmdOption ("-closebut", &show_close_but, false, "enable close button in menu of console [false]");
	
	if (cmd.read (argc, argv)) {				

		if (debug_to_file) {
			ssi_log_file_begin ("ssi_dbg.txt");
		}
		if (debugpath[0] != '\0') {
			ssi_size_t n = ssi_split_string_count (debugpath, ':');
			if (n > 1) {
				ssi_char_t **tokens = new ssi_char_t *[n];
				ssi_split_string (n, tokens, debugpath, ':');
				ssi_size_t port = 0;
				sscanf (tokens[1], "%u", &port);
				ssimsg = new SocketMessage (Socket::UDP, port, tokens[0]);
				for (ssi_size_t i = 0; i < n; i++) {
					delete[] tokens[i];
				}
				delete[] tokens;
			} else {
				ssimsg = new FileMessage (debugpath);
			}
		}
		ssi_print ("%s", info);

		if (configpaths[0] != '\0') {
			Run (argv[0], filepath, configpaths, savepipe, init_only, export_dlls, show_close_but);
		} else {
			Run (argv[0], filepath, 0, savepipe, init_only, export_dlls, show_close_but);
		}

		if (debug_to_file){
			ssi_log_file_end ();
		}
		if (debugpath[0] != '\0') {
			delete ssimsg;
			ssimsg = 0;
		}

	}

	delete[] filepath;	
	delete[] configpaths;
	delete[] debugpath;
	
#ifdef USE_SSI_LEAK_DETECTOR
	}
	_CrtDumpMemoryLeaks();
#endif

	return 0;
}
Exemple #2
0
int main (int argc, char **argv) {

#ifdef USE_SSI_LEAK_DETECTOR
	{
#endif

	char info[1024];
	ssi_sprint (info, "\n%s\n\nbuild version: %s\n\n", SSI_COPYRIGHT, SSI_VERSION);

	//**** READ COMMAND LINE ****//

	CmdArgParser cmd;
	cmd.info (info);

	ssi_char_t *dllpath = 0;	
	ssi_char_t *apipath = 0;	
	ssi_char_t *outdir = 0;
	ssi_char_t *reg = 0; 
	bool index;

	cmd.addText("\nArguments:");
	cmd.addSCmdArg("dllpath", &dllpath, "input path to dll");	

	cmd.addText ("\nOptions:");
	cmd.addSCmdOption ("-dir", &outdir, "", "output directory []");
	cmd.addBCmdOption ("-index", &index, false, "create index [false]");
	cmd.addSCmdOption ("-reg", &reg, "", "register additional dll's (if several separate by semicolon)");
	
	if (cmd.read (argc, argv)) {		

		ssi_char_t string[SSI_MAX_CHAR];

		FilePath fp (dllpath);
		ssi_char_t *dllpath_with_ext = 0;
		if (strcmp (fp.getExtension (), ".dll") != 0) {
			dllpath_with_ext = ssi_strcat (dllpath, ".dll");
		} else {
			dllpath_with_ext = ssi_strcpy (dllpath);
		}

		if (Factory::RegisterDLL (dllpath_with_ext)) {	

			// register additional dlls
			if (reg) {
				APIGenerator::SaveCurrentComponentList ();
				ssi_size_t n_reg = ssi_split_string_count (reg, ';');
				ssi_char_t **regs = new ssi_char_t *[n_reg];
				ssi_split_string (n_reg, regs, reg, ';');
				for (ssi_size_t i = 0; i < n_reg; i++) {
					Factory::RegisterDLL (regs[i]);
					delete[] regs[i];
				}
				delete[] regs;
			}

			if (outdir[0] == '\0') {
				ssi_sprint (string, "%s", fp.getPath ());
			} else {
				ssi_sprint (string, "%s\\%s", outdir, fp.getName ());
			}

			APIGenerator::CreateAPI (string);
			APIGenerator::ResetCurrentComponentList ();
			Factory::Clear ();
		}

		if (index) {
			if (outdir[0] == '\0') {
				APIGenerator::CreateAPIIndex (fp.getDir ());
			} else {
				APIGenerator::CreateAPIIndex (outdir);
			}
		}

		delete[] dllpath_with_ext;
	}

	delete[] dllpath;	
	delete[] apipath;	
	delete[] outdir;

#ifdef USE_SSI_LEAK_DETECTOR
	}
	_CrtDumpMemoryLeaks();
#endif

	return 0;
}
Exemple #3
0
int main (int argc, char **argv) {

#ifdef USE_SSI_LEAK_DETECTOR
	{
#endif
	
	char info[1024];
	ssi_sprint (info, "\n%s\n\nbuild version: %s\n\n", SSI_COPYRIGHT, SSI_VERSION);

	CmdArgParser cmd;
	cmd.info (info);

	Factory::RegisterDLL ("ssigraphic.dll");
	Factory::RegisterDLL ("ssimodel.dll");
	Factory::RegisterDLL ("ssiaudio.dll");
	Factory::RegisterDLL ("ssisignal.dll");
	Factory::RegisterDLL ("ssiemovoice.dll");
	Factory::RegisterDLL ("ssiioput.dll");	

	ssi_char_t *dir = 0;
	ssi_char_t *model = 0;
	ssi_char_t *wavfile = 0;
	ssi_char_t *annofile = 0;

	cmd.addMasterSwitch ("--split");

	cmd.addText("\nArguments:");
	cmd.addSCmdArg("dir", &dir, "output directory");
	cmd.addSCmdArg("file", &wavfile, "filename of wave file");
	cmd.addSCmdArg("anno", &annofile, "filename of annoation file");

	cmd.addMasterSwitch ("--train");

	cmd.addText("\nArguments:");
	cmd.addSCmdArg("dir", &dir, "directory with training files");
	cmd.addSCmdArg("model", &model, "filename of model");

	cmd.addMasterSwitch ("--test");

	cmd.addText("\nArguments:");
	cmd.addSCmdArg("file", &wavfile, "filename of wave file");
	cmd.addSCmdArg("model", &model, "filename of model");

	if (cmd.read (argc, argv)) {		

		switch (cmd.master_switch) {

			case 1: {
				split (dir, wavfile, annofile);
				break;
			}
			case 2: {
				train (dir, model);
				break;
			}
			case 3: {
				test (wavfile, model);
				break;
			}			
		}
	}

	Factory::Clear ();

	delete[] dir;
	delete[] model;
	delete[] wavfile;
	delete[] annofile;

#ifdef USE_SSI_LEAK_DETECTOR
	}
	_CrtDumpMemoryLeaks();
#endif

	return 0;
}
Exemple #4
0
bool Parse_and_Run(int argc, char **argv)
{
	char info[1024];
	ssi_sprint(info, "\n%s\n\nbuild version: %s\n\n", SSI_COPYRIGHT, SSI_VERSION);

#if !_DEBUG && defined _MSC_VER && _MSC_VER >= 1900	
	const ssi_char_t *default_source = "https://github.com/hcmlab/ssi/raw/master/bin/x64/vc140";
#else
	const ssi_char_t *default_source = "";
#endif

	CmdArgParser cmd;
	cmd.info(info);

	params_t params;
	params.exeDir = 0;
	params.exePath = 0;
	params.chainDir = 0;
	params.chainPath = 0;
	params.chainPathAbsolute = 0;
	params.inPath = 0;
	params.outPath = 0;
	params.logPath = 0;
	params.srcUrl = 0;
	params.step = 0;
	params.left = 0;
	params.right = 0;
	params.annoPath = 0;
	params.ascii = false;
	params.restClassName = 0;

	cmd.addText("\nArguments:");
	cmd.addSCmdArg("chain", &params.chainPath, "path to file defining the processing chain");
	cmd.addSCmdArg("in", &params.inPath, "input path (if several separate by ;)");
	cmd.addSCmdArg("out", &params.outPath, "output path (if several separate by ;)");

	cmd.addText("\nOptions:");
	cmd.addBCmdOption("-ascii", &params.ascii, false, "store output as ASCII");
	cmd.addBCmdOption("-list", &params.list, false, "read files from list (one file per line)");
	cmd.addSCmdOption("-step", &params.step, "0", "set frame step (add ms/s for milli/seconds otherwise interpreted as number of samples)");
	cmd.addSCmdOption("-left", &params.left, "0", "set left context (see step)");
	cmd.addSCmdOption("-right", &params.right, "0", "set right context (see step)");
	cmd.addSCmdOption("-anno", &params.annoPath, "", "path to an annotation (features will be extracted over segments and stored as a sample list)");
	cmd.addSCmdOption("-rest", &params.restClassName, SSI_SAMPLE_REST_CLASS_NAME, "name of restclass (if empty not added)");
	cmd.addICmdOption("-parallel", &params.nParallel, 1, "number of files processed in parallel (0 = all)");
	cmd.addSCmdOption("-url", &params.srcUrl, default_source, "override default url for downloading missing dlls and dependencies");
	cmd.addSCmdOption("-log", &params.logPath, "", "log to a file [""]");


	if (!cmd.read(argc, argv))
	{
		return false;
	}

	if (params.logPath[0] != '\0')
	{
		ssimsg = new FileMessage(params.logPath);
	}

	ssi_print("%s", info);

	Run(argv[0], params);

	if (params.logPath[0] != '\0') {
		delete ssimsg;
		ssimsg = 0;
	}

	delete[] params.exeDir;
	delete[] params.exePath;
	delete[] params.chainDir;
	delete[] params.chainPath;
	delete[] params.chainPathAbsolute;
	delete[] params.inPath;
	delete[] params.outPath;
	delete[] params.logPath;
	delete[] params.srcUrl;
	delete[] params.left;
	delete[] params.right;
	delete[] params.step;
	delete[] params.annoPath;
	delete[] params.restClassName;

	return true;
}