Exemplo n.º 1
0
        public void AutoConvert_Verify()
        {
            var setting = new AutoConvert();

            Assert.DoesNotThrow(() => SettingSerializer.Serialize(setting));
            Assert.Equal(SettingSerializer.Serialize(setting), "-auto_convert 1");
        }
Exemplo n.º 2
0
        public void QualityScaleAudio_Verify()
        {
            var setting = new QualityScaleAudio(1);

            Assert.DoesNotThrow(() => SettingSerializer.Serialize(setting));
            Assert.Equal(SettingSerializer.Serialize(setting), "-q:a 1");
        }
Exemplo n.º 3
0
        public void AspectRatio_Verify()
        {
            var setting = new AspectRatio(Ratio.Create(1, 1));

            Assert.DoesNotThrow(() => SettingSerializer.Serialize(setting));
            Assert.Equal(SettingSerializer.Serialize(setting), "-aspect 1:1");
        }
Exemplo n.º 4
0
        public void TrimShortest_Verify()
        {
            var setting = new TrimShortest();

            Assert.DoesNotThrow(() => SettingSerializer.Serialize(setting));
            Assert.Equal(SettingSerializer.Serialize(setting), "-shortest");
        }
Exemplo n.º 5
0
        public void OverwriteOutput_Verify()
        {
            var setting = new OverwriteOutput();

            Assert.DoesNotThrow(() => SettingSerializer.Serialize(setting));
            Assert.Equal(SettingSerializer.Serialize(setting), "-y");
        }
Exemplo n.º 6
0
        public void RemoveAudio_Verify()
        {
            var setting = new RemoveAudio();

            Assert.DoesNotThrow(() => SettingSerializer.Serialize(setting));
            Assert.Equal(SettingSerializer.Serialize(setting), "-an");
        }
Exemplo n.º 7
0
        public void Input_Verify()
        {
            var setting = new Input(Resource.From("c:\\apple.mp4"));

            Assert.DoesNotThrow(() => SettingSerializer.Serialize(setting));
            Assert.Equal(SettingSerializer.Serialize(setting), "-i \"c:/apple.mp4\"");
        }
Exemplo n.º 8
0
        public void Size_Verify()
        {
            var setting = new Size(852, 480);

            Assert.DoesNotThrow(() => SettingSerializer.Serialize(setting));
            Assert.Equal(SettingSerializer.Serialize(setting), "-s 852x480");
        }
Exemplo n.º 9
0
        public void CopyTimestamps_Verify()
        {
            var setting = new CopyTimestamps();

            Assert.DoesNotThrow(() => SettingSerializer.Serialize(setting));
            Assert.Equal(SettingSerializer.Serialize(setting), "-copyts");
        }
