mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2026-02-18 10:38:27 -06:00
FF-1763: Added numchannels track title formatter
This commit is contained in:
@@ -300,6 +300,7 @@ public class FfmpegBuilderSetTrackTitles: FfmpegBuilderNode
|
||||
formatter = Replace(formatter, "hi", hi ? "HI" : string.Empty);
|
||||
formatter = Replace(formatter, "hearingimpared", hi ? "Hearing Impared" : string.Empty);
|
||||
formatter = Replace(formatter, "sdh", sdh ? "SDH" : string.Empty);
|
||||
formatter = Replace(formatter, "numchannels", channels.ToString("N1"));
|
||||
formatter = Replace(formatter, "channels", Math.Abs(channels - 1) < 0.05f ? "Mono" :
|
||||
Math.Abs(channels - 2) < 0.05f ? "Stereo" :
|
||||
channels > 0 ? channels.ToString("0.0") : null);
|
||||
|
||||
@@ -99,6 +99,29 @@ public class FFmpegBuilder_SetTrackTitlesTests : VideoTestBase
|
||||
Assert.AreEqual("Track: English / Digital Theater Systems / Stereo / Default / 128Kbps / 44.1kHz", result);
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void FormatTitle_Codec_CommericalName_FF1763()
|
||||
{
|
||||
// Arrange
|
||||
string formatter = "lang - codec-cc - numchannels";
|
||||
string separator = " - ";
|
||||
string language = "English";
|
||||
string codec = "DTS";
|
||||
bool isDefault = true;
|
||||
float bitrate = 128_000;
|
||||
float channels = 2.0f;
|
||||
int sampleRate = 44100;
|
||||
bool isForced = false;
|
||||
|
||||
// Act
|
||||
string result = FfmpegBuilderSetTrackTitles.FormatTitle(formatter, separator, language, codec, isDefault, bitrate,
|
||||
channels, sampleRate, isForced);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual("English - Digital Theater Systems - 2.0", result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FormatTitle_EmptyFormatter_ReturnsEmptyString()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user