Re: How to implement a callback function
Eric Pouech [EMAIL PROTECTED] wrote: >luis lenders a écrit : >> So how could i pass the data in lpVideoHdr to the application? Any >> help appreciated as i'm still quite a beginner in this :) >it seems that you open somehow a capture session. >Within this session, you can set a user defined callback to be passed every >frame captured. >On the WM_CAP_SET_CALLBACK_FRAME message, your session should store the pointer >to the function in the session data (you should have something for that somewhere). >Everytime you complete the capture of a frame in a given session, and this >callback has been defined, then you should call it (by passing the current >LPVIDEOHDR which is likely to be the structure to contain the data for the >captured frame). I believe that the capture session is inherently tied to the capture window created with capCreateCaptureWindowA/W(). After all, the capture API dates back to Windows 3.x where it was common to do background processing by delegating the action to a window message loop, since no other multitasking method was available. Maybe that 32bit Windows has another implementation for this, but I'm not sure. Rolf Kalbermatter
RE: How to implement a callback function
luis lenders wrote: As to the title, avicap32 won't implement the callback function, but your application will do that. avicap32 only will call it. >Hi , i would like to implement this function: >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multim ed/htm/_win32_cappreview.asp Well this function (or rather a macro) is only to enable or disable the preview mode. There isn't any callback function I can see here. It is rather about a preview of the actual capture data in the capture window itself. You can install a frame callback with capSetCallbackOnFrame() and this callback function will be called for every frame BEFORE it is diplayed in the preview. >Here fpProc is a pointer to the preview callback function >Applications use this to get access to the videodata. >Right now i already have a preview window. >If i'm correct it is similar to this function:http://msdn.microsoft.com/library/default.asp? >url=/library/en-us/multimed/htm/_win32_capvideostreamcallback.asp As far as I understand it, the preview callback as you call it is rather installed by the capSetCallbackOnFrame() macro and ultimately by the WM_CAP_SET_CALLBACK_FRAME message. MSDN doesn't directly specify the actual callback prototype of this callback, but it if you search further you can see that the capVideoStreamCallback() prototype is both used for the WM_CAP_SET_CALLBACK_FRAME and WM_CAP_SET_CALLBACK_VIDEOSTREAM callbacks. >Here the structure LPVIDEOHDR lpVHdr contains the >information about the videodata. My question is how >all of this could be implemented; right now i have : >case WM_CAP_SET_CALLBACK_FRAME: { ^^ You can only declare variables in standard C at the beginning of a block and since Wine has to be compilable in standard C you need to add curly braces before you can declare variables. > LPVIDEOHDR lpVideoHdr; //defined in vfw.h > typedef LRESULT (CALLBACK * CAPVIDEOCALLBACK)(HWND hwnd, LPVIDEOHDR lpVideoHdr); > CAPVIDEOCALLBACK *framecallback = (CAPVIDEOCALLBACK*)lParam; You need to store this callback function pointer somewhere in the capture window. This could be done by adding the callback pointers to the structure which holds all the different runtime parameters for the capture process, such as the CAPSTATUS, CAPPARAMS, CAPDRIVERCAPS and probably some more but private data etc structures. The pointer to this whole structure will be probably added to the capture window as an ATOM or maybe (but probably less preferable) as user data. >{so what goes here? } Not much more than what I explained above. The message loop of your capture window will then have to check for every incoming frame if frame callback is set to on (non-NULL) and in that case call the saved callback pointer with the actual data. >So how could i pass the data in lpVideoHdr to the >application? Any help appreciated as i'm still quite >a beginner in this :) You won't do that in the WM_CAP_SET_CALLBACK_FRAME message handler. Rather your message loop will have to do some idle processing, such as generating a regular WM_something message in which the external video data is read in and then all the necessary processing is done such as passing the captured data to the frameCallback if that is enabled, then doing the preview or overlay operation if on, and after that pass the data to the videoStreamCallback etc. But I think your major problem here is not the capSetPreview macro or rather its message implementation in the first place, but rather the fact that avicap32.dll is basically an empty placeholder in current wine. You will need to implement quite something more before you can even worry about capSetPreview(). Rolf Kalbermatter
Re: How to implement a callback function
luis lenders a écrit : Hi , i would like to implement this function: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_cappreview.asp Here fpProc is a pointer to the preview callback function Applications use this to get access to the videodata. Right now i already have a preview window. If i'm correct it is similar to this function:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_capvideostreamcallback.asp Here the structure LPVIDEOHDR lpVHdr contains the information about the videodata. My question is how all of this could be implemented; right now i have : case WM_CAP_SET_CALLBACK_FRAME: LPVIDEOHDR lpVideoHdr; //defined in vfw.h typedef LRESULT (CALLBACK * CAPVIDEOCALLBACK)(HWND hwnd, LPVIDEOHDR lpVideoHdr); CAPVIDEOCALLBACK *framecallback = (CAPVIDEOCALLBACK *)lParam; {so what goes here? } return TRUE; break; So how could i pass the data in lpVideoHdr to the application? Any help appreciated as i'm still quite a beginner in this :) it seems that you open somehow a capture session. Within this session, you can set a user defined callback to be passed every frame captured. On the WM_CAP_SET_CALLBACK_FRAME message, your session should store the pointer to the function in the session data (you should have something for that somewhere). Everytime you complete the capture of a frame in a given session, and this callback has been defined, then you should call it (by passing the current LPVIDEOHDR which is likely to be the structure to contain the data for the captured frame). HTH A+ -- Eric Pouech
How to implement a callback function
Hi , i would like to implement this function: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_cappreview.asp Here fpProc is a pointer to the preview callback function Applications use this to get access to the videodata. Right now i already have a preview window. If i'm correct it is similar to this function:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_capvideostreamcallback.asp Here the structure LPVIDEOHDR lpVHdr contains the information about the videodata. My question is how all of this could be implemented; right now i have : case WM_CAP_SET_CALLBACK_FRAME: LPVIDEOHDR lpVideoHdr; //defined in vfw.h typedef LRESULT (CALLBACK * CAPVIDEOCALLBACK)(HWND hwnd, LPVIDEOHDR lpVideoHdr); CAPVIDEOCALLBACK *framecallback = (CAPVIDEOCALLBACK *)lParam; {so what goes here? } return TRUE; break; So how could i pass the data in lpVideoHdr to the application? Any help appreciated as i'm still quite a beginner in this :) Regards Send instant messages to your online friends http://uk.messenger.yahoo.com