diff --git a/FFMpegCore.Test/ArgumentBuilderTest.cs b/FFMpegCore.Test/ArgumentBuilderTest.cs index 0e6d715..53999c3 100644 --- a/FFMpegCore.Test/ArgumentBuilderTest.cs +++ b/FFMpegCore.Test/ArgumentBuilderTest.cs @@ -1,6 +1,7 @@ using System.Drawing; using FFMpegCore.Arguments; using FFMpegCore.Enums; +using FFMpegCore.Pipes; namespace FFMpegCore.Test; @@ -8,6 +9,7 @@ namespace FFMpegCore.Test; public class ArgumentBuilderTest { private readonly string[] _concatFiles = { "1.mp4", "2.mp4", "3.mp4", "4.mp4" }; + private readonly int _macOsMaxPipePathLength = 104; private readonly string[] _multiFiles = { "1.mp3", "2.mp3", "3.mp3", "4.mp3" }; [TestMethod] @@ -703,4 +705,18 @@ public class ArgumentBuilderTest var arg = new AudibleEncryptionKeyArgument("62689101"); Assert.AreEqual("-activation_bytes 62689101", arg.Text); } + + [TestMethod] + public void InputPipe_MaxLength_ShorterThanMacOSMax() + { + var pipePath = new InputPipeArgument(new StreamPipeSource(Stream.Null)).PipePath; + Assert.IsLessThan(104, pipePath.Length); + } + + [TestMethod] + public void OutputPipe_MaxLength_ShorterThanMacOSMax() + { + var pipePath = new OutputPipeArgument(new StreamPipeSink(Stream.Null)).PipePath; + Assert.IsLessThan(_macOsMaxPipePathLength, pipePath.Length); + } } diff --git a/FFMpegCore/FFMpeg/Arguments/PipeArgument.cs b/FFMpegCore/FFMpeg/Arguments/PipeArgument.cs index 4011c23..311a518 100644 --- a/FFMpegCore/FFMpeg/Arguments/PipeArgument.cs +++ b/FFMpegCore/FFMpeg/Arguments/PipeArgument.cs @@ -11,7 +11,7 @@ public abstract class PipeArgument protected PipeArgument(PipeDirection direction) { - PipeName = PipeHelpers.GetUnqiuePipeName(); + PipeName = PipeHelpers.GetUniquePipeName(); _direction = direction; } diff --git a/FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs b/FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs index cbd90ac..01f3416 100644 --- a/FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs +++ b/FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs @@ -4,9 +4,9 @@ namespace FFMpegCore.Pipes; internal static class PipeHelpers { - public static string GetUnqiuePipeName() + public static string GetUniquePipeName() { - return $"FFMpegCore_{Guid.NewGuid().ToString("N").Substring(0, 5)}"; + return $"FFMpegCore_{Guid.NewGuid().ToString("N").Substring(0, 16)}"; } public static string GetPipePath(string pipeName)