--- /dev/null
+#ifndef VIDEO_H
+#define VIDEO_H
+
+#include <QGraphicsWidget>
+#include <QGraphicsItem>
+#include <QPainter>
+#include <QUdpSocket>
+#include <QTcpSocket>
+#include <QThread>
+#include <QTimer>
+#include "dronecontrol.h"
+#undef _GNU_SOURCE // just get rid of error message double definition
+#define TARGET_CPU_ARM 1
+#include <navdata.h>
+#include <VP_Os/vp_os_malloc.h>
+#include <VP_Os/vp_os_print.h>
+extern "C"
+{
+#include <VLIB/Stages/vlib_stage_decode.h>
+void vp_stages_YUV420P_to_RGB565(void *cfg, vp_api_picture_t *picture, uint8_t *dst, uint32_t dst_rbytes);
+void vp_stages_YUV420P_to_ARGB32(void *cfg, vp_api_picture_t *picture, uint8_t *dst, uint32_t dst_rbytes);
+}
+
+
+class VideoThread;
+
+class DroneVideo:public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ DroneVideo();
+ void paint(QPainter *painter,const QStyleOptionGraphicsItem *option,
+ QWidget *widget);
+ QRectF boundingRect() const;
+
+private:
+ QHostAddress droneHost; // Ip address of the drone
+ VideoThread *videoThread;
+ QImage *image;
+ int depth;
+ bool initialized;
+};
+
+class VideoThread:public QThread {
+ Q_OBJECT
+public:
+ VideoThread(DroneVideo *parentp,QHostAddress host,QImage *_image);
+
+ // ~DroneThread ();
+ void run();
+ void sendVideoPort(QString cmd);
+ void decodeTransform(QByteArray &videoData);
+
+public slots:
+ void videoDataReady();
+ void timer();
+
+
+
+private:
+ QImage *image;
+ video_controller_t controller;
+ vp_api_picture_t picture;
+ int pictureWidth;
+ int pictureHeight;
+ bool luma_only;
+ unsigned int num_picture_decoded;
+ QHostAddress droneHost; // Ip address of the drone
+ QTimer *stateTimer;
+ volatile bool stopped;
+ DroneVideo *parent;
+ QUdpSocket *videoSock; // Navigation data receive socket port 5554
+
+};
+
+#endif // VIDEO_H