disc-more gracefully handle missing ffmpeg, and checkin an ffmpeg finally
This commit is contained in:
parent
1f541be6df
commit
e4305823c5
|
@ -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));
|
||||
|
|
|
@ -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.
Loading…
Reference in New Issue