FFMpegCore/FFMpegCore/FFMpeg/Arguments/MapStreamArgument.cs
2025-10-16 12:38:57 +02:00

30 lines
931 B
C#

using FFMpegCore.Enums;
namespace FFMpegCore.Arguments;
/// <summary>
/// Represents choice of stream by the stream specifier
/// </summary>
public class MapStreamArgument : IArgument
{
private readonly Channel _channel;
private readonly int _inputFileIndex;
private readonly bool _negativeMap;
private readonly int _streamIndex;
public MapStreamArgument(int streamIndex, int inputFileIndex, Channel channel = Channel.All, bool negativeMap = false)
{
if (channel == Channel.Both)
{
// "Both" is not valid in this case and probably means all stream types
channel = Channel.All;
}
_inputFileIndex = inputFileIndex;
_streamIndex = streamIndex;
_channel = channel;
_negativeMap = negativeMap;
}
public string Text => $"-map {(_negativeMap ? "-" : "")}{_inputFileIndex}{_channel.StreamType()}:{_streamIndex}";
}