Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

l1394_avccamera.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           l1394_avccamera.h  -  description
00003                              -------------------
00004     begin                : Fri Nov 24 2000
00005     copyright            : (C) 2000-2004 by Michael Repplinger
00006     email                : repplinger@cs.uni-sb.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef L1394AVCCAMERA_H
00019 #define L1394AVCCAMERA_H
00020 
00021 #include "l1394_camera.h"
00022 #include "l1394_avccameraregister.h"
00023 
00024 
00025 namespace L1394{
00026 
00027 /*!\class AvcCamera
00028   *\ingroup L1394_Device
00029   *\brief This class implements the interface of a camera, defined in AV/C camera subunit
00030   * Specification (Version 2.1).
00031   *
00032   * The mechanism to create commands is the same, as described in class Camera .
00033   *
00034   * The Session class provides also functions to get explicit AvcCameras.
00035   * So the example in the Camera class documentation can be changed, if you need an AvcCamera.
00036   *
00037   * \code
00038   * Session* session = GetSession();
00039   * AvcCamera* camera = session->findAvcCamera(); //get explicit a AvcCamera
00040   * if (camera == NULL)
00041   * {
00042   *   cout << "No AvcCamera found" << endl;
00043   *   exit(0);
00044   * }
00045   * if (camera->zoom()->hasFeature())  //if the camera support zoom
00046   *   camera->zoom()->setValue(camera->zoom()->getMinValue()); //set zoom value to the minimum value.
00047   * else
00048   *   cout << " Feature not supported " << endl;
00049   * \endcode
00050   * For more information about controling a device see the tutorial.
00051   *
00052   *  To start the isochronous transaction, the method init() must be called, to
00053   *  allocate resources. The camera is set to default parameters, that can be changed
00054   *  with method setParameter(). For AV/C Cameras you only can change the iso-channel
00055   * and buffer count.
00056   *
00057   *
00058   * The AvcCamera class is still under develop. The control functions are
00059   * not tested (I try it with two AV/C cameras and get NOT_IMPLEMENTED response for all
00060   * features.)
00061   *
00062   * @author Michael Repplinger
00063   */
00064 
00065 class FcpNode;
00066 class AvcCamera : public Camera
00067 {
00068 public:
00069 /*! \name AvcCamera constructor
00070   * These functions create/delete an AvcCamera.
00071   */
00072 //@{
00073 /*! \fn AvcCamera(FcpNode* parent_node, const int subunit_value)
00074   * \brief This method creates an AvcCamera.
00075   * \param FcpNode* : pointer to the parent node.
00076   * \param subunit_value : The subunit value defines the subunit-type and the subunit-id of the device.
00077   */
00078   AvcCamera(FcpNode* parent_node, const int subunit_value);
00079 
00080 
00081 /*! \fn ~AvcCamera()
00082   * \brief destructor
00083   */
00084   virtual ~AvcCamera();
00085 //@}
00086 
00087 /** \name Camera information
00088   *  These functions return some camera specific information.
00089   */
00090 //@{
00091 /*! \fn hasVideoFormat(const Videomode videomode)
00092   * \brief This method tests, if a videomode is supported by a Camera.
00093   * \return bool : true if the videomode is supported, false if not
00094   */
00095   virtual bool hasVideoFormat(const Videomode videomode)   {if (videomode == DEVICE_DV) return true; return false;}
00096 
00097 
00098 /*! \fn hasFramerate(const Videomode videomode, const Framerate framerate)
00099   * \brief This method tests, if a framerate, with a videomode is supported by the camera.
00100   * \param videomode : the videomode for the framerate.
00101   * \param framerate : the framerate that should be tested.
00102   * \return bool : true, if a framerate is supported, false if not
00103   */
00104   virtual bool hasFramerate(const Videomode videomode,const Framerate framerate);
00105 //@}
00106 
00107 /** \name Basic functions
00108   *  These functions implement the basic functions, defined in abstract class Device.
00109   */
00110 //@{
00111   virtual int start();
00112   virtual int stop();
00113 //@}
00114 /*! \fn setParameter(const int buffercount, const int channel, const Isomode isomode, const Videomode videomode, const Framerate framerate)
00115   * \brief This method set the parameter of a camera.
00116   *
00117   * At this time only the channel parameter has effect.
00118   * An AV/C camera normally broadcasts the video data on channel 63. They has a
00119   *  fixed framerate and video format. So the parameters isomode, video_mode and framerate are ignored.
00120   *
00121   *  A short sample show an example to init an AvcCamera.
00122   * \code
00123   *  Session *session = GetSession();
00124   *  int framerate = 0;
00125   *  AvcCamera *camera = session->findAvcCamera();
00126   *  camera->setParameter() //set the default parameter (channel = 63, buffers = 3)
00127   *  if (camera->init() == L1394_SUCCESS)
00128   *    camera->start();
00129   *  else
00130   *    cout << "Camera init failed" << endl;
00131   * \endcode
00132   *
00133   * \param isomode : only running mode
00134   * \param nbuffers : buffers for iso module (for later version. At this time the video
00135   * module isn't used to get frames from a DV device.
00136   * \param videomode : DV format
00137   * \param framerate : CAMERA_FRAMES_3_75, CAMERA_FRAMES_7_5,
00138   * CAMERA_FRAMES_15, CAMERA_FRAMES_30, CAMERA_FRAMES_60
00139   * \param channel : iso channel (a value between 1..64)
00140   * \return int : returns a int value >= 0 if init success else < 0;
00141   */
00142   virtual int setParameter(const int buffercount = 4, const int channel = 63, const Isomode isomode = DEVICE_ISO_RUN, const Videomode videomode = DEVICE_DV, const Framerate framerate = DEVICE_FRAMES_DV);
00143 
00144 
00145 /*! \name AV/C Camera Interface
00146   * These functions describe the interface of an AV/C camera
00147   */
00148 //@{
00149   //! Access 'Brightness' feature register
00150   virtual const CameraRegister* brightness()   {return (AvcCameraRegister*)avc_camera_register->defaultSet(1,0x49,0xff);}
00151 
00152   //! Access 'Auto-Exposure' feature register
00153   virtual const CameraRegister* autoExposure() {return (AvcCameraRegister*)avc_camera_register->defaultSet(1,0x40,0xff);}
00154 
00155   //! Access 'Sharpness' feature register
00156   virtual const CameraRegister* sharpness()     {return (AvcCameraRegister*)avc_camera_register->defaultSet(1,0x56,0xff);}
00157 
00158   //! Access 'White-Balance' feature register
00159   virtual const CameraRegister* whiteBalance() {return (AvcCameraRegister*)avc_camera_register->defaultSet(1,0x5d,0xff);}
00160 
00161   //! Access 'White-Balance' feature register
00162   virtual const CameraRegister* whiteBalance(const int) {return (AvcCameraRegister*)avc_camera_register->defaultSet(1,0x5d,0xff);}
00163 
00164   //! Access 'Hue' feature register
00165   virtual const CameraRegister* hue()           {return (AvcCameraRegister*)avc_camera_register->defaultSet(1,0x5c,0xff);}
00166 
00167   //! Access 'Saturation' feature register
00168   virtual const CameraRegister* saturation()   {return (AvcCameraRegister*)avc_camera_register->defaultSet(1,0x5b,0xff);}
00169 
00170   //! Access 'Gamma' feature register
00171   virtual const CameraRegister* gamma()         {return (AvcCameraRegister*)avc_camera_register->defaultSet(1,0x52,0xff);}
00172 
00173   //! Access 'Shutter' feature register
00174   virtual const CameraRegister* shutter()       {avc_camera_register->setOffset(0x44); return avc_camera_register;}
00175 
00176   //! Access 'Gain' feature register
00177   virtual const CameraRegister* gain()         {return (AvcCameraRegister*)avc_camera_register->defaultSet(1,0x45,0xff);}
00178 
00179   //! Access 'Iris' feature register
00180   virtual const CameraRegister* iris()         {return (AvcCameraRegister*)avc_camera_register->defaultSet(1,0x43,0xff);}//check
00181 
00182   //! Access 'Focus' feature register
00183   virtual const CameraRegister* focus()          {return (AvcCameraRegister*)avc_camera_register->defaultSet(1,0xc1,0xff);}
00184 
00185   //! Access 'Temperature' feature register
00186   virtual const CameraRegister* temperature()   {avc_camera_register->setOffset(0x2c); return avc_camera_register;}//not c.!!
00187 
00188   //! Access 'Trigger' feature register
00189   virtual const CameraRegister* trigger()       {avc_camera_register->setOffset(0x30); return avc_camera_register;}//not c.
00190 
00191   //! Access 'Zoom' feature register
00192   virtual const CameraRegister* zoom()          {return (AvcCameraRegister*)avc_camera_register->defaultSet(1,0x61,0xff);}
00193 
00194   //! Access 'Pan' feature register
00195   virtual const CameraRegister* pan()           {avc_camera_register->setOffset(0xda); return avc_camera_register;}
00196 
00197   //! Access 'Tilt' feature register
00198   virtual const CameraRegister* tilt()         {avc_camera_register->setOffset(0xdb); return avc_camera_register;}
00199 
00200   //! Access 'Filter' feature register
00201   virtual const CameraRegister* filter()       {avc_camera_register->setOffset(0xcb); return avc_camera_register;}
00202 //@}
00203 
00204 private:
00205   //disabled Copy constructor
00206   AvcCamera (const AvcCamera&);
00207 
00208    //the register object
00209    AvcCameraRegister* avc_camera_register;
00210 
00211    //Parent node
00212   FcpNode* avc_parent;
00213 
00214   //is_init
00215   mutable bool is_init;
00216   int subunit_value;
00217   bool frame_mode;
00218 
00219   //iso-parameter
00220   int isomode, videomode;
00221   int  buffer,  framerate;
00222   int  channel;
00223 
00224 };
00225 } //namespace L1394
00226 
00227 
00228 
00229 #endif

Generated on Wed Aug 24 00:36:39 2005 for L1394 by doxygen 1.4.2
L1394 library (NMM) grahics.cs.uni-sb.de/~repplix/l1394_home/