Started implementation of Video Chat (not working yet!).

- GUI part is done
- implemented a very basic JPEG codec
- added echo frame in configuration panel
- created a video capture object that uses OpenCV (should be cross systems)
Remains to do:
- serialise and send frames through p3VoRS
- use a serious codec (e.g. Theora+x264)
- add icons to reflect camera state (failure/working/sending/...)
- compilation on windows 



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7449 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-07-13 13:57:25 +00:00
parent 3b88acb45d
commit b6089f3b91
18 changed files with 873 additions and 420 deletions

View file

@ -0,0 +1,60 @@
#include <iostream>
#include <QByteArray>
#include <QBuffer>
#include <QImage>
#include "VideoProcessor.h"
#include "QVideoDevice.h"
//bool VideoDecoder::getNextImage(QImage& image)
//{
// if(_image_queue.empty())
// return false ;
//
// image = _image_queue.front() ;
// _image_queue.pop_front() ;
//
// return true ;
//}
bool VideoEncoder::addImage(const QImage& img)
{
std::cerr << "VideoEncoder: adding image." << std::endl;
encodeData(img) ;
if(_echo_output_device != NULL)
_echo_output_device->showFrame(img) ;
return true ;
}
void VideoDecoder::receiveEncodedData(const unsigned char *data,uint32_t size)
{
_output_device->showFrame(decodeData(data,size)) ;
}
QImage JPEGVideoDecoder::decodeData(const unsigned char *encoded_image_data,uint32_t size)
{
QByteArray qb((char*)encoded_image_data,size) ;
QImage image ;
if(image.loadFromData(qb))
return image ;
else
return QImage() ;
}
void JPEGVideoEncoder::encodeData(const QImage& image)
{
QByteArray qb ;
QBuffer buffer(&qb) ;
buffer.open(QIODevice::WriteOnly) ;
image.save(&buffer,"JPEG") ;
//destination_decoder->receiveEncodedData((unsigned char *)qb.data(),qb.size()) ;
std::cerr <<"sending encoded data. size = " << qb.size() << std::endl;
}