disc-more gracefully handle missing ffmpeg, and checkin an ffmpeg finally

This commit is contained in:
zeromus 2011-08-08 02:02:01 +00:00
parent 1f541be6df
commit e4305823c5
3 changed files with 21 additions and 0 deletions

View File

@ -55,6 +55,11 @@ namespace BizHawk.DiscSystem
if (!File.Exists(blobPath))
{
//if it doesn't exist, then it may be encoded.
FFMpeg ffmpeg = new FFMpeg();
if (!ffmpeg.QueryServiceAvailable())
{
throw new InvalidOperationException("No decoding service was available (make sure ffmpeg.exe is available)");
}
AudioDecoder dec = new AudioDecoder();
byte[] buf = dec.AcquireWaveData(blobPath);
blob.Load(new MemoryStream(buf));

View File

@ -31,6 +31,22 @@ namespace BizHawk.DiscSystem
return ret;
}
/// <summary>
/// queries whether this service is available. if ffmpeg is broken or missing, then you can handle it gracefully
/// </summary>
public bool QueryServiceAvailable()
{
try
{
string stdout = Run("-version");
if (stdout.Contains("ffmpeg version")) return true;
}
catch
{
}
return false;
}
string Run(params string[] args)
{
args = Escape(args);

Binary file not shown.