namespace FileFlows.AudioNodes;
public class ConvertToOGG: ConvertNode
{
///
public override string HelpUrl => "https://fileflows.com/docs/plugins/audio-nodes/convert-to-ogg";
///
protected override string DefaultExtension => "ogg";
public static List BitrateOptions => ConvertNode.BitrateOptions;
///
public override string Icon => "svg:ogg";
///
/// Gets or sets the codec
///
[Select(nameof(CodecOptions), 0)]
public string Codec { get; set; }
///
/// The codec options
///
private static List _CodecOptions;
///
/// Gets the codec options
///
public static List CodecOptions
{
get
{
if (_CodecOptions == null)
{
_CodecOptions = new()
{
new() { Label = "Vorbis",Value = "vorbis" },
new() { Label = "Opus", Value = "opus" }
};
}
return _CodecOptions;
}
}
///
protected override List GetArguments(NodeParameters args, out string? extension)
{
List ffArgs = base.GetArguments(args, out extension);
if (string.Equals(this.Codec, "opus", StringComparison.InvariantCultureIgnoreCase))
{
var index = ffArgs.FindIndex(arg => arg.Equals("libvorbis"));
if (index != -1)
{
ffArgs[index] = "libopus";
args.Logger?.ILog("Replace 'libopus' with 'libvorbis'");
}
else
{
args.Logger?.ILog("Failed to locate libopus in arguments");
}
}
return ffArgs;
}
}