예제 #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
        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));
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #6
0
 public static Filtergraph FilterTo <TStreamType>(this Filtergraph filtergraph, params IFilter[] filters)
     where TStreamType : class, IStream, new()
 {
     return(filtergraph.FilterTo <TStreamType>(1, filters));
 }
예제 #7
0
 private CommandObjects(FFmpegCommand owner)
 {
     Outputs     = new List <CommandOutput>();
     Inputs      = new List <CommandInput>();
     Filtergraph = Filtergraph.Create(owner);
 }
예제 #8
0
        public void Filtergraph_EmptyToString_ThrowsException()
        {
            var filtergraph = Filtergraph.Create(CommandHelper.CreateCommand());

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