Exemplo n.º 1
0
        public PreviewBox()
        {
            InitializeComponent();
            Thread capture_thread = new Thread(
                () =>
                {

                    VideoCaptureWrapper wrapper = new VideoCaptureWrapper();
                    wrapper.Init("mv2_001.avi");

                    while (true)
                    {
                        Bitmap frame = wrapper.CaptureFrame();
                        this.Invoke(new MethodInvoker(() =>
                            {
                                this.pb_frame.Image = frame;
                                double current_frame = wrapper.GetCurrentFrames();
                                double total_frame = wrapper.GetTotalFrames();

                                // double ratio = wrapper.GetCurrentMSEC();
                                lbl_ratio.Text = String.Format("{0}/{1}", current_frame, total_frame);
                            }));
                    }
                });
            capture_thread.Start();
        }
Exemplo n.º 2
0
 public bool OpenFile(String filename)
 {
     wrapper = new VideoCaptureWrapper();
     if (wrapper.Init(filename))
     {
         movie_timer.Start();
         int frame_rate = wrapper.GetFrameRate();
         movie_timer.Interval = (int)(1000 / frame_rate);
         this.Play();
         return true;
     }
     return false;
 }