Files
ersatztv/ErsatzTV.FFmpeg/OutputOption/AudioChannelsOutputOption.cs
T
Jason DoveandGitHub 9471cb55dd upgrade from dotnet 7 to dotnet 8 (#1529)
* upgrade sdk

* fix warnings in ersatztv.ffmpeg

* fix warnings in ersatztv.core

* fix warnings in ersatztv.infrastructure

* fix warnings in ersatztv.application

* disable analysis for migrations projects

* fix warnings in ersatztv.scanner

* fix warnings in ersatztv

* upgrade project framework

* update github actions and dockerfiles
2023-12-30 13:29:57 -06:00

35 lines
963 B
C#

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>();
}
}
}