gml_Grabber.h

Go to the documentation of this file.
00001 /**
00002  * @file gml_Grabber.h
00003  *
00004  *  Declares the interface for accessing video grabbers.
00005  *
00006  * Copyright (c) 1995-2003 CLIPS-IMAG
00007  *
00008  * See the file "gml_LicenseTerms.txt" for information on usage and redistribution
00009  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00010  *
00011  *  July 17, 2003 (F.B.)
00012  *    Switch from C++ to C, keep grabber interface to a minimum.
00013  *
00014  *  Created on Januray 1995 (FB).
00015  */
00016 
00017 #ifndef __GML_GRABBER__
00018 #define __GML_GRABBER__
00019 
00020 
00021 #include "gml/base/gml_Types.h"
00022 #include "gml/base/gml_Errors.h"
00023 #include "gml/image/gml_Bitmap.h"
00024 #include "gml/base/gml_Callback.h"
00025 
00026 #define GML_GRABBER_NAME_MAX 255
00027 
00028 /**
00029  *  gml_TGrabberName --
00030  *
00031  *    Stores a human-readable description of a grabber.
00032  */
00033 typedef char gml_TGrabberName [GML_GRABBER_NAME_MAX+1];
00034 
00035 /**
00036  * @name
00037  * gml_Grabber error codes
00038  * @{
00039  */
00040 extern gml_TError gml_gGrabberNoneAvailable;     /**< there is no available grabber                                        */
00041 extern gml_TError gml_gGrabberNoSuchGrabber;     /**< request for a grabber which does not exist                           */
00042 extern gml_TError gml_gGrabberNoSuchOption;      /**< this option is not handled by the grabber                            */
00043 extern gml_TError gml_gGrabberReadOnlyOption;    /**< this option is read-only                                             */
00044 extern gml_TError gml_gGrabberInvalidOptionVal;  /**< invalid value for this option                                        */
00045 extern gml_TError gml_gGrabberThreadError;       /**< threading related error                                              */
00046 extern gml_TError gml_gGrabberDriverError;       /**< driver related error                                                 */
00047 /**@ } */
00048 
00049 /**
00050  *  gml_TGrabberFeatureType --
00051  *
00052  *    Standard grabber options. In general, can be read and written.
00053  */
00054 typedef enum {
00055   gml_cGrabberOptReduce              = 'redu',    /**< int,       decimation factor from native size.                 */
00056   gml_cGrabberOptSignalFormat        = 'form',    /**< int,       possible values following                           */
00057     gml_cGrabberOptSignalFormatPAL   = 'pal ',
00058     gml_cGrabberOptSignalFormatSECAM = 'seca',
00059     gml_cGrabberOptSignalFormatNTSC  = 'ntsc',
00060   gml_cGrabberOptShareKey            = 'shmk',    /**< UInt32,    the grabber sharing key  (unsigned long, r/o)        */
00061   gml_cGrabberOptColor               = 'colr',    /**< int,       wether to grab color (int, default true)             */
00062 
00063   gml_cGrabberOptHue                  = 'hue ',
00064   gml_cGrabberOptSaturation           = 'satu',
00065   gml_cGrabberOptSharpness            = 'shrp',
00066   gml_cGrabberOptBrightness           = 'brit',
00067   gml_cGrabberOptGain                 = 'gain',
00068   gml_cGrabberOptIris                 = 'iris',
00069   gml_cGrabberOptShutter              = 'shtr',
00070   gml_cGrabberOptExposure             = 'xpsr',
00071   gml_cGrabberOptWhiteBalanceU        = 'whbu',
00072   gml_cGrabberOptWhiteBalanceV        = 'whbv',
00073   gml_cGrabberOptGamma                = 'gmma',
00074   gml_cGrabberOptTemperature          = 'temp',
00075   gml_cGrabberOptZoom                 = 'zoom',
00076   gml_cGrabberOptFocus                = 'fcus',
00077   gml_cGrabberOptPan                  = 'pan ',
00078   gml_cGrabberOptTilt                 = 'tilt',
00079   /*
00080   gml_cGrabberOptOpticalFilter        = 'opft',
00081   gml_cGrabberOptTrigger              = 'trgr',
00082   gml_cGrabberOptCaptureSize          = 'cpsz',
00083   gml_cGrabberOptCaptureQuality       = 'cpql',
00084   gml_cGrabberOptFocusPoint           = 'fpnt',
00085   gml_cGrabberOptEdgeEnhancement      = 'eden',
00086   gml_cGrabberOptLightingHint         = 'lhnt'
00087   */
00088 } gml_TGrabberFeatureType;
00089 
00090 
00091 /**
00092  *  gml_TGrabberFeatureState --
00093  *
00094  *    Possible states for grabber features
00095  */
00096 typedef enum {
00097   gml_cGrabberFlagOn                  = (1 << 0),
00098   gml_cGrabberFlagOff                 = (1 << 1),
00099   gml_cGrabberFlagManual              = (1 << 2),
00100   gml_cGrabberFlagAuto                = (1 << 3),
00101   gml_cGrabberFlagTune                = (1 << 4),
00102 } gml_TGrabberFeatureState;
00103 
00104 
00105 /**
00106  *  gml_TGrabberFeature --
00107  *
00108  *    Describes a feature or changeable option of the frame grabber
00109  */
00110 typedef struct
00111 {
00112   gml_TGrabberFeatureType   type;           /**< feature type (in)                                                       */
00113   int                       state;          /**< current or desired state, as a mask of gml_TGrabberFeatureState (inout) */
00114   SInt32                    value;          /**< current or desired value (inout)                                        */
00115   int                       capabilities;   /**< possible states, as a mask of gml_TGrabberFeatureState (inout)          */
00116   SInt32                    minimum;        /**< minimal possible feature value                                          */
00117   SInt32                    maximum;        /**< maximal possible feature value                                          */
00118 
00119 } gml_TGrabberFeature;
00120 
00121 
00122 /**
00123  * gml_TGrabber --
00124  *
00125  *  A grabber token, returned by "gml_GrabberGet" and subsequently used for all operations on grabbers.
00126  */
00127 typedef void*   gml_TGrabber;
00128 
00129 
00130 /**
00131  * gml_GrabberGet --
00132  *
00133  *  Gets acces to a grabber.
00134  *  @param name       the name of the grabber we need to get access to.
00135  *                    NULL means first available grabber.
00136  *  @param grabber    is set to point to the requested grabber.
00137  */
00138 GML_EXTERN_C
00139 gml_TError gml_GrabberGet (gml_TGrabberName* name, gml_TGrabber* grabber);
00140 
00141 
00142 
00143 
00144 /**
00145  * gml_GrabberRelease --
00146  *
00147  *  Releases a grabber.
00148  */
00149 GML_EXTERN_C
00150 void gml_GrabberRelease (gml_TGrabber grabber);
00151 
00152 
00153 
00154 /**
00155  * gml_GrabberList --
00156  *
00157  *  Returns an array of string describing the available grabbers.
00158  *
00159  *  @param   names  on successful return, an array of fixed strings.
00160  *                  <names> is allocated by <gml_GrabberDescrs> and must not be
00161  *                  freed by the caller.
00162  *  @param   nb     on successful return, the number of available
00163  *                  grabbers.
00164  */
00165 GML_EXTERN_C
00166 gml_TError gml_GrabberList (gml_TGrabberName** names, int* nb);
00167 
00168 
00169 
00170 /**
00171  * gml_GrabberGetBitmap --
00172  * 
00173  *  Return a pointer to the bitmap where the lastest aquired frame is stored.
00174  *
00175  *  @bug This is what this function should be designed to do:
00176  *  Returns a pointer to the oldest available aquired frame, and remove it from
00177  *  a queue of available frames. Return <NULL> if no frame is available.
00178  *  This function may only be called inside the registered event handler.
00179  *  Note that this function will not return the same frame twice.
00180  */
00181 GML_EXTERN_C
00182 gml_TBitmap* gml_GrabberGetBitmap (gml_TGrabber grabber);
00183 
00184 
00185 
00186 /**
00187  * gml_GrabberBindOnNewFrame --
00188  *
00189  *  Registers a callback to be called when a new frame has been aquired. 
00190  *  Only one callback is memorized:
00191  *  every call erases the previous callback address and parameter.
00192  *  
00193  *  @param callback    the callback function. <NULL> means remove any bound callback.
00194  *  @param userParam   a parameter that will be provided when the callback in invoked.
00195  */
00196 GML_EXTERN_C
00197 gml_TError gml_GrabberBindOnNewFrame (gml_TGrabber grabber, gml_TCallback callback, gml_TPointer userParam);
00198 
00199 
00200 
00201 /**
00202  * gml_GrabberUnbindOnNewFrame --
00203  *
00204  *  De-registers a callback function that was bound to the 
00205  *  "new frame available" event. See gml_GrabberBindOnNewFrame().
00206  */
00207 GML_EXTERN_C
00208 void gml_GrabberUnbindOnNewFrame (gml_TGrabber grabber, gml_TCallback callback, gml_TPointer userParam);
00209 
00210 
00211 
00212 /**
00213  * gml_GrabberGetOption --
00214  *
00215  *  Return the value of a grabber option in <option>. 
00216  *  The queried option is specified by the <type> field of <option>.
00217  */
00218 GML_EXTERN_C
00219 gml_TError gml_GrabberGetOption (gml_TGrabber grabber, gml_TGrabberFeature* option);
00220 
00221 
00222 
00223 /**
00224  * gml_GrabberSetOption --
00225  *
00226  *  Change the value or flags of an option.
00227  *  The queried option is specified by the <type> field of <option>.
00228  */
00229 GML_EXTERN_C
00230 gml_TError gml_GrabberSetOption (gml_TGrabber grabber, gml_TGrabberFeature* option);
00231 
00232 
00233 
00234 /**
00235  * gml_GrabberGetName --
00236  *
00237  *  Return a human-readable name for the grabber.
00238  */
00239 GML_EXTERN_C
00240 gml_TError gml_GrabberGetName (gml_TGrabber grabber, gml_TGrabberName name);
00241 
00242 
00243 
00244 /**
00245  * gml_GrabberSettingsDialog --
00246  *
00247  *  Query about and display a system-level dialog window that allows the user to set
00248  *  the grabber's settings.
00249  *
00250  *  @param display      a boolean: if not 0, request that the dialog be displayed
00251  *                      if it exists.
00252  *  @param exists       a boolean: on return, the int pointed at is set to 0 if 
00253  *                      there is no such a dialog. Can be set to NULL if not
00254  *                      interested.
00255  */
00256 GML_EXTERN_C
00257 gml_TError gml_GrabberSettingsDialog (gml_TGrabber grabber, int display, int* exists);
00258 
00259 
00260 
00261 #endif /* ifndef __GML_GRABBER__ */
00262 
Generated on Tue Jun 12 14:03:27 2007 for gml by Doxygen 1.5.2.