Go to the documentation of this file.00001 #ifndef _OF_VIDEO_GRABBER
00002 #define _OF_VIDEO_GRABBER
00003
00004 #include "ofConstants.h"
00005 #include "ofTexture.h"
00006 #include "ofGraphics.h"
00007 #include "ofTypes.h"
00008
00009 #ifdef OF_VIDEO_CAPTURE_QUICKTIME
00010 #include "ofQtUtils.h"
00011 #endif
00012
00013 #ifdef OF_VIDEO_CAPTURE_DIRECTSHOW
00014 #include "videoInput.h"
00015 #endif
00016
00017 #ifdef OF_VIDEO_CAPTURE_UNICAP
00018 #include "ofUCUtils.h"
00019 #endif
00020
00021
00022
00023
00024
00025
00026
00027
00028 class ofVideoGrabber : public ofBaseVideo{
00029
00030 public :
00031
00032 ofVideoGrabber();
00033 virtual ~ofVideoGrabber();
00034
00035 int getDeviceCount();
00036
00037 void listDevices();
00038 bool isFrameNew();
00039 void grabFrame();
00040 void close();
00041 bool initGrabber(int w, int h, bool bTexture = true);
00042 void videoSettings();
00043 unsigned char * getPixels();
00044 ofTexture & getTextureReference();
00045 void setVerbose(bool bTalkToMe);
00046 void setDeviceID(int _deviceID);
00047 void setUseTexture(bool bUse);
00048 void draw(float x, float y, float w, float h);
00049 void draw(float x, float y);
00050 void update();
00051
00052
00053
00054
00055 void setAnchorPercent(float xPct, float yPct);
00056 void setAnchorPoint(int x, int y);
00057 void resetAnchor();
00058
00059 float getHeight();
00060 float getWidth();
00061
00062 int height;
00063 int width;
00064
00065 protected:
00066
00067 bool bChooseDevice;
00068 int deviceID;
00069 bool bUseTexture;
00070 ofTexture tex;
00071 bool bVerbose;
00072 bool bGrabberInited;
00073 unsigned char * pixels;
00074 bool bIsFrameNew;
00075
00076
00077 #ifdef OF_VIDEO_CAPTURE_QUICKTIME
00078
00079
00080 unsigned char * offscreenGWorldPixels;
00081 int w,h;
00082 bool bHavePixelsChanged;
00083 GWorldPtr videogworld;
00084 SeqGrabComponent gSeqGrabber;
00085 SGChannel gVideoChannel;
00086 Rect videoRect;
00087 bool bSgInited;
00088 string deviceName;
00089
00090 bool qtInitSeqGrabber();
00091 bool qtCloseSeqGrabber();
00092 bool qtSelectDevice(int deviceNumber, bool didWeChooseADevice);
00093
00094
00095 #ifdef TARGET_OSX
00096
00097
00098 bool saveSettings();
00099 bool loadSettings();
00100
00101
00102 #endif
00103
00104
00105
00106 #endif
00107
00108
00109 #ifdef OF_VIDEO_CAPTURE_DIRECTSHOW
00110 int device;
00111 videoInput VI;
00112
00113 bool bDoWeNeedToResize;
00114
00115 #endif
00116
00117
00118 #ifdef OF_VIDEO_CAPTURE_UNICAP
00119 ofUCUtils ucGrabber;
00120 #endif
00121
00122
00123
00124
00125
00126 #ifdef OF_VIDEO_CAPTURE_V4L
00127 int device;
00128 char dev_name[80];
00129 bool bV4LGrabberInited;
00130 #endif
00131
00132
00133
00134
00135 };
00136
00137
00138
00139
00140 #endif
00141