Skip to content

Commit

Permalink
Improved comments in FFprobeFolder
Browse files Browse the repository at this point in the history
  • Loading branch information
tombogle committed Aug 1, 2024
1 parent d0e4ffa commit ca7143f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions SIL.Media/MediaInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public class MediaInfo

/// <summary>
/// The folder where FFprobe should be found. An application can use this to set
/// the location before making any calls.
/// the location before making calls to obtain media info. Note that this sets a global
/// setting in FFmpegCore. If the application uses FFmpegCore to call FFprobe or FFmpeg
/// for other purposes, this folder will also be used for those calls.
/// </summary>
/// <exception cref="DirectoryNotFoundException">Folder does not exist</exception>
/// <exception cref="FileNotFoundException">Folder does not contain the ffprobe
Expand All @@ -54,13 +56,13 @@ public static string FFprobeFolder
"Path is not a folder containing FFprobe.exe: " + value);
}

// Configure tells FFMpegCore to remember the folder where it should find
// FFprobe (and also FFmpeg).
GlobalFFOptions.Configure(new FFOptions { BinaryFolder = value });
var testResult = Path.GetDirectoryName(GlobalFFOptions.GetFFProbeBinaryPath());
// Although we would generally be safe to check that the testResult folder is
// equal to the passed-in value, there are several edge cases where that might
// not be quite true, but if it couldn't find FFprobe in the requested folder,
// GetFFProbeBinaryPath just returns the filename with no folder (meaning that
// it expects to find it somewhere on the system path).
// If it couldn't find FFprobe in the requested folder, GetFFProbeBinaryPath
// returns the filename with no folder (meaning that it hopes to find it
// somewhere on the system path).
if (testResult == null)
throw new ArgumentException("FFMpegCore failed to set the requested FFprobe folder.");
}
Expand Down

0 comments on commit ca7143f

Please sign in to comment.