Esempio n. 1
0
        /// <summary>
        /// merges the current setting into the set based on the merge option type
        /// </summary>
        public SettingsCollection Merge <TSetting>(TSetting setting, FFmpegMergeOptionType option)
            where TSetting : ISetting
        {
            if (setting == null)
            {
                throw new ArgumentNullException("setting");
            }

            var alreadyContainsSetting = Contains(setting);

            if (alreadyContainsSetting)
            {
                if (option == FFmpegMergeOptionType.NewWins)
                {
                    Remove(setting);
                    Add(setting);
                }
            }
            else
            {
                Add(setting);
            }

            return(this);
        }
Esempio n. 2
0
        /// <summary>
        /// merges the current SettingsCollection into the set based on the merge option type.
        /// </summary>
        public SettingsCollection MergeRange(SettingsCollection settings, FFmpegMergeOptionType option)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (settings.Type != Type)
            {
                throw new ArgumentException(string.Format("Settings parameter must be of the same type {0} as the SettingsCollection.", Type));
            }

            settings.SettingsList.ForEach(s => Merge(s, option));
            return(this);
        }
Esempio n. 3
0
        /// <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 ForStreamCollection <TCollection> Merge <TItem>(TItem item, FFmpegMergeOptionType optionType)
            where TItem : TCollection
        {
            var applierType = item.GetType();

            if (!AttributeValidation.AttributeTypeEquals(applierType, _restrictedType))
            {
                throw new ForStreamInvalidException(applierType, _restrictedType);
            }

            var indexOfItem = IndexOf(item);

            if (indexOfItem != -1 && optionType == FFmpegMergeOptionType.NewWins)
            {
                _collection.RemoveAt(indexOfItem);
                _collection.Insert(indexOfItem, item);
            }
            else if (indexOfItem == -1)
            {
                _collection.Add(item);
            }

            return(this);
        }
Esempio n. 5
0
        /// <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;
        }