Example #1
0
        public ThreadedEncoder(string filename, BasicEncoderSettings settings, int sourceWidth, int sourceHeight, BasicPixelFormat sourcePixelFormat)
        {
            _settings      = settings;
            _encoder       = new BasicEncoder(filename, settings);
            _frameRescaled = new BasicVideoFrame(settings.Video.Width, settings.Video.Height, settings.Video.PixelFormat);
            for (int i = 0; i < 10; i++)
            {
                _framesFree.Enqueue(new VideoFrame(sourceWidth, sourceHeight, sourcePixelFormat));
            }
            _rescaler = new BasicRescaler(sourceWidth, sourceHeight, sourcePixelFormat, settings.Video.Width, settings.Video.Height, settings.Video.PixelFormat, BasicRescalerFlags.FastBilinear);

            _thread = new Thread(encodingThread);
            _thread.IsBackground = true; // don't prevent program shutting down if the thread is still running
            _thread.Start();
        }
Example #2
0
 public unsafe VideoFrame(int width, int height, BasicPixelFormat pixelFormat)
     : base(width, height, pixelFormat)
 {
     Bitmap   = new Bitmap(1920, 1080, 1920 * 3, System.Drawing.Imaging.PixelFormat.Format24bppRgb, (IntPtr)GetBuffer(0));
     Graphics = Graphics.FromImage(Bitmap);
 }