Beispiel #1
0
 private void FrameCallBack(IntPtr lwnd, IntPtr lpVHdr)
 {
     ClassShowVideo.VIDEOHDR videoHeader = new ClassShowVideo.VIDEOHDR();
     byte[] VideoData;
     videoHeader = (ClassShowVideo.VIDEOHDR)ClassShowVideo.GetStructure(lpVHdr, videoHeader);
     VideoData   = new byte[videoHeader.dwBytesUsed];
     ClassShowVideo.Copy(videoHeader.lpData, VideoData);
     if (this.RecievedFrame != null)
     {
         this.RecievedFrame(VideoData);
     }
 }
Beispiel #2
0
        // start the web camera
        public void StartWebCam()
        {
            byte[] lpszName = new byte[100];
            byte[] lpszVer  = new byte[100];

            ClassShowVideo.capGetDriverDescriptionA(0, lpszName, 100, lpszVer, 100);
            this.lwndC = ClassShowVideo.capCreateCaptureWindowA(lpszName, ClassShowVideo.WS_VISIBLE + ClassShowVideo.WS_CHILD, 0, 0, mWidth, mHeight, mControlPtr, 0);

            if (this.capDriverConnect(this.lwndC, 0))
            {
                this.capPreviewRate(this.lwndC, 66);
                this.capPreview(this.lwndC, true);
                ClassShowVideo.BITMAPINFO bitmapinfo = new ClassShowVideo.BITMAPINFO();
                bitmapinfo.bmiHeader.biSize     = ClassShowVideo.SizeOf(bitmapinfo.bmiHeader);
                bitmapinfo.bmiHeader.biWidth    = 352;
                bitmapinfo.bmiHeader.biHeight   = 288;
                bitmapinfo.bmiHeader.biPlanes   = 1;
                bitmapinfo.bmiHeader.biBitCount = 24;
                this.capSetVideoFormat(this.lwndC, ref bitmapinfo, ClassShowVideo.SizeOf(bitmapinfo));
                this.mFrameEventHandler = new ClassShowVideo.FrameEventHandler(FrameCallBack);
                this.capSetCallbackOnFrame(this.lwndC, this.mFrameEventHandler);
                ClassShowVideo.SetWindowPos(this.lwndC, 0, 0, 0, mWidth, mHeight, 6);
            }
        }
Beispiel #3
0
 private bool capSetVideoFormat(IntPtr hCapWnd, ref ClassShowVideo.BITMAPINFO BmpFormat, int CapFormatSize)
 {
     return(ClassShowVideo.SendMessage(hCapWnd, ClassShowVideo.WM_CAP_SET_VIDEOFORMAT, CapFormatSize, ref BmpFormat));
 }
Beispiel #4
0
 private bool capSetCallbackOnFrame(IntPtr lwnd, ClassShowVideo.FrameEventHandler lpProc)
 {
     return(ClassShowVideo.SendMessage(lwnd, ClassShowVideo.WM_CAP_SET_CALLBACK_FRAME, 0, lpProc));
 }
Beispiel #5
0
 private bool capPreviewRate(IntPtr lwnd, short wMS)
 {
     return(ClassShowVideo.SendMessage(lwnd, ClassShowVideo.WM_CAP_SET_PREVIEWRATE, wMS, 0));
 }
Beispiel #6
0
 private bool capPreview(IntPtr lwnd, bool f)
 {
     return(ClassShowVideo.SendMessage(lwnd, ClassShowVideo.WM_CAP_SET_PREVIEW, f, 0));
 }
Beispiel #7
0
 private bool capDriverDisconnect(IntPtr lwnd)
 {
     return(ClassShowVideo.SendMessage(lwnd, ClassShowVideo.WM_CAP_DRIVER_DISCONNECT, 0, 0));
 }
Beispiel #8
0
 // private functions
 private bool capDriverConnect(IntPtr lwnd, short i)
 {
     return(ClassShowVideo.SendMessage(lwnd, ClassShowVideo.WM_CAP_DRIVER_CONNECT, i, 0));
 }