/// <summary> /// merges the given Filterchain to the Filtergraph /// </summary> /// <param name="filterchain">the filterchain to be added to the filtergraph</param> /// <param name="optionType">the option specifying how the merge should declare a winner</param> public Filtergraph Merge(Filterchain filterchain, FFmpegMergeOptionType optionType) { var indexOfItem = IndexOf(filterchain); if (indexOfItem != -1 && optionType == FFmpegMergeOptionType.NewWins) { FilterchainList.RemoveAt(indexOfItem); filterchain.Owner = this; FilterchainList.Insert(indexOfItem, filterchain); } else if (indexOfItem == -1) { Add(filterchain); } return(this); }
public override string ToString() { //perform simple validation on filter graph if (FilterchainList.Count == 0) { throw new InvalidOperationException("Filtergraph must contain at least one Filterchain."); } var filtergraph = new StringBuilder(100); FilterchainList.ForEach(filterchain => { if (filtergraph.Length > 0) { filtergraph.Append(";"); } filtergraph.Append(filterchain.ToString()); }); //return the formatted filter command string return(filtergraph.ToString()); }
/// <summary> /// removes all the Filterchain matching the provided criteria /// </summary> /// <param name="pred">the predicate of required criteria</param> public Filtergraph RemoveAll(Predicate <Filterchain> pred) { FilterchainList.RemoveAll(pred); return(this); }
/// <summary> /// removes the Filterchain at the given index from the Filtergraph /// </summary> /// <param name="index">the index of the desired Filterchain to be removed from the Filtergraph</param> public Filtergraph RemoveAt(int index) { FilterchainList.RemoveAt(index); return(this); }
/// <summary> /// adds the given Filterchain to the Filtergraph /// </summary> /// <param name="filterchain">the filterchain to be added to the filtergraph</param> public Filtergraph Add(Filterchain filterchain) { filterchain.Owner = this; FilterchainList.Add(filterchain); return(this); }
public int IndexOf(Filterchain filterchain) { return(FilterchainList.FindIndex(f => f.Id == filterchain.Id)); }
public bool Contains(Filterchain filterchain) { return(FilterchainList.Any(f => f.Id == filterchain.Id)); }