mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2026-01-04 21:21:25 -06:00
FF-1753: Added dynamicrange to title formatter
This commit is contained in:
@@ -192,7 +192,8 @@ public class FfmpegBuilderSetTrackTitles: FfmpegBuilderNode
|
||||
fps: track.Stream?.FramesPerSecond ?? 0,
|
||||
pixelFormat: track.Stream?.PixelFormat?.EmptyAsNull(),
|
||||
resolution: track.Stream == null ? null : ResolutionHelper.GetResolution(track.Stream.Width, track.Stream.Height),
|
||||
dimensions: track.Stream == null ? null : track.Stream.Width + "x" + track.Stream.Height
|
||||
dimensions: track.Stream == null ? null : track.Stream.Width + "x" + track.Stream.Height,
|
||||
dynamicRange: track.Stream.HDR ? "HDR" : "SDR"
|
||||
);
|
||||
if (originalTitle == track.Title)
|
||||
continue;
|
||||
@@ -263,10 +264,11 @@ public class FfmpegBuilderSetTrackTitles: FfmpegBuilderNode
|
||||
/// <param name="dimensions">the tracks video dimensions</param>
|
||||
/// <param name="pixelFormat">the tracks video pixelFormat</param>
|
||||
/// <param name="fps">the tracks video FPS</param>
|
||||
/// <param name="dynamicRange">the dynamic range</param>
|
||||
/// <returns>the formatted string</returns>
|
||||
internal static string FormatTitle(string formatter, string separator, string language, string codec, bool isDefault = false, float bitrate = 0,
|
||||
float channels = 0, int sampleRate = 0, bool isForced = false, bool sdh = false, bool cc = false, bool hi = false,
|
||||
ResolutionHelper.Resolution? resolution = null, string? dimensions = null, string? pixelFormat = null, float? fps = null)
|
||||
ResolutionHelper.Resolution? resolution = null, string? dimensions = null, string? pixelFormat = null, float? fps = null, string? dynamicRange = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(formatter))
|
||||
return string.Empty;
|
||||
@@ -336,6 +338,9 @@ public class FfmpegBuilderSetTrackTitles: FfmpegBuilderNode
|
||||
formatter = Replace(formatter, "!pixelformat!", pixelFormat ?? string.Empty);
|
||||
formatter = Replace(formatter, "!pixelformat", pixelFormat?.ToLowerInvariant() ?? string.Empty);
|
||||
formatter = Replace(formatter, "pixelformat", pixelFormat?.ToUpperInvariant() ?? string.Empty);
|
||||
formatter = Replace(formatter, "!dynamicrange!", dynamicRange ?? string.Empty);
|
||||
formatter = Replace(formatter, "!dynamicrange", dynamicRange?.ToLowerInvariant() ?? string.Empty);
|
||||
formatter = Replace(formatter, "dynamicrange", dynamicRange?.ToUpperInvariant() ?? string.Empty);
|
||||
formatter = Replace(formatter, "dimensions", dimensions ?? string.Empty);
|
||||
|
||||
// Remove standalone separators
|
||||
|
||||
@@ -402,6 +402,33 @@ public class FFmpegBuilder_SetTrackTitlesTests : VideoTestBase
|
||||
Assert.AreEqual("Track: English / HEVC / 720p", result);
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void FormatTitle_Video_HDR()
|
||||
{
|
||||
// Arrange
|
||||
string formatter = "Track: lang / codec / fps / resolution / dimensions / pixelformat / dynamicrange";
|
||||
string separator = " / ";
|
||||
string language = "English";
|
||||
string codec = "HEVC";
|
||||
|
||||
ResolutionHelper.Resolution resolution = ResolutionHelper.Resolution.r720p;
|
||||
|
||||
// Act
|
||||
string result = FfmpegBuilderSetTrackTitles.FormatTitle(formatter, separator, language, codec,
|
||||
resolution: resolution, dynamicRange: "HDR");
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual("Track: English / HEVC / 720P / HDR", result);
|
||||
|
||||
// Act
|
||||
result = FfmpegBuilderSetTrackTitles.FormatTitle(formatter, separator, language, codec,
|
||||
resolution: resolution, dynamicRange: "SDR");
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual("Track: English / HEVC / 720P / SDR", result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FormatTitle_Video_PixelFormat()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user