Renaming all to VOIP in VOIP plugin (patch from Phenom)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8231 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
electron128 2015-05-11 19:40:07 +00:00
parent a3b32b92d5
commit b5bf3ce130
29 changed files with 860 additions and 686 deletions

View file

@ -39,7 +39,7 @@
//#include "NetworkConfig.h"
#include "audiodevicehelper.h"
#include "AudioWizard.h"
#include <interface/rsvoip.h>
#include <interface/rsVOIP.h>
#define iroundf(x) ( static_cast<int>(x) )
@ -112,9 +112,9 @@ void AudioInputConfig::load()
}
qcbSystem->setEnabled(qcbSystem->count() > 1);*/
ui.qcbTransmit->addItem(tr("Continuous"), RsVoip::AudioTransmitContinous);
ui.qcbTransmit->addItem(tr("Voice Activity"), RsVoip::AudioTransmitVAD);
ui.qcbTransmit->addItem(tr("Push To Talk"), RsVoip::AudioTransmitPushToTalk);
ui.qcbTransmit->addItem(tr("Continuous"), RsVOIP::AudioTransmitContinous);
ui.qcbTransmit->addItem(tr("Voice Activity"), RsVOIP::AudioTransmitVAD);
ui.qcbTransmit->addItem(tr("Push To Talk"), RsVOIP::AudioTransmitPushToTalk);
abSpeech = new AudioBar();
abSpeech->qcBelow = Qt::red;
@ -151,26 +151,26 @@ void AudioInputConfig::loadSettings() {
loadSlider(qsTransmitMax, iroundf(r.fVADmax * 32767.0f + 0.5f));
loadSlider(qsFrames, (r.iFramesPerPacket == 1) ? 1 : (r.iFramesPerPacket/2 + 1));
loadSlider(qsDoublePush, iroundf(static_cast<float>(r.uiDoublePush) / 1000.f + 0.5f));*/
ui.qcbTransmit->setCurrentIndex(rsVoip->getVoipATransmit());
on_qcbTransmit_currentIndexChanged(rsVoip->getVoipATransmit());
ui.qsTransmitHold->setValue(rsVoip->getVoipVoiceHold());
on_qsTransmitHold_valueChanged(rsVoip->getVoipVoiceHold());
ui.qsTransmitMin->setValue(rsVoip->getVoipfVADmin());
ui.qsTransmitMax->setValue(rsVoip->getVoipfVADmax());
ui.qcbEchoCancel->setChecked(rsVoip->getVoipEchoCancel());
ui.qcbTransmit->setCurrentIndex(rsVOIP->getVoipATransmit());
on_qcbTransmit_currentIndexChanged(rsVOIP->getVoipATransmit());
ui.qsTransmitHold->setValue(rsVOIP->getVoipVoiceHold());
on_qsTransmitHold_valueChanged(rsVOIP->getVoipVoiceHold());
ui.qsTransmitMin->setValue(rsVOIP->getVoipfVADmin());
ui.qsTransmitMax->setValue(rsVOIP->getVoipfVADmax());
ui.qcbEchoCancel->setChecked(rsVOIP->getVoipEchoCancel());
//ui.qsDoublePush->setValue(iroundf(static_cast<float>(r.uiDoublePush) / 1000.f + 0.5f));
//loadCheckBox(qcbPushClick, r.bPushClick);
//loadSlider(qsQuality, r.iQuality);
if (rsVoip->getVoipiNoiseSuppress() != 0)
ui.qsNoise->setValue(-rsVoip->getVoipiNoiseSuppress());
if (rsVOIP->getVoipiNoiseSuppress() != 0)
ui.qsNoise->setValue(-rsVOIP->getVoipiNoiseSuppress());
else
ui.qsNoise->setValue(14);
on_qsNoise_valueChanged(-rsVoip->getVoipiNoiseSuppress());
on_qsNoise_valueChanged(-rsVOIP->getVoipiNoiseSuppress());
ui.qsAmp->setValue(20000 - rsVoip->getVoipiMinLoudness());
on_qsAmp_valueChanged(20000 - rsVoip->getVoipiMinLoudness());
ui.qsAmp->setValue(20000 - rsVOIP->getVoipiMinLoudness());
on_qsAmp_valueChanged(20000 - rsVOIP->getVoipiMinLoudness());
//loadSlider(qsIdle, r.iIdleTime);
/*int echo = 0;
@ -190,14 +190,14 @@ void AudioInputConfig::loadSettings() {
bool AudioInputConfig::save(QString &/*errmsg*/) {//mainly useless beacause saving occurs in realtime
//s.iQuality = qsQuality->value();
rsVoip->setVoipiNoiseSuppress((ui.qsNoise->value() == 14) ? 0 : - ui.qsNoise->value());
rsVoip->setVoipiMinLoudness(20000 - ui.qsAmp->value());
rsVoip->setVoipVoiceHold(ui.qsTransmitHold->value());
rsVoip->setVoipfVADmin(ui.qsTransmitMin->value());
rsVoip->setVoipfVADmax(ui.qsTransmitMax->value());
rsVOIP->setVoipiNoiseSuppress((ui.qsNoise->value() == 14) ? 0 : - ui.qsNoise->value());
rsVOIP->setVoipiMinLoudness(20000 - ui.qsAmp->value());
rsVOIP->setVoipVoiceHold(ui.qsTransmitHold->value());
rsVOIP->setVoipfVADmin(ui.qsTransmitMin->value());
rsVOIP->setVoipfVADmax(ui.qsTransmitMax->value());
/*s.uiDoublePush = qsDoublePush->value() * 1000;*/
rsVoip->setVoipATransmit(static_cast<RsVoip::enumAudioTransmit>(ui.qcbTransmit->currentIndex() ));
rsVoip->setVoipEchoCancel(ui.qcbEchoCancel->isChecked());
rsVOIP->setVoipATransmit(static_cast<RsVOIP::enumAudioTransmit>(ui.qcbTransmit->currentIndex() ));
rsVOIP->setVoipEchoCancel(ui.qcbEchoCancel->isChecked());
return true;
}
@ -220,7 +220,7 @@ void AudioInputConfig::on_qsTransmitHold_valueChanged(int v) {
float val = static_cast<float>(v * FRAME_SIZE);
val = val / SAMPLING_RATE;
ui.qlTransmitHold->setText(tr("%1 s").arg(val, 0, 'f', 2));
rsVoip->setVoipVoiceHold(v);
rsVOIP->setVoipVoiceHold(v);
}
void AudioInputConfig::on_qsNoise_valueChanged(int v) {
@ -233,18 +233,18 @@ void AudioInputConfig::on_qsNoise_valueChanged(int v) {
ui.qlNoise->setText(tr("-%1 dB").arg(v));
}
ui.qlNoise->setPalette(pal);
rsVoip->setVoipiNoiseSuppress(- ui.qsNoise->value());
rsVOIP->setVoipiNoiseSuppress(- ui.qsNoise->value());
}
void AudioInputConfig::on_qsAmp_valueChanged(int v) {
v = 20000 - v;
float d = 20000.0f/static_cast<float>(v);
ui.qlAmp->setText(QString::fromLatin1("%1").arg(d, 0, 'f', 2));
rsVoip->setVoipiMinLoudness(20000 - ui.qsAmp->value());
rsVOIP->setVoipiMinLoudness(20000 - ui.qsAmp->value());
}
void AudioInputConfig::on_qcbEchoCancel_clicked() {
rsVoip->setVoipEchoCancel(ui.qcbEchoCancel->isChecked());
rsVOIP->setVoipEchoCancel(ui.qcbEchoCancel->isChecked());
}
@ -261,7 +261,7 @@ void AudioInputConfig::on_qcbTransmit_currentIndexChanged(int v) {
break;
}
if (loaded)
rsVoip->setVoipATransmit(static_cast<RsVoip::enumAudioTransmit>(ui.qcbTransmit->currentIndex() ));
rsVOIP->setVoipATransmit(static_cast<RsVOIP::enumAudioTransmit>(ui.qcbTransmit->currentIndex() ));
}
@ -280,8 +280,8 @@ void AudioInputConfig::on_Tick_timeout() {
abSpeech->iBelow = ui.qsTransmitMin->value();
abSpeech->iAbove = ui.qsTransmitMax->value();
if (loaded) {
rsVoip->setVoipfVADmin(ui.qsTransmitMin->value());
rsVoip->setVoipfVADmax(ui.qsTransmitMax->value());
rsVOIP->setVoipfVADmin(ui.qsTransmitMin->value());
rsVOIP->setVoipfVADmax(ui.qsTransmitMax->value());
}
abSpeech->iValue = iroundf(inputAudioProcessor->dVoiceAcivityLevel * 32767.0f + 0.5f);

View file

@ -28,8 +28,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _AUDIOINPUTCONFIG_H
#define _AUDIOINPUTCONFIG_H
#pragma once
#include <QAudioInput>
#include <QWidget>
@ -88,5 +87,3 @@ class AudioInputConfig : public ConfigPage
void on_qpbAudioWizard_clicked();
void on_qcbEchoCancel_clicked();
};
#endif

