Пример #1
0
        private void WriteFiltergraph(FFmpegCommand command, Filtergraph filtergraph)
        {
            if (filtergraph == null)
            {
                throw new ArgumentNullException("filtergraph");
            }

            var shouldIncludeDelimitor = false;

            filtergraph.FilterchainList.ForEach(filterchain =>
            {
                if (shouldIncludeDelimitor)
                {
                    BuilderBase.Append(";");
                }
                else
                {
                    BuilderBase.Append(" -filter_complex \"");
                    shouldIncludeDelimitor = true;
                }

                WriteFilterchain(command, filterchain);
            });

            if (shouldIncludeDelimitor)
            {
                BuilderBase.Append("\"");
            }
        }
Пример #2
0
        private void WriteFilterchain(FFmpegCommand command, Filterchain filterchain)
        {
            if (filterchain == null)
            {
                throw new ArgumentNullException("filterchain");
            }

            var context = FilterBindingContext.Create(filterchain.InputCount, filterchain.OutputCount);

            WriteFilterchainIn(command, filterchain);

            var shouldIncludeDelimitor = false;

            filterchain.Filters.ToList().ForEach(filter =>
            {
                if (shouldIncludeDelimitor)
                {
                    BuilderBase.Append(",");
                }
                else
                {
                    BuilderBase.Append(" ");
                    shouldIncludeDelimitor = true;
                }

                WriteFilter(filter, context);
            });

            WriteFilterchainOut(filterchain);
        }
Пример #3
0
        private void WriteFilter(IFilter filter, FilterBindingContext context)
        {
            if (filter == null)
            {
                throw new ArgumentNullException("filter");
            }

            BuilderBase.Append(FilterSerializer.Serialize(filter, context));
        }
Пример #4
0
        public void WriteCommand(FFprobeCommand command)
        {
            var inputResource = new Input(command.Resource);

            BuilderBase.Append(" ");
            BuilderBase.Append(SettingSerializer.Serialize(inputResource));

            command.Settings.ForEach(WriteSerializerSpecifier);
        }
Пример #5
0
        private void WriteFilterchainOut(Filterchain filterchain)
        {
            var filterchainOutputs = filterchain.GetStreamIdentifiers();

            filterchainOutputs.ForEach(streamId =>
            {
                BuilderBase.Append(" ");
                BuilderBase.Append(FormattingUtility.Map(streamId.Map));
            });
        }
Пример #6
0
        private void WriteOutputSettings(CommandOutput output)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }

            output.Settings.SettingsList.ForEach(setting =>
            {
                BuilderBase.Append(" ");
                BuilderBase.Append(SettingSerializer.Serialize(setting));
            });
        }
Пример #7
0
        private void WriteResource(CommandInput resource)
        {
            if (resource == null)
            {
                throw new ArgumentNullException("resource");
            }

            WriteResourcePreSettings(resource);

            var inputResource = new Input(resource.Resource);

            BuilderBase.Append(" ");
            BuilderBase.Append(SettingSerializer.Serialize(inputResource));

            WriteResourcePostSettings(resource);
        }
Пример #8
0
        private void WriteResourcePostSettings(CommandInput resource)
        {
            if (resource == null)
            {
                throw new ArgumentNullException("resource");
            }

            resource.Settings.SettingsList.ForEach(setting =>
            {
                if (!setting.IsPostSetting())
                {
                    return;
                }

                BuilderBase.Append(" ");
                BuilderBase.Append(SettingSerializer.Serialize(setting));
            });
        }
Пример #9
0
 private void WriteFilterchainIn(FFmpegCommand command, Filterchain filterchain)
 {
     filterchain.ReceiptList.ForEach(streamId =>
     {
         BuilderBase.Append(" ");
         var indexOfResource = command.Objects.Inputs.FindIndex(inputs => inputs.GetStreamIdentifiers().Any(s => s.Map == streamId.Map));
         if (indexOfResource >= 0)
         {
             var commandResource = command.Objects.Inputs[indexOfResource];
             var commandStream   = commandResource.Resource.Streams.First(s => s.Map == streamId.Map);
             BuilderBase.Append(FormattingUtility.Map(commandStream, indexOfResource));
         }
         else
         {
             BuilderBase.Append(FormattingUtility.Map(streamId.Map));
         }
     });
 }
Пример #10
0
 public void WriteSerializerSpecifier(ISetting setting)
 {
     BuilderBase.Append(" ");
     BuilderBase.Append(SettingSerializer.Serialize(setting));
 }