#if(DEBUG)
using PluginTestLibrary;
using File = System.IO.File;
namespace VideoNodes.Tests;
///
/// Test base dor the video tests
///
public abstract class VideoTestBase : TestBase
{
///
/// The resources test file directory
///
protected static readonly string ResourcesTestFilesDir = "Tests/Resources";
///
/// Video MKV file
///
protected static readonly string VideoMkv = ResourcesTestFilesDir + "/video.mkv";
///
/// Video MP4 file
///
protected static readonly string VideoMp4 = ResourcesTestFilesDir + "/video.mp4";
///
/// Video HEVC MKV file
///
protected static readonly string VideoMkvHevc = ResourcesTestFilesDir + "/hevc.mkv";
///
/// Video 4:7 MKV file
///
protected static readonly string Video4by7 = ResourcesTestFilesDir + "/video4by7.mkv";
///
/// Video 4:3 mp4 file
///
protected static readonly string Video4by3 = ResourcesTestFilesDir + "/video4by3.mp4";
///
/// Video Corrupt file
///
protected static readonly string VideoCorrupt = ResourcesTestFilesDir + "/corrupt.mkv";
///
/// Video with many subtitles file
///
protected static readonly string VideoSubtitles = ResourcesTestFilesDir + "/subtitles.mkv";
///
/// Audio MP3 file
///
protected static readonly string AudioMp3 = ResourcesTestFilesDir + "/audio.mp3";
///
/// 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 VideoMkv if not set
/// if the file is directory
/// the node parameters
public NodeParameters GetVideoNodeParameters(string? filename = null, bool isDirectory = false)
{
filename ??= VideoMkv;
var args = new NodeParameters(filename, Logger, isDirectory, string.Empty, new LocalFileService())
{
LibraryFileName = filename
};
args.InitFile(filename);
FFmpeg = "ffmpeg";
FFprobe = "ffprobe";
foreach (var ffmpegLoc in new string[] { "/tools/ffmpeg/", "/usr/local/bin/", "/usr/bin/" })
{
if (File.Exists(ffmpegLoc + "ffmpeg"))
{
FFmpeg = ffmpegLoc + "ffmpeg";
FFprobe = ffmpegLoc + "ffprobe";
break;
}
}
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