debian build fixed for new name mardrone
[mardrone] / mardrone / video.h
1 #ifndef VIDEO_H
2 #define VIDEO_H
3
4 #include <QGraphicsWidget>
5 #include <QGraphicsItem>
6 #include <QPainter>
7 #include <QUdpSocket>
8 #include <QTcpSocket>
9 #include <QThread>
10 #include <QTimer>
11 #include "dronecontrol.h"
12 #undef _GNU_SOURCE // just get rid of error message double definition
13 #define TARGET_CPU_ARM 1
14 #include <navdata.h>
15 #include <VP_Os/vp_os_malloc.h>
16 #include <VP_Os/vp_os_print.h>
17 extern "C"
18 {
19 #include <VLIB/Stages/vlib_stage_decode.h>
20 void vp_stages_YUV420P_to_RGB565(void *cfg, vp_api_picture_t *picture, uint8_t *dst, uint32_t dst_rbytes);
21
22 }
23
24
25 class VideoThread;
26
27 class DroneVideo:public QGraphicsWidget
28 {
29     Q_OBJECT
30 public:
31     DroneVideo();
32     void paint(QPainter *painter,const QStyleOptionGraphicsItem *option,
33                     QWidget *widget);
34     QRectF boundingRect() const;
35
36 private:
37     QHostAddress droneHost;  // Ip address of the drone
38     VideoThread *videoThread;
39     QImage *image;
40         bool initialized;
41 };
42
43 class VideoThread:public QThread {
44     Q_OBJECT
45 public:
46     VideoThread(DroneVideo *parentp,QHostAddress host,QImage *_image);
47
48  //   ~DroneThread ();
49     void run();
50     void sendVideoPort(QString cmd);
51     void decodeTransform(QByteArray &videoData);
52
53 public slots:
54     void videoDataReady();
55     void timer();
56
57
58
59 private:
60     QImage *image;
61     video_controller_t controller;
62     vp_api_picture_t picture;
63     int pictureWidth;
64     int pictureHeight;
65     bool luma_only;
66     unsigned int num_picture_decoded;
67     QHostAddress droneHost;  // Ip address of the drone
68     QTimer *stateTimer;
69     volatile bool stopped;
70     DroneVideo *parent;
71     QUdpSocket *videoSock;  // Navigation data receive socket port 5554
72
73 };
74
75 #endif // VIDEO_H