public void CheckCorrectVideoValueListTest()
        {
            //Arrange
            var serviceConfigurator = Factory.CreateMp4MetadataServiceConfigurator();

            var metadata = new VideoMetadata()
            {
                AudioBps      = serviceConfigurator.AudioBps720P1Channel,
                AudioChannel  = AudioChannel.One,
                AudioCodec    = serviceConfigurator.AudioCodec.Codec,
                AudioProfile  = serviceConfigurator.AudioCodec.DefaultProfile,
                VideoBps      = serviceConfigurator.VideoBps1920X1080,
                VideoCodec    = serviceConfigurator.VideoCodec.Codec,
                VideoProfile  = serviceConfigurator.VideoCodec.DefaultProfile,
                VideoFps      = serviceConfigurator.MaxFps - 1,
                VideoKeyFrame = serviceConfigurator.KeyFrame,
                Width         = 4096,
                Height        = 2304
            };

            var metadataService = new MetadataService(serviceConfigurator, metadata);

            //Act
            metadataService.AdjustKeyFrame();
            metadataService.AdjustVideoBps();
            metadataService.AdjustVideoCodec();
            metadataService.AdjustVideoFps();
            metadataService.AdjustVideoProfile();

            //Assert
            Assert.IsTrue(metadataService.CorrectVideoValueList.All((b) => b.Value));
        }
        public void AdjustVideoFpsSuccessTest()
        {
            //Arrange
            var metadataConfigurator = new MetadataServiceConfigurator(null, null, null, null, null);

            var metadata1 = new VideoMetadata()
            {
                VideoFps = 29.970
            };

            var metadata2 = new VideoMetadata()
            {
                VideoFps = metadataConfigurator.MinFps - 1
            };

            var metadata3 = new VideoMetadata()
            {
                VideoFps = metadataConfigurator.MaxFps + 1
            };

            var metadataService1 = new MetadataService(metadataConfigurator, metadata1);
            var metadataService2 = new MetadataService(metadataConfigurator, metadata2);
            var metadataService3 = new MetadataService(metadataConfigurator, metadata3);

            //Act
            var adjustedFps1 = metadataService1.AdjustVideoFps();

            //Act & Assert
            CustomAssert.IsThrown <MediaFormatException>(() => metadataService2.AdjustVideoFps());
            CustomAssert.IsThrown <MediaFormatException>(() => metadataService3.AdjustVideoFps());

            //Assert
            Assert.AreEqual(metadata1.VideoFps, adjustedFps1);
        }
