示例#1
0
        public unsafe int FillBuffer(ref IMediaSampleImpl _sample)
        {
            IntPtr _ptr;

            _sample.GetPointer(out _ptr);
            int length = _sample.GetSize();

            if (!KinectCamSettigns.Default.Desktop)
            {
                KinectHelper.GenerateFrame(_ptr, length, KinectCamSettigns.Default.Mirrored, KinectCamSettigns.Default.Zoom);
            }
            else
            {
                if (m_hBitmap == IntPtr.Zero)
                {
                    m_hBitmap = CreateCompatibleBitmap(m_hScreenDC, m_nWidth, Math.Abs(m_nHeight));
                }
                IntPtr hOldBitmap = SelectObject(m_hMemDC, m_hBitmap);
                StretchBlt(m_hMemDC, 0, 0, m_nWidth, Math.Abs(m_nHeight), m_hScreenDC, 0, 0, m_nMaxWidth, m_nMaxHeight, TernaryRasterOperations.SRCCOPY);
                SelectObject(m_hMemDC, hOldBitmap);
                GetDIBits(m_hMemDC, m_hBitmap, 0, (uint)Math.Abs(m_nHeight), _ptr, ref m_bmi, 0);
            }

            _sample.SetActualDataLength(_sample.GetSize());
            _sample.SetSyncPoint(true);

            return(NOERROR);
        }
        public unsafe int FillBuffer(ref IMediaSampleImpl _sample)
        {
            IntPtr _ptr;

            _sample.GetPointer(out _ptr);
            int length = _sample.GetSize();

            ShowNextImage(_ptr, length);

            //if (_settings.ShowDesktop)
            //{
            //    if (m_hBitmap == IntPtr.Zero)
            //    {
            //        m_hBitmap = CreateCompatibleBitmap(m_hScreenDC, m_nWidth, Math.Abs(m_nHeight));
            //    }
            //    IntPtr hOldBitmap = SelectObject(m_hMemDC, m_hBitmap);
            //    StretchBlt(m_hMemDC, 0, 0, m_nWidth, Math.Abs(m_nHeight), m_hScreenDC, 0, 0, m_nMaxWidth, m_nMaxHeight, TernaryRasterOperations.SRCCOPY);
            //    SelectObject(m_hMemDC, hOldBitmap);
            //    GetDIBits(m_hMemDC, m_hBitmap, 0, (uint)Math.Abs(m_nHeight), _ptr, ref m_bmi, 0);
            //}

            _sample.SetActualDataLength(_sample.GetSize());
            _sample.SetSyncPoint(true);

            return(NOERROR);
        }
示例#3
0
        public int FillBuffer(ref IMediaSampleImpl _sample)
        {
#if HAMED_LOG_METHOD_INFO
            MethodBase method = new StackTrace().GetFrame(0).GetMethod();
            Console.WriteLine(this.GetType().FullName + " - " + method.Name + " - " + method.ToString());
#endif

            if (m_hBitmap == IntPtr.Zero)
            {
                m_hBitmap = CreateCompatibleBitmap(m_hScreenDC, m_nWidth, Math.Abs(m_nHeight));
            }
            IntPtr _ptr;
            _sample.GetPointer(out _ptr);

            IntPtr hOldBitmap = SelectObject(m_hMemDC, m_hBitmap);

            StretchBlt(m_hMemDC, 0, 0, m_nWidth, Math.Abs(m_nHeight), m_hScreenDC, 0, 0, m_nMaxWidth, m_nMaxHeight, TernaryRasterOperations.SRCCOPY);

            SelectObject(m_hMemDC, hOldBitmap);

            GetDIBits(m_hMemDC, m_hBitmap, 0, (uint)Math.Abs(m_nHeight), _ptr, ref m_bmi, 0);

            _sample.SetActualDataLength(_sample.GetSize());
            _sample.SetSyncPoint(true);
            return(NOERROR);
        }
        public int FillBuffer(ref IMediaSampleImpl _sample)
        {
            IntPtr _ptr;

            _sample.GetPointer(out _ptr);

            CapturePipeline.Instance.updateData(_ptr);

            _sample.SetActualDataLength(_sample.GetSize());
            _sample.SetSyncPoint(true);
            return(NOERROR);
        }