Esempio n. 1
0
 void LoadVideo(string path)
 {
     //var inputPath = @"C:\Users\Adib\Downloads\PL2.mods";
     //var inputPath = @"C:\ffmpeg\OP.moflex";
     frames  = MobiContainer.Demux(path).GetEnumerator();
     decoder = null;
     nextToolStripMenuItem_Click(null, null);
     BackgroundImageLayout = ImageLayout.None;
     SetInfo(null);
     //pictureBox1.Image = new MobiDecoder(frame0.Width, frame0.Height).Parse(frame0.Stream);
 }
Esempio n. 2
0
        private void nextToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (frames == null)
            {
                return;
            }
            if (!frames.MoveNext())
            {
                return;
            }
            var frame = frames.Current;

            table = new PredictInfo[frame.Width, frame.Height];
            if (decoder == null)
            {
                decoder = new MobiDecoder(frame.Width, frame.Height);
            }
            //var frameImage = decoder.Parse(frame.Stream);
            scale = Math.Min(pictureBox1.Width / frame.Width, pictureBox1.Height / frame.Height);
            if (scale == 0)
            {
                scale = 1;
            }
            var bmp = BlowUp(decoder.Parse(frame.Stream), scale);

            if (decoder.predictInfos.Any())
            {
                using (var g = Graphics.FromImage(bmp))
                {
                    foreach (var info in decoder.predictInfos)
                    {
                        g.DrawRectangle(Pens.Red, scale * info.x, scale * info.y, scale * info.width, scale * info.height);
                        for (int y = 0; y < info.height; y++)
                        {
                            for (int x = 0; x < info.width; x++)
                            {
                                //if (table[x + info.x, y + info.y] != null) throw new Exception();
                                table[x + info.x, y + info.y] = info;
                            }
                        }
                    }
                }
            }
            pictureBox1.BackgroundImage = bmp;
            //BackgroundImage = baseImage;
        }