Esempio n. 1
0
        /// <summary>
        /// Prepare the JPEG at the passed slot index.
        /// </summary>
        private void InitializeJPEG(Frame entry, int i)
        {
            // Take the initial framebuffer (blank RGB24), paint the timestamp on it, encode it into a JPEG, then copy that JPEG back into the framebuffer.
            string text = string.Format("({0})", i);

            CopyTimestamp(entry, text);

            IntPtr jpegBuf  = IntPtr.Zero;
            uint   jpegSize = 0;
            IntPtr handle   = tjnet.tjInitCompress();
            int    pitch    = configuration.Width * 3;
            TJPF   format   = TJPF.TJPF_BGR;
            int    quality  = 90;
            int    result   = tjnet.tjCompress2(handle, entry.Buffer, configuration.Width, pitch, configuration.Height, format, ref jpegBuf, ref jpegSize, TJSAMP.TJSAMP_420, quality, TJFLAG.TJFLAG_FASTDCT);

            tjnet.tjDestroy(handle);

            Marshal.Copy(jpegBuf, entry.Buffer, 0, (int)jpegSize);
            entry.PayloadLength = (int)jpegSize;

            tjnet.tjFree(jpegBuf);
        }
Esempio n. 2
0
 public void PushFrame(IntPtr img, TJPF type = TJPF.TJPF_BGR)
 {
     PushFrame(p, img, (int)type);
 }