Ejemplo n.º 1
0
        private void TestCodec(CodecUI UI, Bitmap bitmap, BitmapData bmpData, Rectangle scanArea, Size ImgSize)
        {
            int i = 0;

            /*Bitmap bmp = (Bitmap)Bitmap.FromFile(@"D:\DragonBox\wallpapers\Space-HD-Wallpaper_Pack2-12.jpg");
             * Bitmap bmp2 = (Bitmap)Bitmap.FromFile(@"D:\DragonBox\wallpapers\Penguin FlyingCat.png");
             * Bitmap bmpClone = (Bitmap)bmp.Clone();
             * Bitmap bmp2Clone = (Bitmap)bmp2.Clone();
             *
             *
             * bool switcher = false;
             *
             * //byte[] temp = new FastBitmap(bmp).ToByteArray();
             *
             * BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, bmp.PixelFormat);
             * BitmapData bmpData2 = bmp2.LockBits(new Rectangle(0, 0, bmp2.Width, bmp2.Height), ImageLockMode.ReadWrite, bmp2.PixelFormat);
             *
             * while (true)
             * {
             *  Bitmap bmp = CaptureScreen();
             *  bmp.Save(@"C:\images\" + i + ".png");
             *  bmp.Dispose();
             *  i++;
             * }*/


            if (UI.UnsafeCodec != null)
            {
                UI.RenderBitmap(bmpData.Scan0, bitmap, scanArea, ImgSize, bitmap.PixelFormat);
            }
            else
            {
                UI.RenderBitmap(IntPtr.Zero, bitmap, scanArea, ImgSize, bitmap.PixelFormat);
            }
            UpdateCodecList(UI);

            /*foreach (string file in Directory.GetFiles(@"C:\images\310.to.Yuma.2007.1080p.BrRip.x264.BOKUTOX (6-4-2014 3-43-10 PM)\", "*.*", SearchOption.TopDirectoryOnly))
             * {
             *  Bitmap bmp = (Bitmap)Bitmap.FromFile(file);
             *  //Bitmap bmpClone = (Bitmap)bmp.Clone();
             *
             *  //Bitmap bmp = CaptureScreen();
             *  BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, bmp.PixelFormat);
             *
             *  if (UI.UnsafeCodec != null)
             *  {
             *      Bitmap bmpClone = (Bitmap)bmp.Clone();
             *      UI.RenderBitmap(bmpData.Scan0, bmpClone, new Rectangle(0, 0, bmp.Width, bmp.Height), new Size(bmp.Width, bmp.Height), bmp.PixelFormat);
             *      bmpClone.Dispose();
             *  }
             *  else
             *  {
             *      UI.RenderBitmap(IntPtr.Zero, bmp, new Rectangle(0, 0, bmp.Width, bmp.Height), new Size(bmp.Width, bmp.Height), bmp.PixelFormat);
             *  }
             *  UpdateCodecList(UI);
             * }*/
        }
Ejemplo n.º 2
0
        public void AddCodecList(CodecUI UI)
        {
            if (UI.UnsafeCodec == null && UI.VideoCodec == null)
            {
                return;
            }

            listView1.Items.Add(new ListViewItem(new string[]
            {
                UI.IsUnsafe?UI.UnsafeCodec.GetType().Name: UI.VideoCodec.GetType().Name,
                "0",
                "0",
                "0",
                "0",
            })
            {
                Tag = UI
            });
        }
Ejemplo n.º 3
0
        public void UpdateCodecList(CodecUI UI, bool ForceUpdate = false)
        {
            if (RefreshSW.ElapsedMilliseconds <= 1000 && !ForceUpdate)
            {
                return;
            }

            this.Invoke(new Invoky(() =>
            {
                for (int i = 0; i < listView1.Items.Count; i++)
                {
                    ListViewItem item = listView1.Items[i];
                    if ((UI.IsUnsafe ? UI.UnsafeCodec.GetType().Name : UI.VideoCodec.GetType().Name) == item.SubItems[0].Text)
                    {
                        item.SubItems[1].Text = UI.VideoFPS.ToString();
                        item.SubItems[2].Text = UI.FrameCount.ToString();
                        item.SubItems[3].Text = Math.Round((((float)UI.SpeedPerSec / 1000F) / 1000F), 2) + "MB";
                        item.SubItems[4].Text = Math.Round((((float)UI.StreamedSize / 1000F) / 1000F), 2) + "MB";
                    }
                }
            }));
            RefreshSW = Stopwatch.StartNew();
        }