00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef ARDEV_CAPTURE_H
00021 #define ARDEV_CAPTURE_H
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include <ardev/ardevconfig.h>
00032 #include <ardev/ardev.h>
00033
00034 #include <sys/time.h>
00035 #include <linux/videodev.h>
00036 #include <libthjc/misc.h>
00037
00038 #ifdef HAVE_DC1394
00039 #include <libraw1394/raw1394.h>
00040 #include <dc1394/control.h>
00041 #endif
00042
00043
00044
00051 class CaptureFile : public CaptureObject
00052 {
00053 public:
00059 CaptureFile(const char * FileName, int Delay=0);
00061 const ARImage & GetFrame();
00063 int GetMaxWidth();
00065 int GetMaxHeight();
00066 private:
00067 char * FileName;
00068 int Delay;
00069 ARImage Frame;
00070 };
00071
00072
00076 class CaptureV4L : public CaptureObject
00077 {
00078 public:
00080 CaptureV4L(const char * _VideoDev ="/dev/video0", int _width=768, int _height=480, int _channel=1, int _format=1, int _tuner=-1);
00082 virtual ~CaptureV4L() {free(VideoDev);};
00084 const ARImage & GetFrame();
00086 bool Fresh() {return !Blocking;};
00088 int GetMaxWidth();
00090 int GetMaxHeight();
00091 private:
00092 char * VideoDev;
00093 int width;
00094 int height;
00095 int channel;
00096 int format;
00097
00098
00099 int NumFrames;
00100 int CurrentFrame;
00101
00102 bool Open;
00103 int vid_fd;
00104 unsigned char * uservmem;
00105 struct video_mmap m_vmem;
00106 bool Blocking;
00107
00108 ARImage Frame;
00109 };
00110
00111 #ifdef HAVE_DC1394
00112
00115 class CaptureDC1394 : public CaptureObject
00116 {
00117 public:
00119 CaptureDC1394();
00121 virtual ~CaptureDC1394();
00122
00124 virtual int Initialise(bool Active = true);
00126 virtual void Terminate();
00127
00128
00130 const ARImage & GetFrame();
00132 bool Fresh() {return !Blocking;};
00134 int GetMaxWidth();
00136 int GetMaxHeight();
00137 private:
00138 bool Open;
00139 bool Blocking;
00140
00142 dc1394camera_t * camera;
00143 dc1394featureset_t features;
00144 dc1394format7modeset_t modeset;
00145
00146 dc1394speed_t speed;
00147
00148 StopWatch Timer;
00149
00150 ARImage Frame;
00151 };
00152 #endif
00153
00154 #endif