Exemple #3
0
        public void CheckCorrectVideoValueListTest()
        {
            //Arrange
            MetadataServiceConfigurator serviceConfigurator = Factory.CreateMp4MetadataServiceConfigurator();

            var metadata = new VideoMediaInfo
            {
                AudioBitRate           = serviceConfigurator.AudioBps720P1Channel,
                AudioChannels          = (int)AudioChannel.One,
                AudioFormat            = serviceConfigurator.AudioCodec.Codec,
                AudioFormatProfile     = serviceConfigurator.AudioCodec.DefaultProfile,
                VideoBitRate           = serviceConfigurator.VideoBps1920X1080,
                VideoFormat            = serviceConfigurator.VideoCodec.Codec,
                VideoFormatProfile     = serviceConfigurator.VideoCodec.DefaultProfile,
                VideoFrameRate         = serviceConfigurator.MaxFps - 1,
                VideoFormatSettingsGOP = String.Format("M=1, N={0}", serviceConfigurator.KeyFrame),
                VideoWidth             = 4096,
                VideoHeight            = 2304
            };

            var metadataService = new MetadataService(serviceConfigurator, metadata);

            //Act
            metadataService.AdjustVideoWidth();
            metadataService.AdjustVideoHeight();
            metadataService.AdjustKeyFrame();
            metadataService.AdjustVideoBps();
            metadataService.AdjustVideoCodec();
            metadataService.AdjustVideoFps();
            metadataService.AdjustVideoProfile();

            //Assert
            Assert.IsTrue(metadataService.CorrectVideoValueList.All((b) => b.Value));
        }
        public void CheckCorrectVideoValueListTest()
        {
            //Arrange
            var serviceConfigurator = Factory.CreateMp4MetadataServiceConfigurator();

            var metadata = new VideoMetadata()
            {
                AudioBps = serviceConfigurator.AudioBps720P1Channel,
                AudioChannel = AudioChannel.One,
                AudioCodec = serviceConfigurator.AudioCodec.Codec,
                AudioProfile = serviceConfigurator.AudioCodec.DefaultProfile,
                VideoBps = serviceConfigurator.VideoBps1920X1080,
                VideoCodec = serviceConfigurator.VideoCodec.Codec,
                VideoProfile = serviceConfigurator.VideoCodec.DefaultProfile,
                VideoFps = serviceConfigurator.MaxFps - 1,
                VideoKeyFrame = serviceConfigurator.KeyFrame,
                Width = 4096,
                Height = 2304
            };

            var metadataService = new MetadataService(serviceConfigurator, metadata);

            //Act
            metadataService.AdjustKeyFrame();
            metadataService.AdjustVideoBps();
            metadataService.AdjustVideoCodec();
            metadataService.AdjustVideoFps();
            metadataService.AdjustVideoProfile();

            //Assert
            Assert.IsTrue(metadataService.CorrectVideoValueList.All((b) => b.Value));
        }
        public void AdjustVideoFpsSuccessTest()
        {
            //Arrange
            var metadataConfigurator = new MetadataServiceConfigurator(null, null, null, null, null);

            var metadata1 = new VideoMetadata()
                                {
                                    VideoFps = 29.970
                                };

            var metadata2 = new VideoMetadata()
                                {
                                    VideoFps = metadataConfigurator.MinFps - 1
                                };

            var metadata3 = new VideoMetadata()
                                {
                                    VideoFps = metadataConfigurator.MaxFps + 1
                                };

            var metadataService1 = new MetadataService(metadataConfigurator, metadata1);
            var metadataService2 = new MetadataService(metadataConfigurator, metadata2);
            var metadataService3 = new MetadataService(metadataConfigurator, metadata3);

            //Act
            var adjustedFps1 = metadataService1.AdjustVideoFps();
            
            //Act & Assert
            CustomAssert.IsThrown<MediaFormatException>(() => metadataService2.AdjustVideoFps());
            CustomAssert.IsThrown<MediaFormatException>(() =>metadataService3.AdjustVideoFps());

            //Assert
            Assert.AreEqual(metadata1.VideoFps, adjustedFps1);
        }
        public void CheckCorrectVideoValueListTest()
        {
            //Arrange
            MetadataServiceConfigurator serviceConfigurator = Factory.CreateMp4MetadataServiceConfigurator();

            var metadata = new VideoMediaInfo
                {
                    AudioBitRate = serviceConfigurator.AudioBps720P1Channel,
                    AudioChannels = (int) AudioChannel.One,
                    AudioFormat = serviceConfigurator.AudioCodec.Codec,
                    AudioFormatProfile = serviceConfigurator.AudioCodec.DefaultProfile,
                    VideoBitRate = serviceConfigurator.VideoBps1920X1080,
                    VideoFormat = serviceConfigurator.VideoCodec.Codec,
                    VideoFormatProfile = serviceConfigurator.VideoCodec.DefaultProfile,
                    VideoFrameRate = serviceConfigurator.MaxFps - 1,
                    VideoFormatSettingsGOP = String.Format("M=1, N={0}", serviceConfigurator.KeyFrame),
                    VideoWidth = 4096,
                    VideoHeight = 2304
                };

            var metadataService = new MetadataService(serviceConfigurator, metadata);

            //Act
            metadataService.AdjustVideoWidth();
            metadataService.AdjustVideoHeight();
            metadataService.AdjustKeyFrame();
            metadataService.AdjustVideoBps();
            metadataService.AdjustVideoCodec();
            metadataService.AdjustVideoFps();
            metadataService.AdjustVideoProfile();

            //Assert
            Assert.IsTrue(metadataService.CorrectVideoValueList.All((b) => b.Value));
        }