#if(DEBUG)
using File = System.IO.File;
namespace FileFlows.AudioNodes.Tests;
///
/// Test base dor the audio tests
///
public abstract class AudioTestBase : TestBase
{
///
/// The resources test file directory
///
protected static readonly string ResourcesTestFilesDir = "Tests/Resources";
///
/// Audio MP3 file
///
protected static readonly string AudioMp3 = ResourcesTestFilesDir + "/audio.mp3";
///
/// Audio OGG file
///
protected static readonly string AudioOgg = ResourcesTestFilesDir + "/audio.ogg";
///
/// Audio FLAC file
///
protected static readonly string AudioFlac = ResourcesTestFilesDir + "/audio.flac";
///
/// Audio WAV file
///
protected static readonly string AudioWav = ResourcesTestFilesDir + "/audio.wav";
///
/// Gets the FFmpeg location
///
protected static string FFmpeg { get; private set; }
///
/// Gets the FFprobe location
///
protected static string FFprobe { get; private set; }
///
/// Gets the Node Parameters
///
/// the file to initialise, will use AudioMp3 if not set
/// if the file is directory
/// the node parameters
public NodeParameters GetAudioNodeParameters(string? filename = null, bool isDirectory = false)
{
filename ??= AudioMp3;
var args = new NodeParameters(filename, Logger, isDirectory, string.Empty, new LocalFileService())
{
LibraryFileName = filename
};
args.InitFile(filename);
FFmpeg = File.Exists("/tools/ffmpeg/ffmpeg") ? "/tools/ffmpeg/ffmpeg" : File.Exists("/usr/local/bin/ffmpeg") ? "/usr/local/bin/ffmpeg" : "ffmpeg";
FFprobe = File.Exists("/tools/ffmpeg/ffprobe") ? "/tools/ffmpeg/ffprobe" : File.Exists("/usr/local/bin/ffprobe") ? "/usr/local/bin/ffprobe" : "ffprobe";
args.GetToolPathActual = (tool) =>
{
if(tool.ToLowerInvariant().Contains("ffmpeg")) return FFmpeg;
if(tool.ToLowerInvariant().Contains("ffprobe")) return FFprobe;
return tool;
};
args.TempPath = TempPath;
return args;
}
}
#endif