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.
34 lines
963 B
34 lines
963 B
using System.Globalization; |
|
using ErsatzTV.FFmpeg.Format; |
|
|
|
namespace ErsatzTV.FFmpeg.OutputOption; |
|
|
|
public class AudioChannelsOutputOption : OutputOption |
|
{ |
|
private readonly Option<string> _audioFormat; |
|
private readonly int _desiredChannels; |
|
private readonly int _sourceChannels; |
|
|
|
public AudioChannelsOutputOption(Option<string> audioFormat, int sourceChannels, int desiredChannels) |
|
{ |
|
_audioFormat = audioFormat; |
|
_sourceChannels = sourceChannels; |
|
_desiredChannels = desiredChannels; |
|
} |
|
|
|
public override string[] OutputOptions |
|
{ |
|
get |
|
{ |
|
if (_sourceChannels != _desiredChannels || _audioFormat == Some(AudioFormat.Aac) && _desiredChannels > 2) |
|
{ |
|
return new[] |
|
{ |
|
"-ac", _desiredChannels.ToString(CultureInfo.InvariantCulture) |
|
}; |
|
} |
|
|
|
return Array.Empty<string>(); |
|
} |
|
} |
|
}
|
|
|