Пример #1
0
        public void VideoSourceSetOutputFormatInvalid()
        {
            Index       index  = new Index("h264_720p_hp_5.1_3mbps_vorbis_styled_and_unstyled_subs_suzumiya.ffindex");
            VideoSource source = index.VideoSource("h264_720p_hp_5.1_3mbps_vorbis_styled_and_unstyled_subs_suzumiya.mkv", 0);

            var list = new List <int>();

            list.Add(FFMS2.GetPixelFormat("none"));
            source.SetOutputFormat(list, 100, 100, Resizer.Bilinear);
        }
Пример #2
0
        public void FrameObjectDisposedCaseFour()
        {
            Index       index  = new Index("h264_720p_hp_5.1_3mbps_vorbis_styled_and_unstyled_subs_suzumiya.ffindex");
            VideoSource source = index.VideoSource("h264_720p_hp_5.1_3mbps_vorbis_styled_and_unstyled_subs_suzumiya.mkv", 0);

            Frame      frame         = source.GetFrame(10);
            List <int> targetFormats = new List <int>();

            targetFormats.Add(FFMS2.GetPixelFormat("bgra"));

            source.SetOutputFormat(targetFormats, frame.EncodedResolution.Width, frame.EncodedResolution.Height, Resizer.Lanczos); // frame is now invalid

            char dummy = frame.FrameType;
        }
Пример #3
0
        public void FrameAndAPIFunctions()
        {
            Index       index  = new Index("h264_720p_hp_5.1_3mbps_vorbis_styled_and_unstyled_subs_suzumiya.ffindex");
            VideoSource source = index.VideoSource("h264_720p_hp_5.1_3mbps_vorbis_styled_and_unstyled_subs_suzumiya.mkv", 0);

            Frame      frame         = source.GetFrame(20);
            List <int> targetFormats = new List <int>();

            targetFormats.Add(FFMS2.GetPixelFormat("bgra"));

            source.SetOutputFormat(targetFormats, frame.EncodedResolution.Width, frame.EncodedResolution.Height, Resizer.Lanczos);
            frame = source.GetFrame(20);

            Assert.AreEqual(704, frame.EncodedResolution.Width);
            Assert.AreEqual(0, frame.EncodedPixelFormat);
            Assert.AreEqual(704, frame.Resolution.Width);
            Assert.AreEqual(FFMS2.GetPixelFormat("bgra"), frame.PixelFormat);
            Assert.AreEqual(false, frame.KeyFrame);
            Assert.AreEqual(0, frame.RepeatPicture);
            Assert.AreEqual(false, frame.InterlacedFrame);
            Assert.AreEqual('P', frame.FrameType);
            Assert.AreEqual(ColorSpace.BT470BG, frame.ColorSpace);
            Assert.AreEqual(ColorRange.MPEG, frame.ColorRange);

            Bitmap bitmap = frame.Bitmap;

            bitmap.Save("frame.png", System.Drawing.Imaging.ImageFormat.Png);
            using (var md5 = MD5.Create())
                using (var stream = File.OpenRead("frame.png"))
                {
                    Assert.AreEqual("36-7F-6A-D6-7A-12-12-EB-8E-4A-3F-DC-D0-F6-F6-13", BitConverter.ToString(md5.ComputeHash(stream)));
                }

            source.SetInputFormat(ColorSpace.RGB);
            frame = source.GetFrame(20);
            Assert.AreEqual(ColorSpace.RGB, frame.ColorSpace);

            source.ResetInputFormat();
            frame = source.GetFrame(20);
            Assert.AreEqual(ColorSpace.BT470BG, frame.ColorSpace);
        }
Пример #4
0
 public void GetPixFmtUTF8()
 {
     FFMS2.GetPixelFormat("おはよう");
 }
Пример #5
0
 public void GetPixFmt()
 {
     Assert.AreNotEqual(-1, FFMS2.GetPixelFormat("yuv420p"));
     Assert.AreEqual(-1, FFMS2.GetPixelFormat("none"));
 }