コード例 #1
0
ファイル: AVICache.cs プロジェクト: yoykiee/ShareX
        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();
                        }
                    }
                });
            }
        }
コード例 #2
0
        public AVICache(string outputPath, int fps, Size size, bool showOptions = false)
        {
            OutputPath  = outputPath;
            FPS         = fps;
            Size        = size;
            ShowOptions = showOptions;

            Helpers.CreateDirectoryIfNotExist(OutputPath);
            aviWriter  = new AVIWriter(OutputPath, FPS, Size.Width, Size.Height, ShowOptions);
            imageQueue = new BlockingCollection <Image>();
        }
コード例 #3
0
ファイル: AVICache.cs プロジェクト: savannaking/ShareX
 public AVICache(ScreencastOptions options)
 {
     Options = options;
     Helpers.CreateDirectoryIfNotExist(Options.OutputPath);
     aviWriter = new AVIWriter(options);
 }