mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.2 KiB
45 lines
1.2 KiB
using ErsatzTV.FFmpeg.Environment; |
|
|
|
namespace ErsatzTV.FFmpeg; |
|
|
|
public static class CommandGenerator |
|
{ |
|
public static IList<EnvironmentVariable> GenerateEnvironmentVariables(IEnumerable<IPipelineStep> pipelineSteps) |
|
{ |
|
return pipelineSteps.SelectMany(ps => ps.EnvironmentVariables).ToList(); |
|
} |
|
|
|
public static IList<string> GenerateArguments( |
|
IEnumerable<InputFile> inputFiles, |
|
IList<IPipelineStep> pipelineSteps) |
|
{ |
|
var arguments = new List<string>(); |
|
|
|
foreach (IPipelineStep step in pipelineSteps) |
|
{ |
|
arguments.AddRange(step.GlobalOptions); |
|
} |
|
|
|
foreach (InputFile inputFile in inputFiles) |
|
{ |
|
foreach (IPipelineStep step in pipelineSteps) |
|
{ |
|
arguments.AddRange(step.InputOptions); |
|
} |
|
|
|
arguments.AddRange(new[] { "-i", inputFile.Path }); |
|
} |
|
|
|
foreach (IPipelineStep step in pipelineSteps) |
|
{ |
|
arguments.AddRange(step.FilterOptions); |
|
} |
|
|
|
foreach (IPipelineStep step in pipelineSteps) |
|
{ |
|
arguments.AddRange(step.OutputOptions); |
|
} |
|
|
|
return arguments; |
|
} |
|
}
|
|
|