4 #include <QGraphicsWidget>
5 #include <QGraphicsItem>
11 #include "dronecontrol.h"
12 #undef _GNU_SOURCE // just get rid of error message double definition
13 #define TARGET_CPU_ARM 1
15 #include <VP_Os/vp_os_malloc.h>
16 #include <VP_Os/vp_os_print.h>
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 void vp_stages_YUV420P_to_ARGB32(void *cfg, vp_api_picture_t *picture, uint8_t *dst, uint32_t dst_rbytes);
28 class VideoThread:public QThread {
31 VideoThread(DroneVideo *parentp,QHostAddress host,QImage *_image);
35 void sendVideoPort(QString cmd);
36 void decodeTransform(QByteArray &videoData);
37 unsigned int getFrameSeq();
40 QString getVideoFileName();
41 void setVideoFileName(QString name);
44 void frameSeqChanged();
46 void videoDataReady();
47 void setVideoRec(bool rec);
49 void setVideoPlay(bool play);
56 video_controller_t controller;
57 vp_api_picture_t picture;
64 QString videoFileName;
65 unsigned int frameSeq;
66 unsigned int num_picture_decoded;
67 QHostAddress droneHost; // Ip address of the drone
69 volatile bool stopped;
71 QUdpSocket *videoSock; // Navigation data receive socket port 5554
75 class DroneVideo:public QGraphicsWidget
81 void paint(QPainter *painter,const QStyleOptionGraphicsItem *option,
83 QRectF boundingRect() const;
84 Q_PROPERTY(QImage* idleImage READ idleImage WRITE setIdleImage )
85 Q_PROPERTY(bool recVideo READ recVideo WRITE setRecVideo )
86 Q_PROPERTY(bool playVideo READ playVideo WRITE setPlayVideo )
87 Q_PROPERTY(QString videoFileName READ videoFileName WRITE setVideoFileName NOTIFY frameSeqChanged)
88 Q_PROPERTY(unsigned int frameSeq READ frameSeq NOTIFY frameSeqChanged)
91 QImage* idleImage(); void setIdleImage(QImage *);
92 void setRecVideo(bool val_) { if(videoThread) videoThread->setVideoRec(val_);};
93 bool recVideo() {return videoThread ? videoThread->getVideoRec():false;};
95 void setPlayVideo(bool val_) { if(videoThread) videoThread->setVideoPlay(val_);};
96 bool playVideo() {return videoThread ? videoThread->getVideoPlay():false;};
98 int frameSeq() {return videoThread ? videoThread->getFrameSeq():0;};
100 QString videoFileName() const { return videoThread ? videoThread->getVideoFileName():"";};
101 void setVideoFileName(const QString &name_) {if(videoThread) videoThread->setVideoFileName(name_);}
103 void frameSeqChanged();
106 void frameSeqUpdated();
108 QHostAddress droneHost; // Ip address of the drone
110 VideoThread *videoThread;