-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/deterministic-dotnet-builds
- Loading branch information
Showing
24 changed files
with
463 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace FFMpegCore.Arguments | ||
{ | ||
/// <summary> | ||
/// Represents a copy codec parameter | ||
/// </summary> | ||
public class CopyCodecArgument : IArgument | ||
{ | ||
public string Text => $"-codec copy"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Drawing; | ||
|
||
namespace FFMpegCore.Arguments | ||
{ | ||
public class GifPaletteArgument : IArgument | ||
{ | ||
private readonly int _streamIndex; | ||
|
||
private readonly int _fps; | ||
|
||
private readonly Size? _size; | ||
|
||
public GifPaletteArgument(int streamIndex, int fps, Size? size) | ||
{ | ||
_streamIndex = streamIndex; | ||
_fps = fps; | ||
_size = size; | ||
} | ||
|
||
private string ScaleText => _size.HasValue ? $"scale=w={_size.Value.Width}:h={_size.Value.Height}," : string.Empty; | ||
|
||
public string Text => $"-filter_complex \"[{_streamIndex}:v] fps={_fps},{ScaleText}split [a][b];[a] palettegen=max_colors=32 [p];[b][p] paletteuse=dither=bayer\""; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
| ||
namespace FFMpegCore.Arguments | ||
{ | ||
internal class OutputTeeArgument : IOutputArgument | ||
{ | ||
private readonly FFMpegMultiOutputOptions _options; | ||
|
||
public OutputTeeArgument(FFMpegMultiOutputOptions options) | ||
{ | ||
if (options.Outputs.Count == 0) | ||
{ | ||
throw new ArgumentException("Atleast one output must be specified.", nameof(options)); | ||
} | ||
|
||
_options = options; | ||
} | ||
|
||
public string Text => $"-f tee \"{string.Join("|", _options.Outputs.Select(MapOptions))}\""; | ||
|
||
public Task During(CancellationToken cancellationToken = default) => Task.CompletedTask; | ||
|
||
public void Post() | ||
{ | ||
} | ||
|
||
public void Pre() | ||
{ | ||
} | ||
|
||
private static string MapOptions(FFMpegArgumentOptions option) | ||
{ | ||
var optionPrefix = string.Empty; | ||
if (option.Arguments.Count > 1) | ||
{ | ||
var options = option.Arguments.Take(option.Arguments.Count - 1); | ||
optionPrefix = $"[{string.Join(":", options.Select(MapArgument))}]"; | ||
} | ||
|
||
var output = option.Arguments.OfType<IOutputArgument>().Single(); | ||
return $"{optionPrefix}{output.Text.Trim('"')}"; | ||
} | ||
|
||
private static string MapArgument(IArgument argument) | ||
{ | ||
if (argument is MapStreamArgument map) | ||
{ | ||
return map.Text.Replace("-map ", "select=\\'") + "\\'"; | ||
} | ||
else if (argument is BitStreamFilterArgument bitstreamFilter) | ||
{ | ||
return bitstreamFilter.Text.Replace("-bsf:", "bsfs/").Replace(' ', '='); | ||
} | ||
|
||
return argument.Text.TrimStart('-').Replace(' ', '='); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.