X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=mardrone%2Fdronelib%2Fvideo.h;h=526bb8b19b8774434e0cccc33909ca3e71a05b94;hb=36cc6e25d56bca63eef76e0ef3569c9b78514496;hp=3469cf02fb961b5b96f73021ecf95f5e6599b436;hpb=9810849a03cbb8f89bd3cbeb18c7b2005f846622;p=mardrone diff --git a/mardrone/dronelib/video.h b/mardrone/dronelib/video.h index 3469cf0..526bb8b 100644 --- a/mardrone/dronelib/video.h +++ b/mardrone/dronelib/video.h @@ -23,23 +23,7 @@ void vp_stages_YUV420P_to_ARGB32(void *cfg, vp_api_picture_t *picture, uint8_t * 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 DroneVideo; class VideoThread:public QThread { Q_OBJECT @@ -50,9 +34,19 @@ public: void run(); void sendVideoPort(QString cmd); void decodeTransform(QByteArray &videoData); + unsigned int getFrameSeq(); + bool getVideoRec(); + bool getVideoPlay(); + QString getVideoFileName(); + void setVideoFileName(QString name); +signals: + void frameSeqChanged(); public slots: void videoDataReady(); + void setVideoRec(bool rec); + + void setVideoPlay(bool play); void timer(); @@ -64,6 +58,11 @@ private: int pictureWidth; int pictureHeight; bool luma_only; + bool videoRec; + bool videoPlay; + QFile *videoFile; + QString videoFileName; + unsigned int frameSeq; unsigned int num_picture_decoded; QHostAddress droneHost; // Ip address of the drone QTimer *stateTimer; @@ -73,4 +72,47 @@ private: }; +class DroneVideo:public QGraphicsWidget +{ + Q_OBJECT +public: + + DroneVideo(); + void paint(QPainter *painter,const QStyleOptionGraphicsItem *option, + QWidget *widget); + QRectF boundingRect() const; + Q_PROPERTY(QImage* idleImage READ idleImage WRITE setIdleImage ) + Q_PROPERTY(bool recVideo READ recVideo WRITE setRecVideo ) + Q_PROPERTY(bool playVideo READ playVideo WRITE setPlayVideo ) + Q_PROPERTY(QString videoFileName READ videoFileName WRITE setVideoFileName NOTIFY frameSeqChanged) + Q_PROPERTY(unsigned int frameSeq READ frameSeq NOTIFY frameSeqChanged) + + + QImage* idleImage(); void setIdleImage(QImage *); + void setRecVideo(bool val_) { if(videoThread) videoThread->setVideoRec(val_);}; + bool recVideo() {return videoThread ? videoThread->getVideoRec():false;}; + + void setPlayVideo(bool val_) { if(videoThread) videoThread->setVideoPlay(val_);}; + bool playVideo() {return videoThread ? videoThread->getVideoPlay():false;}; + + int frameSeq() {return videoThread ? videoThread->getFrameSeq():0;}; + + QString videoFileName() const { return videoThread ? videoThread->getVideoFileName():"";}; + void setVideoFileName(const QString &name_) {if(videoThread) videoThread->setVideoFileName(name_);} +signals: + void frameSeqChanged(); + +public slots: + void frameSeqUpdated(); +private: + QHostAddress droneHost; // Ip address of the drone + + VideoThread *videoThread; + QImage *image; + QImage *m_idleImage; + int depth; + bool initialized; +}; + + #endif // VIDEO_H