コード例 #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);
        }
コード例 #2
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.");
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        public void ConvertToAviUtVideo_Invalid_Failure(string source, bool audio)
        {
            var srcVideo = AppPaths.GetInputFile(source);
            var dest     = AppPaths.PrepareDestPath("ConvertToAvi", source, AviExt);
            var encoder  = SetupEncoder();

            var result = encoder.ConvertToAviUtVideo(srcVideo, dest, audio, null, _feed.RunCallback);

            Assert.Equal(CompletionStatus.Failed, result);
        }
コード例 #5
0
        public void EncodeVapourSynthToX265_Invalid_Failure(string source, string encodeArgs)
        {
            var srcVideo = AppPaths.GetInputFile(source);
            var dest     = AppPaths.PrepareDestPath("EncodeVapourSynthToX265", source, Mp4Ext);
            var encoder  = SetupEncoder();

            var result = encoder.EncodeVapourSynthToX265(srcVideo, dest, encodeArgs, null, _feed.RunCallback);

            Assert.Equal(CompletionStatus.Failed, result);
        }
コード例 #6
0
        public void EncodeAvisynthToFFmpeg_Invalid_Failure(string source, string destExt, string videoCodec, string audioCodec, string encodeArgs)
        {
            var srcVideo = AppPaths.GetInputFile(source);
            var dest     = AppPaths.PrepareDestPath("EncodeAvisynthToFFmpeg", source, destExt);
            var encoder  = SetupEncoder();

            var result = encoder.EncodeAvisynthToFFmpeg(srcVideo, dest, videoCodec, audioCodec, encodeArgs, null, _feed.RunCallback);

            Assert.Equal(CompletionStatus.Failed, result);
        }
コード例 #7
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);
        }
コード例 #8
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);
        }
コード例 #9
0
        public void Concatenate_Invalid_StatusFailed(IEnumerable <string> source, string destExt)
        {
            var src   = source.Select(x => AppPaths.GetInputFile(x)).ToList();
            var dest  = AppPaths.PrepareDestPath("Concatenate", source.First(), destExt);
            var muxer = SetupMuxer();

            var result = muxer.Concatenate(src, dest, null, _feed.RunCallback);

            Assert.Equal(CompletionStatus.Failed, result);
        }
コード例 #10
0
        public void Truncate_Invalid_StatusFailed(string source, string destExt, TimeSpan?startPos, TimeSpan?duration)
        {
            var src   = AppPaths.GetInputFile(source);
            var 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);
        }
コード例 #11
0
        public void ExtractVideo_Valid_Success(string source, string destExt)
        {
            var src   = AppPaths.GetInputFile(source);
            var 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));
        }
コード例 #12
0
        public void ConvertToAviUtVideo_Valid_Success(string source, bool audio, int streamCount)
        {
            var srcVideo = AppPaths.GetInputFile(source);
            var 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);
        }
コード例 #13
0
        public void EncodeFFmpeg_Valid_Success(string source, string destExt, string videoCodec, string audioCodec, string encodeArgs, int streamCount)
        {
            var srcVideo = AppPaths.GetInputFile(source);
            var 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);
        }
コード例 #14
0
        public void ExtractVideo_WrongExtension_StatusFailed(string source, string destExt)
        {
            var src   = AppPaths.GetInputFile(source);
            var 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));
        }
コード例 #15
0
        public void EncodeAvisynthToX265_Valid_Success(string source, string encodeArgs)
        {
            var srcVideo = AppPaths.GetInputFile(source);
            var 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);
        }
コード例 #16
0
        public void RunVapourSynthToEncoder_AppX264_Success(string videoFile, string destExt)
        {
            var srcVideo = AppPaths.GetInputFile(videoFile);
            var dest     = AppPaths.PrepareDestPath("RunVapourSynthToX264", videoFile, destExt);
            var args     = Invariant($@"--demuxer y4m --preset ultrafast  -o ""{dest}"" -");
            var manager  = SetupManager();

            var result = manager.RunVapourSynthToEncoder(srcVideo, args, EncoderApp.x264);

            Assert.Equal(CompletionStatus.Success, result);
            Assert.True(File.Exists(dest));
        }
コード例 #17
0
        public void Muxe_List_Invalid_ReturnsStatusFailed(IEnumerable <MediaStream> fileStreams, string destExt, int _)
        {
            var 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);
        }
コード例 #18
0
        public void Muxe_Simple_Valid_Success(string videoFile, string audioFile, string destExt, int streamCount)
        {
            var srcVideo = AppPaths.GetInputFile(videoFile);
            var srcAudio = AppPaths.GetInputFile(audioFile);
            var 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);
        }
コード例 #19
0
        public void Muxe_List_Valid_Success(IEnumerable <MediaStream> fileStreams, string destExt, int streamCount)
        {
            var 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);
        }
コード例 #20
0
        public void Truncate_Valid_Success(string source, string destExt, TimeSpan?startPos, TimeSpan?duration)
        {
            var            src     = AppPaths.GetInputFile(source);
            var            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.");
            }
        }