bool RequestTask() { if (task_queue.Count == 0) { return(false); } process_task newTask = task_queue.Dequeue(); // pt.idx = count; // pt.desc = typeStr; // pt.startTime = DateTime.Now; desc = newTask.task_desc; //m_process.Close(); m_process = new Process(); m_process.StartInfo.FileName = newTask.app_name;// "ipconfig.exe"; m_process.StartInfo.UseShellExecute = false; m_process.StartInfo.RedirectStandardOutput = true; m_process.StartInfo.Arguments = newTask.app_args; //m_ue_process = Process.Start(app_name, command_arguments); m_process.Exited += process_Exited; m_process.OutputDataReceived += process_ReceiveOutput; m_process.Start(); m_process.BeginOutputReadLine(); SetState(1); UpdateStayTime(); return(true); }
static public int ExtractImages(string videoFilename, string keyword) { if (videoFilename.Length < 3) { return(-1); } string output_folder = Path.GetDirectoryName(videoFilename); string filename = Path.GetFileNameWithoutExtension(videoFilename); output_folder = Path.Combine(output_folder, filename); // output_folder += "\\"; string app_name = "FFmpeg\\ffmpeg.exe"; if (!Directory.Exists(output_folder)) { Directory.CreateDirectory(output_folder); } process_task[] tasks = new process_task[3]; tasks[0].task_desc = "ExtractImages"; tasks[0].app_name = app_name; tasks[0].app_args = BuildCommandArguments.build_args_ffmpeg(videoFilename, output_folder, keyword); tasks[1].task_desc = "ExtractGPSData"; tasks[1].app_name = openCV_app_name; tasks[1].app_args = BuildCommandArguments.build_args_extract_gps_data(videoFilename, output_folder, filename); tasks[2].task_desc = "AddGPSToImage"; tasks[2].app_name = console_app_name; tasks[2].app_args = BuildCommandArguments.build_args_build_metadata(output_folder, true); return(Program.g_TaskManager.RunCommandLine_MultiTask(tasks)); }
public void AddTask(string typeStr, string app_name, string command_arguments) { process_task pt = new process_task(); task_idx++; pt.idx = task_idx; pt.task_desc = typeStr; pt.app_name = app_name; pt.app_args = command_arguments; task_queue.Enqueue(pt); }