public void Process(FilterProcessorContext context) { var firstStream = context.Streams.OfType <VideoStream>().FirstOrDefault(); if (firstStream == null) { throw new InvalidOperationException("Found a spit filter with zero video streams."); } for (var i = context.Filterchain.OutputCount; i < NumberOfStreams; i++) { context.Filterchain.CreateOutput(firstStream.Copy()); } }
public static void ProcessFilters(FFmpegCommand command, Filterchain filterchain) { if (filterchain == null) { throw new ArgumentNullException("filterchain"); } var context = new FilterProcessorContext { Filterchain = filterchain, Streams = filterchain.OutputList.Select(o => o.Stream).ToList() }; filterchain.Filters.ToList().ForEach(filter => { if (!(filter is IFilterProcessor)) { return; } (filter as IFilterProcessor).Process(context); }); }