Files
ersatztv/ErsatzTV.FFmpeg/OutputOption/AudioChannelsOutputOption.cs
T
Jason DoveandGitHub a47510fef3 add aac (latm) audio format (#2561)
* add aac (latm) audio format

* update changelog
2025-10-23 15:56:13 -05:00

37 lines
1017 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) || _audioFormat == Some(AudioFormat.AacLatm)) &&
_desiredChannels > 2)
{
return
[
"-ac", _desiredChannels.ToString(CultureInfo.InvariantCulture)
];
}
return [];
}
}
}