diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-10-09 05:20:49 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-10-09 05:20:49 +0000 |
commit | faf1e494a31b70203aa67d34602f5256eabe0336 (patch) | |
tree | b222ebe08c9173c1ba2811bcad4f47369d0e4f38 /plugins/ExternalAPI/delphi/m_webcam.inc | |
parent | 302209a17a9f5342a377904cda699fd3833bbe9a (diff) |
Test commit:
delphi headers structure as c headers structure
git-svn-id: http://svn.miranda-ng.org/main/trunk@1829 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/ExternalAPI/delphi/m_webcam.inc')
-rw-r--r-- | plugins/ExternalAPI/delphi/m_webcam.inc | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/plugins/ExternalAPI/delphi/m_webcam.inc b/plugins/ExternalAPI/delphi/m_webcam.inc new file mode 100644 index 0000000000..592e28a479 --- /dev/null +++ b/plugins/ExternalAPI/delphi/m_webcam.inc @@ -0,0 +1,142 @@ +{
+ WebCam Video plugin by Sergei Polishchuk, SoftCab Inc
+ http://www.softcab.com
+ pserge@softcab.com
+}
+
+{$IFNDEF M_WEBCAM}
+{$DEFINE M_WEBCAM}
+
+const
+ MS_WEBCAM_OPEN = 'WebCam/Open';
+{
+ This opens webcamera
+ wParam, and lParam must be zero.
+ Returns HANDLE to web camera.
+ For Example:
+ HANDLE hWebcamera = CallService(MS_WEBCAM_OPEN, 0, 0);
+}
+
+ MS_WEBCAM_ISREADY = 'WebCam/IsReady';
+{
+ This zero if camera is ready for use, and non-zero if camera is still initializing.
+ It's useful to user this function after asynchronous opening of camera
+ wParam must be zero.
+ lParam = (LPARAM)(HANDLE)hCamera - camera handle
+ For Example:
+ HANDLE hWebcamera = CallService(MS_WEBCAM_ISREADY, 0, 0);
+}
+
+ MS_WEBCAM_CLOSE = 'WebCam/Close';
+{
+ This will close web camera.
+ wParam must be zero
+ lParam = (LPARAM)(HANDLE)hWebcamera - a handle returned by MS_WEBCAM_OPEN
+ Return value is undefined.
+ For Example:
+ CallService(MS_WEBCAM_CLOSE, 0, (LPARAM)hWebcamera);
+}
+
+ MS_WEBCAM_SHOWWND = 'WebCam/Show';
+{
+ This will show or hide web camera window
+ wParam = 1 to show window, or zero to hide one
+ lParam = (LPARAM)(HANDLE)hWebcamera - handle to camera
+ Return value is undefined.
+ For Example, this will show the window:
+ CallService(MS_WEBCAM_SHOWWND, 1, (LPARAM)hWebcamera);
+}
+
+ MS_WEBCAM_FREE = 'WebCam/Free';
+{
+ This will free WEBCAM_QUERY fields.
+ wParam = sizeof(WEBCAM_QUERY)
+ lParam = (LPARAM)(WEBCAM_QUERY*)&Query
+ Return value is undefined
+ For Example:
+ CallService(MS_WEBCAM_FREE, sizeof(Query), (LPARAM)&Query);
+}
+
+ MS_WEBCAM_QUERY = 'WebCam/Query';
+ WANT_PICTURE = pointer(-1);
+{
+ This will query web camera for data.
+ wParam = sizeof(WEBCAM_QUERY)
+ lParam = (LPARAM)(WEBCAM_QUERY*)&Query
+ Returns zero in case of success, or non-zero in case of any error
+ Before queryng camera, you need to setup some WEBCAM_QUERY structure fields.
+}
+
+(*
+WEBCAM_QUERY Query;
+memset(&Query, 0, sizeof(Query));
+Query.hCamera = hWebcamera;
+Query.Jpeg = WANT_PICTURE; // we want to get .JPG image
+Query.Bitmap = NULL; // we do not need .BMP image
+int ret = CallService(MS_WEBCAM_QUERY, sizeof(Query), (LPARAM)&Query);
+if(!ret)
+{ if(Query.Jpeg != NULL)
+ { // do something with JPG picture. For example, you may save it to .JPG file.
+ }
+ // now let's release the memory
+ CallService(MS_WEBCAM_FREE, sizeof(Query), (LPARAM)&Query);
+}
+*)
+
+ MS_WEBCAM_SCREENSHOT = 'WebCam/ScreenShot';
+{
+ This will return window screenshot
+ wParam = sizeof(WEBCAM_QUERY)
+ lParam = (LPARAM)(WEBCAM_QUERY*)&Query
+ Returns zero in case of success, or non-zero in case of any error
+ WEBCAMBUF->hCamera specifies window handle.
+ It's not required to open webcamera in order to run this service function.
+}
+
+(*
+
+WEBCAM_QUERY Query;
+memset(&Query, 0, sizeof(Query));
+Query.hCamera = (HANDLE)GetDesktopWindow(); // getting whole desktop picture.
+Query.Jpeg = WANT_PICTURE; // we want to get .JPG image
+Query.Bitmap = NULL; // we do not need .BMP image
+int ret = CallService(MS_WEBCAM_SCREENSHOT, sizeof(Query), (LPARAM)&Query);
+if(!ret)
+{ if(Query.Jpeg != NULL)
+ { // do something with JPG picture. For example, you may save it to .JPG file.
+ }
+ // now let's release the memory
+ CallService(MS_WEBCAM_FREE, sizeof(Query), (LPARAM)&Query);
+}
+
+*)
+
+ ME_WEBCAM_SNAPSHOTRECEIVED = 'WebCam/SnapshotRecv';
+{
+ This event will be fired right after receiving snapshot from remote contact.
+ wParam=(WPARAM)(HANDLE)hContact - a contact handle
+ lParam=(LPARAM)(WEBCAMBUF*)buffer - a buffer that contains JPEG image
+ IMPORTANT: you should not modify the buffer. It's read-only.
+}
+
+type
+ ptag_WEBCAMBUF = ^tag_WEBCAMBUF;
+ tag_WEBCAMBUF = record
+ Size:dword; // size of Data buffer in bytes
+ Data:array [0..0] of byte;
+ end;
+ PWEBCAMBUF = ^WEBCAMBUF;
+ WEBCAMBUF = tag_WEBCAMBUF;
+
+type
+ ptag_WEBCAM_QUERY = ^tag_WEBCAM_QUERY;
+ tag_WEBCAM_QUERY = record
+ hCamera:THANDLE; // [in] HANDLE to web camera
+ cx,cy :word; // [out] camera picture size
+ Jpeg :PWEBCAMBUF; // [in,out] points to .JPG file content in memory
+ Bitmap :PWEBCAMBUF; // [in,out] points to .BMP file content in memory
+ end;
+ PWEBCAM_QUERY = ^WEBCAM_QUERY;
+ WEBCAM_QUERY = tag_WEBCAM_QUERY;
+
+{$ENDIF}
|