Esempio n. 1
0
 public int GetCurrentImage(MediaFoundation.Misc.BitmapInfoHeader pBih, out IntPtr pDib, out int pcbDib, out long pTimeStamp)
 {
     // Make sure we *never* leave this entry point with an exception
     try
     {
         throw new NotImplementedException("The method or operation is not implemented.");
     }
     catch (Exception e)
     {
         pTimeStamp = 0;
         pDib = IntPtr.Zero;
         pcbDib = 0;
         return Marshal.GetHRForException(e);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="FPS">Frames per second; 30 = 30 FPS</param>
 /// <param name="SubType">Used to construct the AMMediaType and BmiHeader.Compression</param>
 /// <param name="width">Frame width in pixels</param>
 /// <param name="height">Frame height in pixels</param>
 /// <param name="bpp">Bits per pixel</param>
 public ImageFromText(int FPS, MediaFoundation.Misc.FourCC SubType, int width, int height, short bpp)
     : base(FPS, SubType, width, height, bpp)
 {
 }
Esempio n. 3
0
        /// <summary>
        /// Public constructor.  Subclasses should call this in their own constructors
        /// </summary>
        /// <param name="FPS">Frames per second; 30 = 30 FPS</param>
        /// <param name="SubType">Used to construct the AMMediaType and BmiHeader.Compression</param>
        /// <param name="width">Frame width in pixels</param>
        /// <param name="height">Frame height in pixels</param>
        /// <param name="bpp">Bits per pixel</param>
        public ImageHandler(int FPS, MediaFoundation.Misc.FourCC SubType, int width, int height, short bpp)
            : base()
        {
            m_rtSampleTime = 0;
            m_rtStopTime = MAXFRAMES * (UNIT / FPS);

            // The BYTES per pixel of the buffer in which we do our work.  Since this buffer
            // is ARGB, that's 32bpp / 8
            const int WORKINGBPP = (32 / 8);

            // Store the passed in parameters
            m_Fps = FPS;
            m_SubType = SubType;
            m_Height = height;
            m_Width = width;
            m_bpp = bpp;
            m_Stride = (width * bpp) / 8; // This is an estimate, and may be overwritten later

            // Create a buffer to do our drawing in.  It is *much* easier to draw in a Format32bppArgb
            // buffer than a YUYV buffer.  So, we draw in ARGB, and translate to the appropriate format.
            m_pData = Marshal.AllocCoTaskMem(m_Width * m_Height * WORKINGBPP);
            m_bitmapOverlay = new Bitmap(m_Width, m_Height, m_Width * WORKINGBPP, PixelFormat.Format32bppArgb, m_pData);
        }
Esempio n. 4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="FPS">Frames per second; 30 = 30 FPS</param>
 /// <param name="SubType">Used to construct the AMMediaType and BmiHeader.Compression</param>
 /// <param name="width">Frame width in pixels</param>
 /// <param name="height">Frame height in pixels</param>
 /// <param name="bpp">Bits per pixel</param>
 public ImageFromPixels(int FPS, MediaFoundation.Misc.FourCC SubType, int width, int height, short bpp)
     : base(FPS, SubType, width, height, bpp)
 {
     // Pick a random starting point for the RGB of the background
     Random r = new Random();
     m_r = r.Next(256);
     m_b = r.Next(256);
     m_g = r.Next(256);
 }