Ver Mensaje Individual
  #1  
Antiguo 12-03-2009
sebasthian777 sebasthian777 is offline
Miembro
 
Registrado: feb 2009
Posts: 19
Reputación: 0
sebasthian777 Va por buen camino
Almacenar en buffer Captura de video

Muy buenas otra vez compañeros programadores.

Vengo con una duda.

Tengo un programa que captura una webcam y la muestra por formulario, por panel o por donde quiera por asi decirlo, simepre y cuando direccione que handle quier usar.

aca un poco del codigo para que no sea tan abstracto:
Código Delphi [-]
function CreateCaptureWindow(Name: PChar; Style: Longint; X, Y: Integer;
 Width, Height: integer; Parent: HWND; id: integer): HWND; stdcall;
 external 'AVICAP32.DLL' name 'capCreateCaptureWindowA';

y el uso de la misma funcion:
Código Delphi [-]
pHWND:= CreateCaptureWindow('Ventana de captura',WS_CHILD or WS_VISIBLE,
    0,0,Panel1.Width,Panel1.Height,panel1.handle,0);


donde pHWND:

Código Delphi [-]
pHWND : THandle;


y uso los metodos siguientes para controlar el avicap32
Código Delphi [-]
SendMessage(pHWND, WM_CAP_DRIVER_DISCONNECT, 0, 0);
    SendMessage(pHWND, WM_CAP_DRIVER_CONNECT, 0, 0);
    SendMessage(pHWND, WM_CAP_SET_PREVIEW, 1, 0);
SendMessage(pHWND, WM_CAP_GRAB_FRAME, 0, lParam(PChar('C:\bmp\1.jpg')));
SendMessage(pHWND, WM_CAP_SAVEDIB, 0, lParam(PChar('C:\bmp\1.jpg')));
SendMessage(pHWND, WM_CAP_SET_PREVIEW, 1, 0);


con estas constantes:
Código Delphi [-]
const   WM_CAP_START = WM_USER;   WM_CAP_STOP = WM_CAP_START + 68;   WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10;   WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11;   WM_CAP_SAVEDIB = WM_CAP_START + 25;   WM_CAP_GRAB_FRAME = WM_CAP_START + 60;   WM_CAP_SEQUENCE = WM_CAP_START + 62;   WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20;   WM_CAP_SET_PREVIEW = WM_CAP_START + 50;   WM_CAP_SET_OVERLAY = WM_CAP_START + 51;   WM_CAP_SET_PREVIEWRATE = WM_USER + 52;   WM_CAP_EDIT_COPY = WM_CAP_START+ 30;


En el ejemplo que puse anteriormente se actualiza constantemente el video sobre un Tpanel, y asi lo puedo ver en tiempo de ejecucion. Lo que realmente quiero es poder almacenar ese video en tiempo real en un buffer, como para poder mandarlo via tcp o udp.

desde ya muchas gracias!
y saludos!
Responder Con Cita