-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFFmpegCommunicator.cs
More file actions
50 lines (40 loc) · 1.37 KB
/
FFmpegCommunicator.cs
File metadata and controls
50 lines (40 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
namespace GrayScaleFilter
{
static class FFmpegCommunicator
{
private static string systemDir = System.AppDomain.CurrentDomain.BaseDirectory;
public static string fileName { get; set; } = "ffmpeg.exe";
public static string ffmpegPath { get; set; } = $@"{systemDir}ffmpeg\{fileName}";
private static ProcessStartInfo startInfo;
private static bool hasStarted = false;
private static Process exeProcess;
public static void Start()
{
// Starts Communication with FFMPEG
startInfo = new ProcessStartInfo();
startInfo.CreateNoWindow = false;
startInfo.UseShellExecute = false;
startInfo.FileName = fileName;
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
hasStarted = true;
exeProcess = new Process();
}
public static void End()
{
// Ends communicationwith FFmpeg
exeProcess.Dispose();
hasStarted = false;
}
public static void Execute(string command)
{
// Sends a command to FFMPEG
startInfo.Arguments = command;
exeProcess = Process.Start(startInfo);
exeProcess.WaitForExit();
}
}
}