View file

@ -28,8 +28,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _AUDIOSTATS_H
#define _AUDIOSTATS_H
#pragma once
#include <QWidget>
@ -89,7 +88,3 @@ class AudioStats : public QDialog, public Ui::AudioStats {
void on_Tick_timeout();
};
*/
#else
class AudioStats;
#endif

View file

@ -37,7 +37,7 @@
//#include "Log.h"
//#include "MainWindow.h"
#include "audiodevicehelper.h"
#include "interface/rsvoip.h"
#include "interface/rsVOIP.h"
#define iroundf(x) ( static_cast<int>(x) )
@ -89,9 +89,9 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
verticalLayout_3->addWidget(abAmplify);
if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitPushToTalk)
if (rsVOIP->getVoipATransmit() == RsVOIP::AudioTransmitPushToTalk)
qrPTT->setChecked(true);
else if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitVAD)
else if (rsVOIP->getVoipATransmit() == RsVOIP::AudioTransmitVAD)
qrVAD->setChecked(true);
else
qrContinuous->setChecked(true);
@ -101,13 +101,13 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
abVAD->qcInside = Qt::yellow;
abVAD->qcAbove = Qt::green;
qsTransmitMin->setValue(rsVoip->getVoipfVADmin());
qsTransmitMax->setValue(rsVoip->getVoipfVADmax());
qsTransmitMin->setValue(rsVOIP->getVoipfVADmin());
qsTransmitMax->setValue(rsVOIP->getVoipfVADmax());
verticalLayout_6->addWidget(abVAD);
// Volume
qsMaxAmp->setValue(rsVoip->getVoipiMinLoudness());
qsMaxAmp->setValue(rsVOIP->getVoipiMinLoudness());
setOption(QWizard::NoCancelButton, false);
resize(700, 500);
@ -149,7 +149,7 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
void AudioWizard::on_qsMaxAmp_valueChanged(int v) {
rsVoip->setVoipiMinLoudness(qMin(v, 30000));
rsVOIP->setVoipiMinLoudness(qMin(v, 30000));
}
void AudioWizard::on_Ticker_timeout() {
@ -177,8 +177,8 @@ void AudioWizard::on_Ticker_timeout() {
abVAD->iBelow = qsTransmitMin->value();
abVAD->iAbove = qsTransmitMax->value();
rsVoip->setVoipfVADmin(qsTransmitMin->value());
rsVoip->setVoipfVADmax(qsTransmitMax->value());
rsVOIP->setVoipfVADmin(qsTransmitMin->value());
rsVOIP->setVoipfVADmax(qsTransmitMax->value());
abVAD->iValue = iroundf(inputProcessor->dVoiceAcivityLevel * 32767.0f + 0.5f);
@ -233,19 +233,19 @@ void AudioWizard::on_playEcho_timeout() {
void AudioWizard::on_qsTransmitMax_valueChanged(int v) {
if (! bInit) {
rsVoip->setVoipfVADmax(v);
rsVOIP->setVoipfVADmax(v);
}
}
void AudioWizard::on_qsTransmitMin_valueChanged(int v) {
if (! bInit) {
rsVoip->setVoipfVADmin(v);
rsVOIP->setVoipfVADmin(v);
}
}
void AudioWizard::on_qrVAD_clicked(bool on) {
if (on) {
rsVoip->setVoipATransmit(RsVoip::AudioTransmitVAD);
rsVOIP->setVoipATransmit(RsVOIP::AudioTransmitVAD);
updateTriggerWidgets(true);
bTransmitChanged = true;
}
@ -253,7 +253,7 @@ void AudioWizard::on_qrVAD_clicked(bool on) {
void AudioWizard::on_qrPTT_clicked(bool on) {
if (on) {
rsVoip->setVoipATransmit(RsVoip::AudioTransmitPushToTalk);
rsVOIP->setVoipATransmit(RsVOIP::AudioTransmitPushToTalk);
updateTriggerWidgets(false);
bTransmitChanged = true;
}
@ -261,7 +261,7 @@ void AudioWizard::on_qrPTT_clicked(bool on) {
void AudioWizard::on_qrContinuous_clicked(bool on) {
if (on) {
rsVoip->setVoipATransmit(RsVoip::AudioTransmitContinous);
rsVOIP->setVoipATransmit(RsVOIP::AudioTransmitContinous);
updateTriggerWidgets(false);
bTransmitChanged = true;
}

View file

@ -28,8 +28,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _AUDIOWIZARD_H
#define _AUDIOWIZARD_H
#pragma once
#include <QAudioInput>
#include <QAudioOutput>
@ -95,5 +94,3 @@ class AudioWizard: public QWizard, public Ui::AudioWizard {
void loopAudio();
};
#endif

View file

@ -1,102 +0,0 @@
#include <iostream>
#include <vector>
#include <list>
#include <interface/rsvoip.h>
#include "PluginGUIHandler.h"
#include <gui/chat/ChatDialog.h>
#include <gui/VOIPChatWidgetHolder.h>
#include "gui/chat/ChatWidget.h"
#include "gui/settings/rsharesettings.h"
void PluginGUIHandler::ReceivedInvitation(const QString& /*peer_id*/)
{
std::cerr << "****** Plugin GUI handler: received Invitation!" << std::endl;
}
void PluginGUIHandler::ReceivedVoipHangUp(const QString& /*peer_id*/)
{
std::cerr << "****** Plugin GUI handler: received HangUp!" << std::endl;
}
void PluginGUIHandler::ReceivedVoipAccept(const QString& /*peer_id*/)
{
std::cerr << "****** Plugin GUI handler: received VoipAccept!" << std::endl;
}
void PluginGUIHandler::ReceivedVoipData(const QString& qpeer_id)
{
RsPeerId peer_id(qpeer_id.toStdString()) ;
std::vector<RsVoipDataChunk> chunks ;
if(!rsVoip->getIncomingData(peer_id,chunks))
{
std::cerr << "PluginGUIHandler::ReceivedVoipData(): No data chunks to get. Weird!" << std::endl;
return ;
}
ChatDialog *di = ChatDialog::getChat(ChatId(peer_id), Settings->getChatFlags());
if (di) {
ChatWidget *cw = di->getChatWidget();
if (cw) {
const QList<ChatWidgetHolder*> &chatWidgetHolderList = cw->chatWidgetHolderList();
foreach (ChatWidgetHolder *chatWidgetHolder, chatWidgetHolderList)
{
VOIPChatWidgetHolder *acwh = dynamic_cast<VOIPChatWidgetHolder*>(chatWidgetHolder) ;
if (acwh) {
for (unsigned int i = 0; i < chunks.size(); ++i) {
for (unsigned int chunkIndex=0; chunkIndex<chunks.size(); chunkIndex++)
{
QByteArray qb(reinterpret_cast<const char *>(chunks[chunkIndex].data),chunks[chunkIndex].size);
if(chunks[chunkIndex].type == RsVoipDataChunk::RS_VOIP_DATA_TYPE_AUDIO)
acwh->addAudioData(QString::fromStdString(peer_id.toStdString()),&qb);
else if(chunks[chunkIndex].type == RsVoipDataChunk::RS_VOIP_DATA_TYPE_VIDEO)
acwh->addVideoData(QString::fromStdString(peer_id.toStdString()),&qb);
else
std::cerr << "Unknown data type received. type=" << chunks[chunkIndex].type << std::endl;
}
}
break;
}
}
}
} else {
std::cerr << "Error: received audio data for a chat dialog that does not stand Audio (Peer id = " << peer_id.toStdString() << "!" << std::endl;
}
for(unsigned int chunkIndex=0; chunkIndex<chunks.size(); chunkIndex++){
free(chunks[chunkIndex].data);
}
}
void PluginGUIHandler::ReceivedVoipBandwidthInfo(const QString& qpeer_id,int bytes_per_sec)
{
RsPeerId peer_id(qpeer_id.toStdString()) ;
ChatDialog *di = ChatDialog::getExistingChat(ChatId(peer_id)) ;
std::cerr << "PluginGUIHandler::received bw info for peer " << qpeer_id.toStdString() << ": " << bytes_per_sec << " Bps" << std::endl;
if(!di)
{
std::cerr << "Error: received bandwidth info for a chat dialog that does not stand VOIP (Peer id = " << peer_id.toStdString() << "!" << std::endl;
return ;
}
ChatWidget *cw = di->getChatWidget();
if(!cw)
{
return ;
}
const QList<ChatWidgetHolder*> &chatWidgetHolderList = cw->chatWidgetHolderList();
foreach (ChatWidgetHolder *chatWidgetHolder, chatWidgetHolderList)
{
VOIPChatWidgetHolder *acwh = dynamic_cast<VOIPChatWidgetHolder*>(chatWidgetHolder) ;
if (acwh)
acwh->setAcceptedBandwidth(QString::fromStdString(peer_id.toStdString()),bytes_per_sec);
}
}

View file

@ -1,21 +0,0 @@
// This class receives async-ed signals from the plugin notifier,
// and executes GUI requests.
//
// It is never called directly: it is called by Qt signal-received callback,
// in the main GUI thread.
//
#include <stdint.h>
#include <QObject>
class PluginGUIHandler: public QObject
{
Q_OBJECT
public slots:
void ReceivedInvitation(const QString& peer_id) ;
void ReceivedVoipData(const QString& peer_id) ;
void ReceivedVoipHangUp(const QString& peer_id) ;
void ReceivedVoipAccept(const QString& peer_id) ;
void ReceivedVoipBandwidthInfo(const QString& peer_id,int) ;
};

View file

@ -1,22 +0,0 @@
#include "PluginNotifier.h"
void PluginNotifier::notifyReceivedVoipInvite(const RsPeerId& peer_id)
{
emit voipInvitationReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void PluginNotifier::notifyReceivedVoipData(const RsPeerId &peer_id)
{
emit voipDataReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void PluginNotifier::notifyReceivedVoipAccept(const RsPeerId& peer_id)
{
emit voipAcceptReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void PluginNotifier::notifyReceivedVoipHangUp(const RsPeerId &peer_id)
{
emit voipHangUpReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void PluginNotifier::notifyReceivedVoipBandwidth(const RsPeerId &peer_id,uint32_t bytes_per_sec)
{
emit voipBandwidthInfoReceived(QString::fromStdString(peer_id.toStdString()),bytes_per_sec) ;
}

View file

@ -7,6 +7,7 @@
#include "VideoProcessor.h"
QVideoInputDevice::QVideoInputDevice(QWidget *parent)
:QObject(parent)
{
_timer = NULL ;
_capture_device = NULL ;
@ -85,7 +86,7 @@ void QVideoInputDevice::grabFrame()
if(_echo_output_device != NULL) _echo_output_device->showFrame(image) ;
}
bool QVideoInputDevice::getNextEncodedPacket(RsVoipDataChunk& chunk)
bool QVideoInputDevice::getNextEncodedPacket(RsVOIPDataChunk& chunk)
{
return _video_encoder->nextPacket(chunk) ;
}

View file

@ -1,7 +1,7 @@
#pragma once
#include <QLabel>
#include "interface/rsvoip.h"
#include "interface/rsVOIP.h"
class VideoEncoder ;
class CvCapture ;
@ -12,7 +12,7 @@ class CvCapture ;
class QVideoOutputDevice: public QLabel
{
public:
QVideoOutputDevice(QWidget *parent) ;
QVideoOutputDevice(QWidget *parent = 0) ;
void showFrame(const QImage&) ;
void showFrameOff() ;
@ -26,7 +26,7 @@ class QVideoInputDevice: public QObject
Q_OBJECT
public:
QVideoInputDevice(QWidget *parent) ;
QVideoInputDevice(QWidget *parent = 0) ;
~QVideoInputDevice() ;
// Captured images are sent to this encoder. Can be NULL.
@ -40,7 +40,7 @@ class QVideoInputDevice: public QObject
// get the next encoded video data chunk.
//
bool getNextEncodedPacket(RsVoipDataChunk&) ;
bool getNextEncodedPacket(RsVOIPDataChunk&) ;
void start() ;
void stop() ;
@ -58,6 +58,6 @@ class QVideoInputDevice: public QObject
QVideoOutputDevice *_echo_output_device ;
std::list<RsVoipDataChunk> _out_queue ;
std::list<RsVOIPDataChunk> _out_queue ;
};

View file

@ -12,7 +12,7 @@
#include <QDateTime>
#include <limits.h>
#include "interface/rsvoip.h"
#include "interface/rsVOIP.h"
//#include "gui/settings/rsharesettings.h"
@ -165,7 +165,7 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
iArg = -60;
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_AGC_DECREMENT, &iArg);
iArg = rsVoip->getVoipiNoiseSuppress();
iArg = rsVOIP->getVoipiNoiseSuppress();
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &iArg);
if (echo_state) {
@ -177,18 +177,18 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
bResetProcessor = false;
}
float v = 30000.0f / static_cast<float>(rsVoip->getVoipiMinLoudness());
float v = 30000.0f / static_cast<float>(rsVOIP->getVoipiMinLoudness());
iArg = iroundf(floorf(20.0f * log10f(v)));
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_AGC_MAX_GAIN, &iArg);
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_GET_AGC_GAIN, &iArg);
float gainValue = static_cast<float>(iArg);
iArg = rsVoip->getVoipiNoiseSuppress() - iArg;
iArg = rsVOIP->getVoipiNoiseSuppress() - iArg;
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &iArg);
short * psSource = psMic;
if (echo_state && rsVoip->getVoipEchoCancel()) {
if (echo_state && rsVOIP->getVoipEchoCancel()) {
speex_echo_playback(echo_state, (short*)lastEchoFrame->data());
speex_echo_capture(echo_state,psMic,psClean);
psSource = psClean;
@ -212,29 +212,29 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
bool bIsSpeech = false;
if (dVoiceAcivityLevel > (static_cast<float>(rsVoip->getVoipfVADmax()) / 32767))
if (dVoiceAcivityLevel > (static_cast<float>(rsVOIP->getVoipfVADmax()) / 32767))
bIsSpeech = true;
else if (dVoiceAcivityLevel > (static_cast<float>(rsVoip->getVoipfVADmin()) / 32767) && bPreviousVoice)
else if (dVoiceAcivityLevel > (static_cast<float>(rsVOIP->getVoipfVADmin()) / 32767) && bPreviousVoice)
bIsSpeech = true;
if (! bIsSpeech) {
iHoldFrames++;
if (iHoldFrames < rsVoip->getVoipVoiceHold())
if (iHoldFrames < rsVOIP->getVoipVoiceHold())
bIsSpeech = true;
} else {
iHoldFrames = 0;
}
if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitContinous) {
if (rsVOIP->getVoipATransmit() == RsVOIP::AudioTransmitContinous) {
bIsSpeech = true;
}
else if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitPushToTalk)
else if (rsVOIP->getVoipATransmit() == RsVOIP::AudioTransmitPushToTalk)
bIsSpeech = false;//g.s.uiDoublePush && ((g.uiDoublePush < g.s.uiDoublePush) || (g.tDoublePush.elapsed() < g.s.uiDoublePush));
//bIsSpeech = bIsSpeech || (g.iPushToTalk > 0);
/*if (g.s.bMute || ((g.s.lmLoopMode != RsVoip::Local) && p && (p->bMute || p->bSuppress)) || g.bPushToMute || (g.iTarget < 0)) {
/*if (g.s.bMute || ((g.s.lmLoopMode != RsVOIP::Local) && p && (p->bMute || p->bSuppress)) || g.bPushToMute || (g.iTarget < 0)) {
bIsSpeech = false;
}*/
@ -246,11 +246,11 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
/*if (p) {
if (! bIsSpeech)
p->setTalking(RsVoip::Passive);
p->setTalking(RsVOIP::Passive);
else if (g.iTarget == 0)
p->setTalking(RsVoip::Talking);
p->setTalking(RsVOIP::Talking);
else
p->setTalking(RsVoip::Shouting);
p->setTalking(RsVOIP::Shouting);
}*/
@ -271,7 +271,7 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
int vbr_on=0;
//just use fixed bitrate for now
//encryption of VBR-encoded speech may not ensure complete privacy, as phrases can still be identified, at least in a controlled setting with a small dictionary of phrases, by analysing the pattern of variation of the bit rate.
if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitVAD) {//maybe we can do fixer bitrate when voice detection is active
if (rsVOIP->getVoipATransmit() == RsVOIP::AudioTransmitVAD) {//maybe we can do fixer bitrate when voice detection is active
vbr_on = 1;//test it on for all modes
} else {//maybe we can do vbr for ppt and continuous
vbr_on = 1;
@ -370,7 +370,7 @@ bool SpeexInputProcessor::isSequential() const {
}
void SpeexInputProcessor::addEchoFrame(QByteArray* echo_frame) {
if (rsVoip->getVoipEchoCancel() && echo_frame) {
if (rsVOIP->getVoipEchoCancel() && echo_frame) {
QMutexLocker l(&qmSpeex);
lastEchoFrame = echo_frame;
if (!echo_state) {//init echo_state

View file

@ -3,8 +3,7 @@
* Copyright (C) 2010 Peter Zotov
*/
#ifndef SPEEXPROCESSOR_H
#define SPEEXPROCESSOR_H
#pragma once
#include <iostream>
@ -117,5 +116,3 @@ namespace QtSpeex {
int speex_jitter_get_pointer_timestamp(SpeexJitter jitter);
};
}
#endif // SPEEXPROCESSOR_H

View file

@ -1,10 +1,30 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QToolButton>
#include <QPropertyAnimation>
#include <QIcon>
#include <QLayout>
#include <gui/audiodevicehelper.h>
#include "interface/rsvoip.h"
#include "interface/rsVOIP.h"
#include "gui/SoundManager.h"
#include "util/HandleRichText.h"
#include "gui/common/StatusDefs.h"
@ -135,11 +155,11 @@ VOIPChatWidgetHolder::~VOIPChatWidgetHolder()
delete inputVideoDevice ;
delete inputVideoProcessor ;
delete outputVideoProcessor ;
button_map::iterator it = buttonMapTakeVideo.begin();
while (it != buttonMapTakeVideo.end()) {
it = buttonMapTakeVideo.erase(it);
}
button_map::iterator it = buttonMapTakeVideo.begin();
while (it != buttonMapTakeVideo.end()) {
it = buttonMapTakeVideo.erase(it);
}
}
void VOIPChatWidgetHolder::toggleAudioListen()
@ -209,13 +229,13 @@ void VOIPChatWidgetHolder::toggleAudioCapture()
hangupButton->hide();
}
}
void VOIPChatWidgetHolder::startVideoCapture()
{
videoCaptureToggleButton->setChecked(true);
toggleVideoCapture();
}
void VOIPChatWidgetHolder::startVideoCapture()
{
videoCaptureToggleButton->setChecked(true);
toggleVideoCapture();
}
void VOIPChatWidgetHolder::toggleVideoCapture()
{
if (videoCaptureToggleButton->isChecked())
@ -228,15 +248,15 @@ void VOIPChatWidgetHolder::toggleVideoCapture()
videoCaptureToggleButton->setToolTip(tr("Shut camera off"));
if (mChatWidget)
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("You're now sending video..."), ChatWidget::MSGTYPE_SYSTEM);
button_map::iterator it = buttonMapTakeVideo.begin();
while (it != buttonMapTakeVideo.end()) {
RSButtonOnText *button = it.value();
delete button;
it = buttonMapTakeVideo.erase(it);
}
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("You're now sending video..."), ChatWidget::MSGTYPE_SYSTEM);
button_map::iterator it = buttonMapTakeVideo.begin();
while (it != buttonMapTakeVideo.end()) {
RSButtonOnText *button = it.value();
delete button;
it = buttonMapTakeVideo.erase(it);
}
}
else
{
@ -246,69 +266,69 @@ void VOIPChatWidgetHolder::toggleVideoCapture()
videoWidget->hide();
if (mChatWidget)
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("Video call stopped"), ChatWidget::MSGTYPE_SYSTEM);
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("Video call stopped"), ChatWidget::MSGTYPE_SYSTEM);
}
}
void VOIPChatWidgetHolder::addVideoData(const QString name, QByteArray* array)
{
outputVideoProcessor->receiveEncodedData((unsigned char *)array->data(),array->size()) ;
if (!videoCaptureToggleButton->isChecked()) {
if (mChatWidget) {
QString buttonName = name;
if (buttonName.isEmpty()) buttonName = "VoIP";//TODO maybe change all with GxsId
button_map::iterator it = buttonMapTakeVideo.find(buttonName);
if (it == buttonMapTakeVideo.end()){
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("Video call from: %1").arg(buttonName), ChatWidget::MSGTYPE_SYSTEM);
RSButtonOnText *button = mChatWidget->getNewButtonOnTextBrowser(tr("Take Video Call"));
button->setToolTip(tr("Activate camera"));
button->setStyleSheet(QString("background-color: green;")
.append("border-style: outset;")
.append("border-width: 5px;")
.append("border-radius: 5px;")
.append("border-color: beige;")
);
button->updateImage();
connect(button,SIGNAL(clicked()),this,SLOT(startVideoCapture()));
connect(button,SIGNAL(mouseEnter()),this,SLOT(botMouseEnter()));
connect(button,SIGNAL(mouseLeave()),this,SLOT(botMouseLeave()));
buttonMapTakeVideo.insert(buttonName, button);
}
}
}
}
void VOIPChatWidgetHolder::botMouseEnter()
{
RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender());
if (source){
source->setStyleSheet(QString("background-color: red;")
.append("border-style: outset;")
.append("border-width: 5px;")
.append("border-radius: 5px;")
.append("border-color: beige;")
);
//source->setDown(true);
}
}
void VOIPChatWidgetHolder::botMouseLeave()
{
RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender());
if (source){
source->setStyleSheet(QString("background-color: green;")
.append("border-style: outset;")
.append("border-width: 5px;")
.append("border-radius: 5px;")
.append("border-color: beige;")
);
//source->setDown(false);
}
if (!videoCaptureToggleButton->isChecked()) {
if (mChatWidget) {
QString buttonName = name;
if (buttonName.isEmpty()) buttonName = "VoIP";//TODO maybe change all with GxsId
button_map::iterator it = buttonMapTakeVideo.find(buttonName);
if (it == buttonMapTakeVideo.end()){
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("Video call from: %1").arg(buttonName), ChatWidget::MSGTYPE_SYSTEM);
RSButtonOnText *button = mChatWidget->getNewButtonOnTextBrowser(tr("Take Video Call"));
button->setToolTip(tr("Activate camera"));
button->setStyleSheet(QString("background-color: green;")
.append("border-style: outset;")
.append("border-width: 5px;")
.append("border-radius: 5px;")
.append("border-color: beige;")
);
button->updateImage();
connect(button,SIGNAL(clicked()),this,SLOT(startVideoCapture()));
connect(button,SIGNAL(mouseEnter()),this,SLOT(botMouseEnter()));
connect(button,SIGNAL(mouseLeave()),this,SLOT(botMouseLeave()));
buttonMapTakeVideo.insert(buttonName, button);
}
}
}
}
void VOIPChatWidgetHolder::botMouseEnter()
{
RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender());
if (source){
source->setStyleSheet(QString("background-color: red;")
.append("border-style: outset;")
.append("border-width: 5px;")
.append("border-radius: 5px;")
.append("border-color: beige;")
);
//source->setDown(true);
}
}
void VOIPChatWidgetHolder::botMouseLeave()
{
RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender());
if (source){
source->setStyleSheet(QString("background-color: green;")
.append("border-style: outset;")
.append("border-width: 5px;")
.append("border-radius: 5px;")
.append("border-color: beige;")
);
//source->setDown(false);
}
}
void VOIPChatWidgetHolder::setAcceptedBandwidth(const QString name, uint32_t bytes_per_sec)
@ -377,21 +397,21 @@ void VOIPChatWidgetHolder::addAudioData(const QString name, QByteArray* array)
void VOIPChatWidgetHolder::sendVideoData()
{
RsVoipDataChunk chunk ;
RsVOIPDataChunk chunk ;
while(inputVideoDevice && inputVideoDevice->getNextEncodedPacket(chunk))
rsVoip->sendVoipData(mChatWidget->getChatId().toPeerId(),chunk) ;
rsVOIP->sendVoipData(mChatWidget->getChatId().toPeerId(),chunk) ;
}
void VOIPChatWidgetHolder::sendAudioData()
{
while(inputAudioProcessor && inputAudioProcessor->hasPendingPackets()) {
QByteArray qbarray = inputAudioProcessor->getNetworkPacket();
RsVoipDataChunk chunk;
RsVOIPDataChunk chunk;
chunk.size = qbarray.size();
chunk.data = (void*)qbarray.constData();
chunk.type = RsVoipDataChunk::RS_VOIP_DATA_TYPE_AUDIO ;
rsVoip->sendVoipData(mChatWidget->getChatId().toPeerId(),chunk);
chunk.type = RsVOIPDataChunk::RS_VOIP_DATA_TYPE_AUDIO ;
rsVOIP->sendVoipData(mChatWidget->getChatId().toPeerId(),chunk);
}
}

