Example #1
0
        public override void Dispose()
        {
            if (aviWriter != null)
            {
                aviWriter.Dispose();
            }

            base.Dispose();
        }
Example #2
0
        private void StartConsumerThread()
        {
            if (!IsWorking)
            {
                IsWorking = true;

                Helpers.CreateDirectoryIfNotExist(OutputPath);

                AVIWriter aviWriter = new AVIWriter(OutputPath, FPS, Size.Width, Size.Height, ShowOptions);

                task = TaskEx.Run(() =>
                {
                    try
                    {
                        position = 0;

                        while (!imageQueue.IsCompleted)
                        {
                            Image img = null;

                            try
                            {
                                img = imageQueue.Take();

                                if (img != null)
                                {
                                    //img.Save("Test\\" + position + ".bmp", ImageFormat.Bmp);
                                    aviWriter.AddFrame((Bitmap)img);
                                    position++;
                                }
                            }
                            catch (InvalidOperationException)
                            {
                            }
                            finally
                            {
                                if (img != null)
                                {
                                    img.Dispose();
                                }
                            }
                        }
                    }
                    finally
                    {
                        IsWorking = false;

                        if (aviWriter != null)
                        {
                            aviWriter.Dispose();
                        }
                    }
                });
            }
        }
Example #3
0
        public void Dispose()
        {
            if (aviWriter != null)
            {
                aviWriter.Dispose();
            }

            if (imageQueue != null)
            {
                imageQueue.Dispose();
            }
        }