예제 #1
0
        public void GetFrameCount_InvalidFile_ReturnsZero(string source)
        {
            var Info = SetupInfo();
            var Src  = AppPaths.GetInputFile(source);

            var Count = Info.GetFrameCount(Src);

            Assert.Equal(0, Count);
        }
예제 #2
0
        public void GetFrameCount_Valid_ReturnsFrameCount(string source)
        {
            var Info = SetupInfo();
            var Src  = AppPaths.GetInputFile(source);

            var Count = Info.GetFrameCount(Src);

            Assert.True(Count > 0, "Frame count should be a positive number.");
        }
예제 #3
0
        public void Truncate_Invalid_StatusFailed(string source, string destExt, TimeSpan?startPos, TimeSpan?duration)
        {
            string Src   = AppPaths.GetInputFile(source);
            string Dest  = AppPaths.PrepareDestPath("Truncate", source, destExt);
            var    Muxer = SetupMuxer();

            var Result = Muxer.Truncate(Src, Dest, startPos, duration);

            Assert.Equal(CompletionStatus.Failed, Result);
        }
예제 #4
0
        public void Concatenate_Invalid_StatusFailed(IEnumerable <string> source, string destExt)
        {
            List <string> Src   = source.Select(x => AppPaths.GetInputFile(x)).ToList();
            string        Dest  = AppPaths.PrepareDestPath("Concatenate", source.First(), destExt);
            var           Muxer = SetupMuxer();

            var Result = Muxer.Concatenate(Src, Dest);

            Assert.Equal(CompletionStatus.Failed, Result);
        }
예제 #5
0
        public void ExtractVideo_WrongExtension_StatusFailed(string source, string destExt)
        {
            string Src   = AppPaths.GetInputFile(source);
            string Dest  = AppPaths.PrepareDestPath("ExtractVideo", source, destExt);
            var    Muxer = SetupMuxer();

            var Result = Muxer.ExtractVideo(Src, Dest);

            Assert.Equal(CompletionStatus.Failed, Result);
            Assert.False(File.Exists(Dest));
        }
예제 #6
0
        public void ExtractVideo_Valid_Success(string source, string destExt)
        {
            string Src   = AppPaths.GetInputFile(source);
            string Dest  = AppPaths.PrepareDestPath("ExtractVideo", source, destExt);
            var    Muxer = SetupMuxer();

            var Result = Muxer.ExtractVideo(Src, Dest);

            Assert.Equal(CompletionStatus.Success, Result);
            Assert.True(File.Exists(Dest));
        }
예제 #7
0
        public void GetFileInfo_InvalidFile_ReturnsWorkerWithEmptyStreamList(string source)
        {
            var Info = SetupInfo();
            var Src  = AppPaths.GetInputFile(source);

            var Worker = Info.GetFileInfo(Src);

            output.WriteLine(Worker.Output);
            Assert.NotNull(Worker.FileStreams);
            Assert.Empty(Worker.FileStreams);
        }
예제 #8
0
        public void GetFileInfo_Valid_ReturnsWorkerWithStreams(string source, int streamCount)
        {
            var Info = SetupInfo();
            var Src  = AppPaths.GetInputFile(source);

            var Worker = Info.GetFileInfo(Src);

            output.WriteLine(Worker.Output);
            Assert.NotNull(Worker.FileStreams);
            Assert.Equal(streamCount, Worker.FileStreams.Count());
        }
예제 #9
0
        public void Muxe_List_Invalid_ReturnsStatusFailed(IEnumerable <FFmpegStream> fileStreams, string destExt, int streamCount)
        {
            string Dest = AppPaths.PrepareDestPath("MuxeFailed", fileStreams.First().Path, destExt);

            foreach (var item in fileStreams)
            {
                item.Path = AppPaths.GetInputFile(item.Path);
            }
            var Muxer = SetupMuxer();

            var Result = Muxer.Muxe(fileStreams, Dest);

            Assert.Equal(CompletionStatus.Failed, Result);
        }
예제 #10
0
        public void Muxe_Simple_Valid_Success(string videoFile, string audioFile, string destExt, int streamCount)
        {
            string SrcVideo = AppPaths.GetInputFile(videoFile);
            string SrcAudio = AppPaths.GetInputFile(audioFile);
            string Dest     = AppPaths.PrepareDestPath("Muxe", videoFile, destExt);
            var    Muxer    = SetupMuxer();

            var Result = Muxer.Muxe(SrcVideo, SrcAudio, Dest);

            Assert.Equal(CompletionStatus.Success, Result);
            Assert.True(File.Exists(Dest));
            var FileInfo = GetFileInfo(Dest);

            Assert.Equal(streamCount, FileInfo.FileStreams.Count);
        }
예제 #11
0
        public void Muxe_List_Valid_Success(IEnumerable <FFmpegStream> fileStreams, string destExt, int streamCount)
        {
            string Dest = AppPaths.PrepareDestPath("MuxeList", fileStreams.First().Path, destExt);

            foreach (var item in fileStreams)
            {
                item.Path = AppPaths.GetInputFile(item.Path);
            }
            var Muxer = SetupMuxer();

            var Result = Muxer.Muxe(fileStreams, Dest);

            Assert.Equal(CompletionStatus.Success, Result);
            Assert.True(File.Exists(Dest));
            var FileInfo = GetFileInfo(Dest);

            Assert.Equal(streamCount, FileInfo.FileStreams.Count);
        }
예제 #12
0
        public void Truncate_Valid_Success(string source, string destExt, TimeSpan?startPos, TimeSpan?duration)
        {
            string                     Src     = AppPaths.GetInputFile(source);
            string                     Dest    = AppPaths.PrepareDestPath("Truncate", source, destExt);
            var                        Muxer   = SetupMuxer();
            IProcessManager            Manager = null;
            ProcessStartedEventHandler Started = (s, e) => Manager = e.ProcessManager;

            var Result = Muxer.Truncate(Src, Dest, startPos, duration, null, Started);

            output.WriteLine(Manager.CommandWithArgs);
            output.WriteLine(Manager.Output);
            Assert.Equal(CompletionStatus.Success, Result);
            Assert.True(File.Exists(Dest));
            var FileInfo = GetFileInfo(Dest);

            if (duration.HasValue)
            {
                Assert.True(Math.Abs((duration.Value - FileInfo.FileDuration).TotalSeconds) < .1, "Truncate did not produce expected file duration.");
            }
        }