View file

@ -1,8 +1,31 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#pragma once
#include <QObject>
#include <QGraphicsEffect>
#include <gui/SpeexProcessor.h>
#include <gui/chat/ChatWidget.h>
#include <gui/common/RsButtonOnText.h>
#include <gui/common/RsButtonOnText.h>
class QToolButton;
class QAudioInput;
@ -32,10 +55,10 @@ private slots:
void toggleAudioListen();
void toggleAudioCapture();
void toggleVideoCapture();
void startVideoCapture();
void startVideoCapture();
void hangupCall() ;
void botMouseEnter();
void botMouseLeave();
void botMouseEnter();
void botMouseLeave();
public slots:
void sendAudioData();
@ -64,8 +87,8 @@ protected:
QToolButton *audioCaptureToggleButton ;
QToolButton *videoCaptureToggleButton ;
QToolButton *hangupButton ;
typedef QMap<QString, RSButtonOnText*> button_map;
button_map buttonMapTakeVideo;
typedef QMap<QString, RSButtonOnText*> button_map;
button_map buttonMapTakeVideo;
};

View file

@ -0,0 +1,122 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <iostream>
#include <vector>
#include <list>
#include <interface/rsVOIP.h>
#include "VOIPGUIHandler.h"
#include <gui/chat/ChatDialog.h>
#include <gui/VOIPChatWidgetHolder.h>
#include "gui/chat/ChatWidget.h"
#include "gui/settings/rsharesettings.h"
void VOIPGUIHandler::ReceivedInvitation(const QString& /*peer_id*/)
{
std::cerr << "****** VOIPGUIHandler: received Invitation!" << std::endl;
}
void VOIPGUIHandler::ReceivedVoipHangUp(const QString& /*peer_id*/)
{
std::cerr << "****** VOIPGUIHandler: received HangUp!" << std::endl;
}
void VOIPGUIHandler::ReceivedVoipAccept(const QString& /*peer_id*/)
{
std::cerr << "****** VOIPGUIHandler: received VoipAccept!" << std::endl;
}
void VOIPGUIHandler::ReceivedVoipData(const QString& qpeer_id)
{
RsPeerId peer_id(qpeer_id.toStdString()) ;
std::vector<RsVOIPDataChunk> chunks ;
if(!rsVOIP->getIncomingData(peer_id,chunks))
{
std::cerr << "VOIPGUIHandler::ReceivedVoipData(): No data chunks to get. Weird!" << std::endl;
return ;
}
ChatDialog *di = ChatDialog::getChat(ChatId(peer_id), Settings->getChatFlags());
if (di) {
ChatWidget *cw = di->getChatWidget();
if (cw) {
const QList<ChatWidgetHolder*> &chatWidgetHolderList = cw->chatWidgetHolderList();
foreach (ChatWidgetHolder *chatWidgetHolder, chatWidgetHolderList)
{
VOIPChatWidgetHolder *acwh = dynamic_cast<VOIPChatWidgetHolder*>(chatWidgetHolder) ;
if (acwh) {
for (unsigned int i = 0; i < chunks.size(); ++i) {
for (unsigned int chunkIndex=0; chunkIndex<chunks.size(); chunkIndex++)
{
QByteArray qb(reinterpret_cast<const char *>(chunks[chunkIndex].data),chunks[chunkIndex].size);
if(chunks[chunkIndex].type == RsVOIPDataChunk::RS_VOIP_DATA_TYPE_AUDIO)
acwh->addAudioData(QString::fromStdString(peer_id.toStdString()),&qb);
else if(chunks[chunkIndex].type == RsVOIPDataChunk::RS_VOIP_DATA_TYPE_VIDEO)
acwh->addVideoData(QString::fromStdString(peer_id.toStdString()),&qb);
else
std::cerr << "VOIPGUIHandler: Unknown data type received. type=" << chunks[chunkIndex].type << std::endl;
}
}
break;
}
}
}
} else {
std::cerr << "VOIPGUIHandler Error: received audio data for a chat dialog that does not stand Audio (Peer id = " << peer_id.toStdString() << "!" << std::endl;
}
for(unsigned int chunkIndex=0; chunkIndex<chunks.size(); chunkIndex++){
free(chunks[chunkIndex].data);
}
}
void VOIPGUIHandler::ReceivedVoipBandwidthInfo(const QString& qpeer_id,int bytes_per_sec)
{
RsPeerId peer_id(qpeer_id.toStdString()) ;
ChatDialog *di = ChatDialog::getExistingChat(ChatId(peer_id)) ;
std::cerr << "VOIPGUIHandler::received bw info for peer " << qpeer_id.toStdString() << ": " << bytes_per_sec << " Bps" << std::endl;
if(!di)
{
std::cerr << "VOIPGUIHandler Error: received bandwidth info for a chat dialog that does not stand VOIP (Peer id = " << peer_id.toStdString() << "!" << std::endl;
return ;
}
ChatWidget *cw = di->getChatWidget();
if(!cw)
{
return ;
}
const QList<ChatWidgetHolder*> &chatWidgetHolderList = cw->chatWidgetHolderList();
foreach (ChatWidgetHolder *chatWidgetHolder, chatWidgetHolderList)
{
VOIPChatWidgetHolder *acwh = dynamic_cast<VOIPChatWidgetHolder*>(chatWidgetHolder) ;
if (acwh)
acwh->setAcceptedBandwidth(QString::fromStdString(peer_id.toStdString()),bytes_per_sec);
}
}

