Move the sources to trunk
[opencv] / interfaces / ch / c / handmade / cvcam / cvcamSetProperty_chdl.c
1 /* Copyright (c) 2001-2002 by SoftIntegration, Inc. All Rights Reserved */
2 #include <windows.h>
3 #include <string.h>
4 #include <cvcam.h>
5 #include <ch.h>
6
7 typedef  void (*callback)(void *);
8 static ChInterp_t interp;
9 static void cvcamSetProperty_chdl_funarg(void* arg);
10 static void *cvcamSetProperty_chdl_funptr;
11
12 EXPORTCH int cvcamSetProperty_chdl(void *varg) {
13     va_list ap;
14     int camera;
15     const char* property;
16     void* value;
17     callback callback_ch, callback_c;
18     int retval;
19
20     Ch_VaStart(interp, ap, varg);
21     camera = Ch_VaArg(interp, ap, int);
22     property = Ch_VaArg(interp, ap, const char*);
23
24     if  ( (strcmp(property, CVCAM_PROP_CALLBACK) == 0) || (strcmp(property, CVCAM_STEREO_CALLBACK) == 0) )
25     {
26          callback_ch = Ch_VaArg(interp, ap, callback); 
27          cvcamSetProperty_chdl_funptr = (void *)callback_ch;
28          if (callback_ch != NULL)  {
29             callback_c = (callback) cvcamSetProperty_chdl_funarg;
30           }
31          retval = cvcamSetProperty(camera, property, callback_c);
32      }
33     else 
34     {
35         value = Ch_VaArg(interp, ap, void*); 
36         retval = cvcamSetProperty(camera, property, value);
37      }
38
39     Ch_VaEnd(interp, ap);
40     return retval;
41 }
42
43 static void cvcamSetProperty_chdl_funarg(void* arg)   {
44   Ch_CallFuncByAddr(interp,cvcamSetProperty_chdl_funptr,NULL,arg);
45 }