Skip to content

Commit

Permalink
backup
Browse files Browse the repository at this point in the history
  • Loading branch information
harry-cpp committed Jul 6, 2024
1 parent f623b8a commit dfe0bed
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 40 deletions.
20 changes: 20 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"args": [
"/@:/Users/harry/Projects/ContentTest/Untitled.mgcb", "/rebuild"
],
"cwd": "/Users/harry/Projects/ContentTest/",
"console": "internalConsole",
"stopAtEntry": false
}
Expand Down
16 changes: 8 additions & 8 deletions MonoGame.Framework.Content.Pipeline/Audio/DefaultAudioProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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",

This comment has been minimized.

Copy link
@dellis1972

dellis1972 Jul 31, 2024

Collaborator

Should this be using a environment variable so that we are not hardcoding dotnet into our system?

This comment has been minimized.

Copy link
@harry-cpp

harry-cpp Jul 31, 2024

Author Owner

We have hardcoded dotnet calls in several places. Up to you if you want to change it.

This comment has been minimized.

Copy link
@dellis1972

dellis1972 Jul 31, 2024

Collaborator

for example the content builder stuff allows use to override the exe name with DotnetCommand , this has saved our buts with regards to the M1/M2 issues.

Its probably prudent to have the same level of flexability here.

This comment has been minimized.

Copy link
@harry-cpp
string.Format("mgcb-ffprobe -i \"{0}\" -show_format -show_entries streams -v quiet -of flat", sourceFile),
out ffprobeStdout,
out ffprobeStderr);
if (ffprobeExitCode != 0)
Expand Down Expand Up @@ -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,
Expand All @@ -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)
Expand Down Expand Up @@ -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),
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions MonoGame.Framework.Content.Pipeline/ExternalTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,6 @@
<PackagePath>runtimes\linux-x64\native</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\Dependencies\ffmpeg\Linux\x64\ffmpeg" Visible="false">
<Link>linux\ffmpeg</Link>
<PackagePath>runtimes\linux-x64\native\linux</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\Dependencies\ffmpeg\Linux\x64\ffprobe" Visible="false">
<Link>linux\ffprobe</Link>
<PackagePath>runtimes\linux-x64\native\linux</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

<Content Include="..\ThirdParty\Dependencies\NVTT\MacOS\libnvcore.dylib" Visible="false">
<PackagePath>runtimes\osx\native</PackagePath>
Expand All @@ -144,29 +134,7 @@
<PackagePath>runtimes\osx\native</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\Dependencies\SharpFont\x64\libpng16.16.dylib" Visible="false">
<PackagePath>runtimes\osx\native</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\Dependencies\ffmpeg\MacOS\ffmpeg" Visible="false">
<Link>osx\ffmpeg</Link>
<PackagePath>runtimes\osx\native\osx</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\Dependencies\ffmpeg\MacOS\ffprobe" Visible="false">
<Link>osx\ffprobe</Link>
<PackagePath>runtimes\osx\native\osx</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

<Content Include="..\ThirdParty\Dependencies\ffmpeg\Windows\x64\ffmpeg.exe" Visible="false">
<PackagePath>runtimes\win-x64\native</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\Dependencies\ffmpeg\Windows\x64\ffprobe.exe" Visible="false">
<PackagePath>runtimes\win-x64\native</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\Dependencies\MojoShader\Windows\libmojoshader_64.dll" Visible="false">
<PackagePath>runtimes\win-x64\native</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down

0 comments on commit dfe0bed

Please sign in to comment.