Ejemplo n.º 1
0
        public void GetFrameCount_InvalidFile_ReturnsZero(string source)
        {
            var Info = SetupInfo();
            var Src  = AppPaths.GetInputFile(source);

            var Count = Info.GetFrameCount(Src, null, feed.RunCallback);

            Assert.Equal(0, Count);
        }
        public void RunVapourSynth_Valid_ResultSuccess(string source)
        {
            var Script = SetupScript();
            var Src    = AppPaths.GetInputFile(source);

            var Result = Script.RunVapourSynth(Src, null, feed.RunCallback);

            Assert.Equal(CompletionStatus.Success, Result);
        }
Ejemplo n.º 3
0
        public void GetFrameCount_Valid_ReturnsFrameCount(string source)
        {
            var Info = SetupInfo();
            var Src  = AppPaths.GetInputFile(source);

            var Count = Info.GetFrameCount(Src, null, feed.RunCallback);

            Assert.True(Count > 0, "Frame count should be a positive number.");
        }
Ejemplo n.º 4
0
        public void GetFileInfo_Valid_ReturnsWorkerWithStreams(string source, int streamCount)
        {
            var Info = SetupInfo();
            var Src  = AppPaths.GetInputFile(source);

            var FileInfo = Info.GetFileInfo(Src, null, feed.RunCallback);

            Assert.NotNull(FileInfo.FileStreams);
            Assert.Equal(streamCount, FileInfo.FileStreams.Count());
        }
        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, null, feed.RunCallback);

            Assert.Equal(CompletionStatus.Failed, Result);
        }
Ejemplo n.º 6
0
        public void GetFileInfo_InvalidFile_ReturnsWorkerWithEmptyStreamList(string source)
        {
            var Info = SetupInfo();
            var Src  = AppPaths.GetInputFile(source);

            var FileInfo = Info.GetFileInfo(Src, null, feed.RunCallback);

            Assert.NotNull(FileInfo.FileStreams);
            Assert.Empty(FileInfo.FileStreams);
        }
Ejemplo n.º 7
0
        public void ConvertToAviUtVideo_Invalid_Failure(string source, bool audio)
        {
            string SrcVideo = AppPaths.GetInputFile(source);
            string Dest     = AppPaths.PrepareDestPath("ConvertToAvi", source, AviExt);
            var    Encoder  = SetupEncoder();

            var Result = Encoder.ConvertToAviUtVideo(SrcVideo, Dest, audio, null, feed.RunCallback);

            Assert.Equal(CompletionStatus.Failed, Result);
        }
Ejemplo n.º 8
0
        public void EncodeVapourSynthToX265_Invalid_Failure(string source, string encodeArgs)
        {
            string SrcVideo = AppPaths.GetInputFile(source);
            string Dest     = AppPaths.PrepareDestPath("EncodeVapourSynthToX265", source, Mp4Ext);
            var    Encoder  = SetupEncoder();

            var Result = Encoder.EncodeVapourSynthToX265(SrcVideo, Dest, encodeArgs, null, feed.RunCallback);

            Assert.Equal(CompletionStatus.Failed, Result);
        }
Ejemplo n.º 9
0
        public void EncodeVapourSynthToFFmpeg_Invalid_Failure(string source, string destExt, string videoCodec, string audioCodec, string encodeArgs)
        {
            string SrcVideo = AppPaths.GetInputFile(source);
            string Dest     = AppPaths.PrepareDestPath("EncodeVapourSynthToFFmpeg", source, destExt);
            var    Encoder  = SetupEncoder();

            var Result = Encoder.EncodeVapourSynthToFFmpeg(SrcVideo, Dest, videoCodec, audioCodec, encodeArgs, null, feed.RunCallback);

            Assert.Equal(CompletionStatus.Failed, Result);
        }
        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, null, feed.RunCallback);

            Assert.Equal(CompletionStatus.Failed, Result);
        }
        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, null, feed.RunCallback);

            Assert.Equal(CompletionStatus.Failed, Result);
            Assert.False(File.Exists(Dest));
        }
        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, null, feed.RunCallback);

            Assert.Equal(CompletionStatus.Success, Result);
            Assert.True(File.Exists(Dest));
        }
Ejemplo n.º 13
0
        public void EncodeFFmpeg_Valid_Success(string source, string destExt, string videoCodec, string audioCodec, string encodeArgs, int streamCount)
        {
            string SrcVideo = AppPaths.GetInputFile(source);
            string Dest     = AppPaths.PrepareDestPath("EncodeFFmpeg", source, destExt);
            var    Encoder  = SetupEncoder();

            var Result = Encoder.EncodeFFmpeg(SrcVideo, Dest, videoCodec, audioCodec, encodeArgs, null, feed.RunCallback);

            Assert.Equal(CompletionStatus.Success, Result);
            AssertMedia(Dest, streamCount);
        }
Ejemplo n.º 14
0
        public void ConvertToAviUtVideo_Valid_Success(string source, bool audio, int streamCount)
        {
            string SrcVideo = AppPaths.GetInputFile(source);
            string Dest     = AppPaths.PrepareDestPath("ConvertToAvi", source, AviExt);
            var    Encoder  = SetupEncoder();

            var Result = Encoder.ConvertToAviUtVideo(SrcVideo, Dest, audio, null, feed.RunCallback);

            Assert.Equal(CompletionStatus.Success, Result);
            AssertMedia(Dest, streamCount);
        }
Ejemplo n.º 15
0
        public void EncodeAvisynthToX265_Valid_Success(string source, string encodeArgs)
        {
            string SrcVideo = AppPaths.GetInputFile(source);
            string Dest     = AppPaths.PrepareDestPath("EncodeAvisynthToX265", source, Mp4Ext);
            var    Encoder  = SetupEncoder();

            var Result = Encoder.EncodeAvisynthToX265(SrcVideo, Dest, encodeArgs, null, feed.RunCallback);

            Assert.Equal(CompletionStatus.Success, Result);
            AssertMedia(Dest, 1);
        }
        public void RunVapourSynthToEncoder_AppX264_Success(string videoFile, string destExt)
        {
            string SrcVideo = AppPaths.GetInputFile(videoFile);
            string Dest     = AppPaths.PrepareDestPath("RunVapourSynthToX264", videoFile, destExt);
            string Args     = string.Format(@"--demuxer y4m --preset ultrafast  -o ""{0}"" -", Dest);
            var    Manager  = SetupManager();

            var Result = Manager.RunVapourSynthToEncoder(SrcVideo, Args, EncoderApp.x264);

            Assert.Equal(CompletionStatus.Success, Result);
            Assert.True(File.Exists(Dest));
        }
        public void Muxe_List_Invalid_ReturnsStatusFailed(IEnumerable <MediaStream> 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, null, feed.RunCallback);

            Assert.Equal(CompletionStatus.Failed, Result);
        }
        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, null, feed.RunCallback);

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

            Assert.Equal(streamCount, FileInfo.FileStreams.Count);
        }
        public void Muxe_List_Valid_Success(IEnumerable <MediaStream> 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, null, feed.RunCallback);

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

            Assert.Equal(streamCount, FileInfo.FileStreams.Count);
        }
        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();
            IProcessWorker Manager = null;

            void Started(object s, ProcessStartedEventArgs e)
            {
                Manager = e.ProcessWorker;
                feed.RunCallback(s, e);
            }

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

            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.");
            }
        }