/// <summary>
        /// Gets a copy of the current image being displayed by the video renderer.
        /// </summary>
        /// <param name="videoDisplayControl">A valid IMFVideoDisplayControl instance.</param>
        /// <param name="bih">A BitmapInfoHeader class that receives a description of the bitmap. </param>
        /// <param name="dib">Receives byte array that contains a packed Windows device-independent bitmap (DIB).</param>
        /// <param name="timeStamp">Receives the time stamp of the captured image.</param>
        /// <returns>If this function succeeds, it returns the S_OK member. Otherwise, it returns another HResult's member that describe the error.</returns>
        public static HResult GetCurrentImage(this IMFVideoDisplayControl videoDisplayControl, BitmapInfoHeader bih, out byte[] dib, out TimeSpan timeStamp)
        {
            if (videoDisplayControl == null)
            {
                throw new ArgumentNullException("videoDisplayControl");
            }

            IntPtr dibPtr;
            int    dibLength;
            long   time;

            HResult hr = videoDisplayControl.GetCurrentImage(bih, out dibPtr, out dibLength, out time);

            if (hr.Succeeded())
            {
                try
                {
                    dib = new byte[dibLength];
                    Marshal.Copy(dibPtr, dib, 0, dibLength);
                    timeStamp = TimeSpan.FromTicks(time);
                }
                finally
                {
                    Marshal.FreeCoTaskMem(dibPtr);
                }
            }
            else
            {
                dib       = null;
                timeStamp = TimeSpan.MinValue;
            }

            return(hr);
        }
        public override bool GetCurrentImage(out BITMAPINFOHEADER header, out IntPtr dibFull, out IntPtr dibDataOnly)
        {
            int  cbDib;
            long timestamp = 0;

            header        = new BITMAPINFOHEADER();
            header.biSize = Marshal.SizeOf(typeof(BITMAPINFOHEADER));
            int hr = _pMFVideoDisplayControl.GetCurrentImage(ref header, out dibFull, out cbDib, ref timestamp);

            if (DsHlp.SUCCEEDED(hr))
            {
                dibDataOnly = new IntPtr(dibFull.ToInt64() + Marshal.SizeOf(typeof(BITMAPINFOHEADER)));
                return(true);
            }
            else
            {
                dibDataOnly = IntPtr.Zero;
                return(false);
            }
        }