Exemplo n.º 10
0
        public void Level_Verify()
        {
            var settingWrong1 = new Level(-1);
            var setting       = new Level(3.1);

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Equal("-level 3.1", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 11
0
        public void BitStreamFilterVideo_Verify()
        {
            var settingWrong1 = new BitStreamFilterVideo("");
            var setting       = new BitStreamFilterVideo("aac_adtstoasc");

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Equal("-bsf:v aac_adtstoasc", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 12
0
        public void Duration_Verify()
        {
            var settingWrong1 = new DurationInput(0);
            var setting       = new DurationInput(2);

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Equal("-t 00:00:02.0", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 13
0
        public void FrameRate_Verify()
        {
            var settingWrong1 = new FrameRate();
            var setting       = new FrameRate(29.97);

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Equal("-r 29.97", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 14
0
        public void QualityScaleVideo_Verify()
        {
            var setting = new QualityScaleVideo(1);

            Assert.Throws <ArgumentException>(() => new QualityScaleAudio(0));
            Assert.Throws <ArgumentException>(() => new QualityScaleAudio(32));
            Assert.Equal("-q:v 1", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 15
0
        public void BitrateAudio_Verify()
        {
            var settingWrong1 = new BitRateAudio(0);
            var setting       = new BitRateAudio(1100);

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Equal("-b:a 1100k", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 16
0
        public void BitStreamFilterAudio_Verify()
        {
            var settingWrong1 = new BitStreamFilterAudio("");
            var setting       = new BitStreamFilterAudio("aac_adtstoasc");

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.DoesNotThrow(() => SettingSerializer.Serialize(setting));
            Assert.Equal(SettingSerializer.Serialize(setting), "-bsf:a aac_adtstoasc");
        }
Exemplo n.º 17
0
        public void BitRateVideo_Verify()
        {
            var settingWrong1 = new BitRateVideo(0);
            var setting       = new BitRateVideo(1100);

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.DoesNotThrow(() => SettingSerializer.Serialize(setting));
            Assert.Equal(SettingSerializer.Serialize(setting), "-b:v 1100k");
        }
Exemplo n.º 18
0
        public void WriteCommand(FFprobeCommand command)
        {
            var inputResource = new Input(command.Resource);

            BuilderBase.Append(" ");
            BuilderBase.Append(SettingSerializer.Serialize(inputResource));

            command.Settings.ForEach(WriteSerializerSpecifier);
        }
Exemplo n.º 19
0
        public void ProfileVideo_Verify()
        {
            var settingWrong1 = new ProfileVideo(string.Empty);
            var settingWrong2 = new ProfileVideo("  ");
            var setting       = new ProfileVideo("baseline");

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong2); });
            Assert.Equal("-profile:v baseline", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 20
0
        public void SeekPositionInput_Verify()
        {
            var settingWrong1 = new SeekPositionInput(0);
            var settingWrong2 = new SeekPositionInput(-1);
            var setting       = new SeekPositionInput(120);

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong2); });
            Assert.Equal("-ss 00:02:00.0", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 21
0
        public void PixelFormat_Verify()
        {
            var settingWrong1 = new PixelFormat(string.Empty);
            var settingWrong2 = new PixelFormat("  ");
            var setting       = new PixelFormat("yuv420p");

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong2); });
            Assert.Equal("-pix_fmt yuv420p", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 22
0
        public void Channels_Verify()
        {
            var settingWrong1 = new ChannelOutput(0);
            var settingWrong2 = new ChannelOutput(-1);
            var setting       = new ChannelOutput(1);

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong2); });
            Assert.Equal("-ac 1", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 23
0
        public void CodecAudio_Verify()
        {
            var settingWrong1 = new CodecAudio(string.Empty);
            var settingWrong2 = new CodecAudio("  ");
            var setting       = new CodecAudio(AudioCodecType.LibFdk_Aac);

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong2); });
            Assert.Equal("-c:a libfdk_aac", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 24
0
        public void ConstantRateFactor_Verify()
        {
            var settingWrong1 = new ConstantRateFactor(-1);
            var settingWrong2 = new ConstantRateFactor(60);
            var setting       = new ConstantRateFactor(18);

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong2); });
            Assert.Equal("-crf 18", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 25
0
        public void FormatOutput_Verify()
        {
            var settingWrong1 = new FormatOutput(string.Empty);
            var settingWrong2 = new FormatOutput("  ");
            var setting       = new FormatOutput("mp4");

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong2); });
            Assert.Equal("-f mp4", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 26
0
        public void CodecVideo_Verify()
        {
            var settingWrong1 = new CodecVideo(string.Empty);
            var settingWrong2 = new CodecVideo("  ");
            var setting       = new CodecVideo(VideoCodecType.Libx264);

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong2); });
            Assert.Equal("-c:v libx264", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 27
0
        public void MovFlags_Verify()
        {
            var settingWrong1 = new MovFlags(string.Empty);
            var settingWrong2 = new MovFlags("  ");
            var setting       = new MovFlags(MovFlags.EnableFastStart);

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong2); });
            Assert.Equal("-movflags +faststart", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 28
0
        public void Map_Verify()
        {
            var settingWrong1 = new Map(string.Empty);
            var settingWrong2 = new Map("  ");
            var setting       = new Map("output1");

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong2); });
            Assert.Equal("-map [output1]", SettingSerializer.Serialize(setting));
        }
Exemplo n.º 29
0
        public void StartAt_Verify()
        {
            var settingWrong1 = new StartAt(0);
            var settingWrong2 = new StartAt(-1);
            var setting       = new StartAt(120);

            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); });
            Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong2); });
            Assert.DoesNotThrow(() => SettingSerializer.Serialize(setting));
            Assert.Equal(SettingSerializer.Serialize(setting), "-ss 00:02:00.0");
        }
Exemplo n.º 30
0
        public void FrameDropThreshold_Verify()
        {
            var setting1 = new FrameDropThreshold()
            {
                Threshold = 0
            };
            var setting2 = new FrameDropThreshold(0);

            Assert.Equal("-frame_drop_threshold 0", SettingSerializer.Serialize(setting1));
            Assert.Equal("-frame_drop_threshold 0", SettingSerializer.Serialize(setting2));
        }