mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2025-12-31 04:09:32 -06:00
adding error handling around videoinfo and making it readonly for ffmpeg builder model
This commit is contained in:
@@ -5,7 +5,7 @@ namespace FileFlows.VideoNodes.FfmpegBuilderNodes
|
||||
{
|
||||
public abstract class FfmpegBuilderNode: EncodingNode
|
||||
{
|
||||
private const string MODEL_KEY = "FfmpegBuilderModel";
|
||||
protected const string MODEL_KEY = "FfmpegBuilderModel";
|
||||
|
||||
public override int Inputs => 1;
|
||||
public override int Outputs => 1;
|
||||
@@ -13,16 +13,6 @@ namespace FileFlows.VideoNodes.FfmpegBuilderNodes
|
||||
public override FlowElementType Type => FlowElementType.BuildPart;
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/video-nodes/ffmpeg-builder";
|
||||
|
||||
private Dictionary<string, object> _Variables;
|
||||
public override Dictionary<string, object> Variables => _Variables;
|
||||
public FfmpegBuilderNode()
|
||||
{
|
||||
_Variables = new Dictionary<string, object>()
|
||||
{
|
||||
{ MODEL_KEY, new FfmpegModel() }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public override bool PreExecute(NodeParameters args)
|
||||
{
|
||||
@@ -32,6 +22,9 @@ namespace FileFlows.VideoNodes.FfmpegBuilderNodes
|
||||
if(this is FfmpegBuilderStart == false && Model == null)
|
||||
throw new Exception("FFMPEG Builder Model not set, you must add and use the \"FFMPEG Builder Start\" node first");
|
||||
|
||||
if (this is FfmpegBuilderStart == false && Model.VideoInfo == null)
|
||||
throw new Exception("FFMPEG Builder VideoInfo is null");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace FileFlows.VideoNodes.FfmpegBuilderNodes;
|
||||
using FileFlows.VideoNodes.FfmpegBuilderNodes.Models;
|
||||
|
||||
namespace FileFlows.VideoNodes.FfmpegBuilderNodes;
|
||||
|
||||
/// <summary>
|
||||
/// Node that starts the FFMPEG Builder
|
||||
@@ -30,6 +32,17 @@ public class FfmpegBuilderStart: FfmpegBuilderNode
|
||||
public override FlowElementType Type => FlowElementType.BuildStart;
|
||||
|
||||
|
||||
|
||||
private Dictionary<string, object> _Variables;
|
||||
public override Dictionary<string, object> Variables => _Variables;
|
||||
public FfmpegBuilderStart()
|
||||
{
|
||||
_Variables = new Dictionary<string, object>()
|
||||
{
|
||||
{ MODEL_KEY, new FfmpegModel(new VideoInfo()) }
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the node
|
||||
/// </summary>
|
||||
|
||||
@@ -56,12 +56,17 @@
|
||||
/// <summary>
|
||||
/// Gets or sets the video information for this video file
|
||||
/// </summary>
|
||||
public VideoInfo VideoInfo { get; set; }
|
||||
public VideoInfo VideoInfo => _VideoInfo;
|
||||
readonly VideoInfo _VideoInfo;
|
||||
|
||||
public FfmpegModel(VideoInfo info)
|
||||
{
|
||||
this._VideoInfo = info;
|
||||
}
|
||||
|
||||
internal static FfmpegModel CreateModel(VideoInfo info)
|
||||
{
|
||||
var model = new FfmpegModel();
|
||||
model.VideoInfo = info;
|
||||
var model = new FfmpegModel(info);
|
||||
model.InputFiles.Add(info.FileName);
|
||||
foreach (var item in info.VideoStreams.Select((stream, index) => (stream, index)))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user