Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
VideoSource_DV.hh
1 #ifndef __BIASVIDEOSOURCE_DV_HH__
2 #define __BIASVIDEOSOURCE_DV_HH__
3 
4 #include <bias_config.h>
5 #ifndef BIAS_HAVE_DV
6 # error Please recompile BIAS with DV to use VideoSource_DV
7 #endif // BUILD_VideoSource
8 
9 
10 #include "VideoSource_Base.hh"
11 #include <sys/time.h>
12 #include <libraw1394/raw1394.h>
13 
14 
15 
16 #ifndef MAX_1394_CARDS
17 #define MAX_1394_CARDS 2
18 #endif
19 
20 #ifndef MAX_1394_CHANNELS
21 #define MAX_1394_CHANNELS 100
22 #endif
23 
24 // 300 packets/frame, each of 480 bytes
25 #define DV_PIC_SIZE 144000
26 
27 namespace BIAS{
28 
29 /**
30  \class VideoSource_DV
31  \ingroup g_videosource
32  \author evers
33  \brief This class extends VideoSource for the use of IEEE1394-connected
34  DV-camcorders.
35 
36  It uses the old raw1394 interface to transfer packets without DMA.
37 
38 */
39  class VideoSource_DV : public VideoSource{
40 
41 
42  public:
43  VideoSource_DV(int Card);
46 
47  int OpenDevice();
48  int CloseDevice();
49 
50  int OpenDevice(const char *device);
51 
52  int UseChannel(int channel);
53 
55 
56  int PreGrab();
57 
58  int PostGrab();
59 
60 
61 
62  protected:
63  void VideoSource_DV_Internal_Init_(int card);
64  static raw1394handle_t IEEE1394Handle_[MAX_1394_CARDS];
65  static int Instances_[MAX_1394_CARDS];
66  static int InstancesTotal_;
67 
68 
69  // this is the card to serve for
71  int Channel_;
76 
77 
78  unsigned char *GrabBuffer_;
79 
80 
81  friend int raw_dv_handler(raw1394handle_t handle, int channel,
82  size_t length, quadlet_t *data);
83 
84 
85 
86  };
87 } // namespace BIAS
88 
89  /** This array is used to associate DV-sources identified via channel witch
90  * videosource-objects since raw_dv_handler() only knows the handle and
91  * channel, not the instance-object of videosource().
92  * It would be better to use handle instead of channel, to avoid conflicts
93  * with cameras connected to different cards using the same channel (63)
94  */
95  extern BIAS::VideoSource_DV* videosourcefromchannel[MAX_1394_CHANNELS];
96 
97 
98 
99 #endif
Defines a common interface to different devices.
static int Instances_[MAX_1394_CARDS]
unsigned char * GrabBuffer_
int UseChannel(int channel)
static int InstancesTotal_
static raw1394handle_t IEEE1394Handle_[MAX_1394_CARDS]
int PreGrab()
Do last preparations before grabbing (e.g. start ISO transfer)
void VideoSource_DV_Internal_Init_(int card)
int GrabSingle(BIAS::Camera< unsigned char > &image)
int OpenDevice()
selects the first available device to open (e.g.
int PostGrab()
Stop anything started in PreGrab()
friend int raw_dv_handler(raw1394handle_t handle, int channel, size_t length, quadlet_t *data)
This class extends VideoSource for the use of IEEE1394-connected DV-camcorders.