Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

CameraDriverQTSG.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_CameraDriverQTSG_h_
00003 #define INCLUDED_CameraDriverQTSG_h_
00004 
00005 #include "local/DeviceDriver.h"
00006 #include "local/DataSources/CameraSourceQTSG.h"
00007 
00008 //! This driver provides camera capture through QuickTime and the Sequence Grabber, which is deprecated.  See the alternative CameraDriverQTKit implementation.
00009 /*! This camera driver is used on pre-10.6 systems, supporting 32 bit only */
00010 class CameraDriverQTSG : public virtual DeviceDriver, public virtual plist::CollectionListener {
00011 public:
00012   //! constructor, may throw a const char* on error
00013   explicit CameraDriverQTSG(const std::string& name)
00014     : DeviceDriver(autoRegisterCameraDriver,name)
00015   {
00016     if(!checkQTThreadInit()) {
00017       std::cerr << "CameraDriver: Couldn't initialize QuickTime" << std::endl;
00018       return;
00019     }
00020     
00021     updateCameraList();
00022   }
00023   
00024   ~CameraDriverQTSG() {}
00025   
00026   virtual std::string getClassName() const { return autoRegisterCameraDriver; }
00027   
00028   virtual void getImageSources(std::map<std::string,DataSource*>& sources) {
00029     sources.clear();
00030     for(const_iterator it=begin(); it!=end(); ++it) {
00031       if(it->first==".type")
00032         continue;
00033       if(CameraSourceQTSG * ds = dynamic_cast<CameraSourceQTSG*>(it->second))
00034         sources[it->first]=ds;
00035       else
00036         std::cerr << "WARNING CameraDriver entry " << it->first << " is not actually a CameraSource!!!" << std::endl;
00037     }
00038   }
00039   
00040 protected:
00041   //! converts from pascal-format string to c-format string
00042   static std::string p2c(unsigned char pascalStr[]) {
00043     unsigned char len = *pascalStr++;
00044     return std::string(reinterpret_cast<char*>(pascalStr),len);
00045   }
00046   
00047   static void dumpLiteral(OSType t);
00048   
00049   void updateCameraList();
00050   
00051 private:
00052   //! holds the class name, set via registration with the DeviceDriver registry
00053   static const std::string autoRegisterCameraDriver;
00054 };
00055 
00056 /*! @file
00057  * @brief Describes CameraDriverQTSG, which provides camera capture through QuickTime and the Sequence Grabber, now deprecated.  See the alternative CameraDriverQTKit implementation.
00058  * @author Ethan Tira-Thompson (ejt) (Creator)
00059  */
00060 
00061 #endif

Tekkotsu Hardware Abstraction Layer 5.1CVS
Generated Mon May 9 05:01:37 2016 by Doxygen 1.6.3