View file

@ -0,0 +1,44 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
// This class receives async-ed signals from the plugin notifier,
// and executes GUI requests.
//
// It is never called directly: it is called by Qt signal-received callback,
// in the main GUI thread.
//
#pragma once
#include <stdint.h>
#include <QObject>
class VOIPGUIHandler: public QObject
{
Q_OBJECT
public slots:
void ReceivedInvitation(const QString& peer_id) ;
void ReceivedVoipData(const QString& peer_id) ;
void ReceivedVoipHangUp(const QString& peer_id) ;
void ReceivedVoipAccept(const QString& peer_id) ;
void ReceivedVoipBandwidthInfo(const QString& peer_id,int) ;
};

View file

@ -0,0 +1,43 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "VOIPNotify.h"
void VOIPNotify::notifyReceivedVoipInvite(const RsPeerId& peer_id)
{
emit voipInvitationReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void VOIPNotify::notifyReceivedVoipData(const RsPeerId &peer_id)
{
emit voipDataReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void VOIPNotify::notifyReceivedVoipAccept(const RsPeerId& peer_id)
{
emit voipAcceptReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void VOIPNotify::notifyReceivedVoipHangUp(const RsPeerId &peer_id)
{
emit voipHangUpReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void VOIPNotify::notifyReceivedVoipBandwidth(const RsPeerId &peer_id,uint32_t bytes_per_sec)
{
emit voipBandwidthInfoReceived(QString::fromStdString(peer_id.toStdString()),bytes_per_sec) ;
}

View file

@ -1,3 +1,24 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
// This class is a Qt object to get notification from the plugin's service threads,
// and responsible to pass the info the the GUI part.
//
@ -5,10 +26,12 @@
// QObject connect system to communicate between the p3Service and the gui part (handled by Qt)
//
#pragma once
#include <QObject>
#include <retroshare/rstypes.h>
class PluginNotifier: public QObject
class VOIPNotify: public QObject
{
Q_OBJECT

View file

@ -19,7 +19,7 @@ bool VideoEncoder::addImage(const QImage& img)
return true ;
}
bool VideoEncoder::nextPacket(RsVoipDataChunk& chunk)
bool VideoEncoder::nextPacket(RsVOIPDataChunk& chunk)
{
if(_out_queue.empty())
return false ;
@ -62,11 +62,11 @@ void JPEGVideoEncoder::encodeData(const QImage& image)
buffer.open(QIODevice::WriteOnly) ;
image.save(&buffer,"JPEG") ;
RsVoipDataChunk voip_chunk ;
RsVOIPDataChunk voip_chunk ;
voip_chunk.data = malloc(qb.size());
memcpy(voip_chunk.data,qb.data(),qb.size()) ;
voip_chunk.size = qb.size() ;
voip_chunk.type = RsVoipDataChunk::RS_VOIP_DATA_TYPE_VIDEO ;
voip_chunk.type = RsVOIPDataChunk::RS_VOIP_DATA_TYPE_VIDEO ;
_out_queue.push_back(voip_chunk) ;
}

View file

@ -2,7 +2,7 @@
#include <stdint.h>
#include <QImage>
#include "interface/rsvoip.h"
#include "interface/rsVOIP.h"
class QVideoOutputDevice ;
@ -43,7 +43,7 @@ class VideoDecoder
};
// This class encodes video using a video codec (possibly homemade, or based on existing codecs)
// and produces a data stream that is sent to the network transfer service (e.g. p3VoRs).
// and produces a data stream that is sent to the network transfer service (e.g. p3VOIP).
//
class VideoEncoder
{
@ -55,7 +55,7 @@ class VideoEncoder
bool addImage(const QImage& Image) ;
bool packetReady() const { return !_out_queue.empty() ; }
bool nextPacket(RsVoipDataChunk& ) ;
bool nextPacket(RsVOIPDataChunk& ) ;
// Used to tweak the compression ratio so that the video can stream ok.
//
@ -65,7 +65,7 @@ class VideoEncoder
//virtual bool sendEncodedData(unsigned char *mem,uint32_t size) = 0 ;
virtual void encodeData(const QImage& image) = 0 ;
std::list<RsVoipDataChunk> _out_queue ;
std::list<RsVOIPDataChunk> _out_queue ;
};
// Now derive various image encoding/decoding algorithms.

View file

@ -1,5 +1,5 @@
#ifndef AUDIODEVICEHELPER_H
#define AUDIODEVICEHELPER_H
#pragma once
#include <QAudioInput>
#include <QAudioOutput>
@ -15,5 +15,3 @@ public:
static QAudioOutput* getPreferedOutputDevice();
//static list getOutputDeviceList();
};
#endif // AUDIODEVICEHELPER_H