diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 00000000000..bc5241c596e --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,20 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "mgcb-ffmpeg": { + "version": "7.0.0.5", + "commands": [ + "mgcb-ffmpeg" + ], + "rollForward": false + }, + "mgcb-ffprobe": { + "version": "7.0.0.5", + "commands": [ + "mgcb-ffprobe" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 85e8eb0d09a..1c94ec9fd8d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -24,6 +24,7 @@ "args": [ "/@:/Users/harry/Projects/ContentTest/Untitled.mgcb", "/rebuild" ], + "cwd": "/Users/harry/Projects/ContentTest/", "console": "internalConsole", "stopAtEntry": false } diff --git a/MonoGame.Framework.Content.Pipeline/Audio/DefaultAudioProfile.cs b/MonoGame.Framework.Content.Pipeline/Audio/DefaultAudioProfile.cs index cc50af54f42..2d8c0199dd4 100644 --- a/MonoGame.Framework.Content.Pipeline/Audio/DefaultAudioProfile.cs +++ b/MonoGame.Framework.Content.Pipeline/Audio/DefaultAudioProfile.cs @@ -69,8 +69,8 @@ public static void ProbeFormat(string sourceFile, out AudioFileType audioFileTyp { string ffprobeStdout, ffprobeStderr; var ffprobeExitCode = ExternalTool.Run( - "ffprobe", - string.Format("-i \"{0}\" -show_format -show_entries streams -v quiet -of flat", sourceFile), + "dotnet", + string.Format("mgcb-ffprobe -i \"{0}\" -show_format -show_entries streams -v quiet -of flat", sourceFile), out ffprobeStdout, out ffprobeStderr); if (ffprobeExitCode != 0) @@ -282,9 +282,9 @@ public static void WritePcmFile(AudioContent content, string saveToFile, int bit { string ffmpegStdout, ffmpegStderr; var ffmpegExitCode = ExternalTool.Run( - "ffmpeg", + "dotnet", string.Format( - "-y -i \"{0}\" -vn -c:a pcm_s16le -b:a {2} {3} -f:a wav -strict experimental \"{1}\"", + "mgcb-ffmpeg -y -i \"{0}\" -vn -c:a pcm_s16le -b:a {2} {3} -f:a wav -strict experimental \"{1}\"", content.FileName, saveToFile, bitRate, @@ -293,7 +293,7 @@ public static void WritePcmFile(AudioContent content, string saveToFile, int bit out ffmpegStdout, out ffmpegStderr); if (ffmpegExitCode != 0) - throw new InvalidOperationException("ffmpeg exited with non-zero exit code: \n" + ffmpegStdout + "\n" + ffmpegStderr); + throw new InvalidOperationException("mgcb-ffmpeg exited with non-zero exit code: \n" + ffmpegStdout + "\n" + ffmpegStderr); } public static ConversionQuality ConvertToFormat(AudioContent content, ConversionFormat formatType, ConversionQuality quality, string saveToFile) @@ -367,9 +367,9 @@ public static ConversionQuality ConvertToFormat(AudioContent content, Conversion do { ffmpegExitCode = ExternalTool.Run( - "ffmpeg", + "dotnet", string.Format( - "-y -i \"{0}\" -vn -c:a {1} -b:a {2} -ar {3} -f:a {4} -strict experimental \"{5}\"", + "mgcb-ffmpeg -y -i \"{0}\" -vn -c:a {1} -b:a {2} -ar {3} -f:a {4} -strict experimental \"{5}\"", content.FileName, ffmpegCodecName, QualityToBitRate(quality), @@ -384,7 +384,7 @@ public static ConversionQuality ConvertToFormat(AudioContent content, Conversion if (ffmpegExitCode != 0) { - throw new InvalidOperationException("ffmpeg exited with non-zero exit code: \n" + ffmpegStdout + "\n" + ffmpegStderr); + throw new InvalidOperationException("mgcb-ffmpeg exited with non-zero exit code: \n" + ffmpegStdout + "\n" + ffmpegStderr); } byte[] rawData; diff --git a/MonoGame.Framework.Content.Pipeline/ExternalTool.cs b/MonoGame.Framework.Content.Pipeline/ExternalTool.cs index 83690860157..fd123c9bbd9 100644 --- a/MonoGame.Framework.Content.Pipeline/ExternalTool.cs +++ b/MonoGame.Framework.Content.Pipeline/ExternalTool.cs @@ -29,6 +29,8 @@ public static int Run(string command, string arguments) public static int Run(string command, string arguments, out string stdout, out string stderr, string stdin = null) { + Console.WriteLine($"Starting process: {command} {arguments}"); + // This particular case is likely to be the most common and thus // warrants its own specific error message rather than falling // back to a general exception from Process.Start() diff --git a/MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj b/MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj index efaebd872f9..70530f31646 100644 --- a/MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj +++ b/MonoGame.Framework.Content.Pipeline/MonoGame.Framework.Content.Pipeline.csproj @@ -113,16 +113,6 @@ runtimes\linux-x64\native PreserveNewest - - linux\ffmpeg - runtimes\linux-x64\native\linux - PreserveNewest - - - linux\ffprobe - runtimes\linux-x64\native\linux - PreserveNewest - runtimes\osx\native @@ -144,29 +134,7 @@ runtimes\osx\native PreserveNewest - - runtimes\osx\native - PreserveNewest - - - osx\ffmpeg - runtimes\osx\native\osx - PreserveNewest - - - osx\ffprobe - runtimes\osx\native\osx - PreserveNewest - - - runtimes\win-x64\native - PreserveNewest - - - runtimes\win-x64\native - PreserveNewest - runtimes\win-x64\native PreserveNewest