xref: /OK3568_Linux_fs/app/forlinx/flapp/src/plugins/allwinner/camera/camera/videocapture.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 #ifndef VIDEOCAPTURE_H
2 #define VIDEOCAPTURE_H
3 
4 #include <QObject>
5 #include <QRunnable>
6 #include <QLabel>
7 #include <unistd.h>
8 
9 #define BUFINFOR_NUM  (6)
10 
11 class bufinfor{
12 public:
13     void *start;
14     unsigned int length;
15 };
16 
17 struct buffer {
18     void *start[3];
19     int length[3];
20 };
21 
22 class VideoCapture : public QObject, public QRunnable
23 {
24     Q_OBJECT
25 public:
26     explicit VideoCapture(QObject *parent,
27                           char *devname = "/dev/video0",
28                           int _width = 1280,
29                           int _height = 720);
30     int Init(void);
31     virtual ~VideoCapture();
32     int LoopCapture();
33 
run()34     virtual void run() {
35         while (!m_stop) {
36             LoopCapture();
37         }
38         m_stop = 0;
39     }
40 
stop()41     void stop() {
42         if (m_stop == 0) {
43             m_stop = 1;
44         //    while (m_stop) ::sleep(1);
45         }
46     }
47 
48     void SetImg(QLabel *);
49     int take;
50     int fd;
51     int nplanes;
52     struct buffer *buffers;
53 	int	csi_type;		// 1 csi 0 uvc
54 private:
55     int width;
56     int height;
57 
58     int m_stop;
59 
60     char devname[30];
61     QLabel *img;
62 
63 signals:
64     void SetShowImageBuffer(uchar *, int , int);
65 
66 public slots:
67 };
68 
69 #endif // VIDEOCAPTURE_H
70