2014-07-13 09:57:25 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QLabel>
|
2015-05-11 15:40:07 -04:00
|
|
|
#include "interface/rsVOIP.h"
|
2014-07-13 09:57:25 -04:00
|
|
|
|
|
|
|
class VideoEncoder ;
|
|
|
|
class CvCapture ;
|
|
|
|
|
|
|
|
// Responsible from displaying the video. The source of the video is
|
|
|
|
// a VideoDecoder object, which uses a codec.
|
|
|
|
//
|
|
|
|
class QVideoOutputDevice: public QLabel
|
|
|
|
{
|
|
|
|
public:
|
2015-05-11 15:40:07 -04:00
|
|
|
QVideoOutputDevice(QWidget *parent = 0) ;
|
2014-07-13 09:57:25 -04:00
|
|
|
|
|
|
|
void showFrame(const QImage&) ;
|
2014-07-20 16:50:36 -04:00
|
|
|
void showFrameOff() ;
|
2014-07-13 09:57:25 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// Responsible for grabbing the video from the webcam and sending it to the
|
|
|
|
// VideoEncoder object.
|
|
|
|
//
|
|
|
|
class QVideoInputDevice: public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2015-05-11 15:40:07 -04:00
|
|
|
QVideoInputDevice(QWidget *parent = 0) ;
|
2014-07-13 09:57:25 -04:00
|
|
|
~QVideoInputDevice() ;
|
|
|
|
|
|
|
|
// Captured images are sent to this encoder. Can be NULL.
|
|
|
|
//
|
|
|
|
void setVideoEncoder(VideoEncoder *venc) { _video_encoder = venc ; }
|
|
|
|
|
|
|
|
// All images received will be echoed to this target. We could use signal/slots, but it's
|
|
|
|
// probably faster this way. Can be NULL.
|
|
|
|
//
|
|
|
|
void setEchoVideoTarget(QVideoOutputDevice *odev) { _echo_output_device = odev ; }
|
|
|
|
|
2014-07-15 16:04:31 -04:00
|
|
|
// get the next encoded video data chunk.
|
|
|
|
//
|
2015-05-11 15:40:07 -04:00
|
|
|
bool getNextEncodedPacket(RsVOIPDataChunk&) ;
|
2014-07-15 16:04:31 -04:00
|
|
|
|
2014-07-13 09:57:25 -04:00
|
|
|
void start() ;
|
|
|
|
void stop() ;
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void grabFrame() ;
|
|
|
|
|
2014-07-15 16:04:31 -04:00
|
|
|
signals:
|
|
|
|
void networkPacketReady() ;
|
|
|
|
|
2014-07-13 09:57:25 -04:00
|
|
|
private:
|
|
|
|
VideoEncoder *_video_encoder ;
|
|
|
|
QTimer *_timer ;
|
|
|
|
CvCapture *_capture_device ;
|
|
|
|
|
|
|
|
QVideoOutputDevice *_echo_output_device ;
|
2014-07-15 16:04:31 -04:00
|
|
|
|
2015-05-11 15:40:07 -04:00
|
|
|
std::list<RsVOIPDataChunk> _out_queue ;
|
2014-07-13 09:57:25 -04:00
|
|
|
};
|
|
|
|
|