Exemplo n.º 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("\"");
            }
        }
Exemplo n.º 2
0
        public static Filtergraph FilterTo <TStreamType>(this Filtergraph filtergraph, int count, params IFilter[] filters)
            where TStreamType : class, IStream, new()
        {
            var filterchain = Filterchain.FilterTo <TStreamType>(count, filters);

            return(filtergraph.Add(filterchain));
        }
Exemplo n.º 3
0
        public void Filtergraph_FilterTo()
        {
            var filtergraph = Filtergraph.Create(CommandHelper.CreateCommand());

            filtergraph.FilterTo <VideoStream>();

            Assert.True(filtergraph.Count == 1);

            filtergraph.FilterTo <AudioStream>();

            Assert.True(filtergraph.Count == 2);
        }
Exemplo n.º 4
0
        public void Filtergraph_RemoveAll()
        {
            var filtergraph = Filtergraph.Create(CommandHelper.CreateCommand());

            filtergraph.FilterTo <VideoStream>();
            filtergraph.FilterTo <VideoStream>();

            Assert.True(filtergraph.Count == 2);

            filtergraph.RemoveAll(f => true);

            Assert.True(filtergraph.Count == 0);
        }
Exemplo n.º 5
0
        public void Filtergraph_Add()
        {
            var filtergraph  = Filtergraph.Create(CommandHelper.CreateCommand());
            var filterchain1 = Filterchain.FilterTo <AudioStream>();
            var filterchain2 = Filterchain.FilterTo <VideoStream>();

            filtergraph.Add(filterchain1);

            Assert.True(filtergraph.Count == 1);

            filtergraph.Add(filterchain2);

            Assert.True(filtergraph.Count == 2);
        }
Exemplo n.º 6
0
 public static Filtergraph FilterTo <TStreamType>(this Filtergraph filtergraph, params IFilter[] filters)
     where TStreamType : class, IStream, new()
 {
     return(filtergraph.FilterTo <TStreamType>(1, filters));
 }
Exemplo n.º 7
0
 private CommandObjects(FFmpegCommand owner)
 {
     Outputs     = new List <CommandOutput>();
     Inputs      = new List <CommandInput>();
     Filtergraph = Filtergraph.Create(owner);
 }
Exemplo n.º 8
0
        public void Filtergraph_EmptyToString_ThrowsException()
        {
            var filtergraph = Filtergraph.Create(CommandHelper.CreateCommand());

            Assert.Throws <InvalidOperationException>(() => filtergraph.ToString());
        }