mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-25 23:06:10 -05:00
Merge pull request #2421 from csoler/v0.6-plugins-VOIP
Switched video capture to QCamera and removed opencv dependency
This commit is contained in:
commit
0dd1d7703e
@ -53,7 +53,6 @@ linux-* {
|
||||
|
||||
PKGCONFIG += libavcodec libavutil
|
||||
PKGCONFIG += speex speexdsp
|
||||
PKGCONFIG += opencv4
|
||||
} else {
|
||||
LIBS += -lspeex -lspeexdsp -lavcodec -lavutil
|
||||
}
|
||||
@ -66,37 +65,10 @@ win32 {
|
||||
INCLUDEPATH += . $$INC_DIR
|
||||
|
||||
USE_PRECOMPILED_LIBS =
|
||||
for(lib, RS_LIB_DIR) {
|
||||
#message(Scanning $$lib)
|
||||
isEmpty(USE_PRECOMPILED_LIBS) {
|
||||
exists($$lib/opencv/libopencv_core.a) {
|
||||
message(Get pre-compiled opencv libraries here:)
|
||||
message($$lib/opencv)
|
||||
LIBS += -L"$$lib/opencv"
|
||||
USE_PRECOMPILED_LIBS = 1
|
||||
}
|
||||
exists($$lib/libopencv_core.dll.a) {
|
||||
message(Get pre-compiled opencv libraries here:)
|
||||
message($$lib)
|
||||
LIBS += -L"$$lib"
|
||||
USE_PRECOMPILED_LIBS = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
isEmpty(USE_PRECOMPILED_LIBS) {
|
||||
message(Use system opencv libraries.)
|
||||
}
|
||||
|
||||
LIBS += -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_videoio -lopencv_imgcodecs -llibwebp -llibtiff -llibpng -llibopenjp2 -lIlmImf
|
||||
# Should we keep these after removing opencv??
|
||||
LIBS += -lole32 -loleaut32 -luuid -lvfw32
|
||||
|
||||
# Check for msys2
|
||||
!isEmpty(PREFIX_MSYS2) {
|
||||
message(Use msys2 opencv4.)
|
||||
INCLUDEPATH += "$${PREFIX_MSYS2}/include/opencv4"
|
||||
} else {
|
||||
LIBS += -llibjpeg-turbo -lzlib
|
||||
}
|
||||
LIBS += -llibjpeg-turbo -lzlib
|
||||
}
|
||||
|
||||
#################################### MacOSX #####################################
|
||||
@ -105,30 +77,6 @@ macx {
|
||||
|
||||
DEPENDPATH += . $$INC_DIR
|
||||
INCLUDEPATH += . $$INC_DIR
|
||||
|
||||
#OPENCV_VERSION = "249"
|
||||
USE_PRECOMPILED_LIBS =
|
||||
for(lib, LIB_DIR) {
|
||||
#message(Scanning $$lib)
|
||||
exists( $$lib/opencv/libopencv_core*.dylib) {
|
||||
isEmpty(USE_PRECOMPILED_LIBS) {
|
||||
message(Get pre-compiled opencv libraries here:)
|
||||
message($$lib)
|
||||
LIBS += -L"$$lib/opencv"
|
||||
LIBS += -lopencv_core -lopencv_highgui -lopencv_imgproc
|
||||
USE_PRECOMPILED_LIBS = 1
|
||||
}
|
||||
}
|
||||
exists( $$lib/libopencv_videoio*.dylib) {
|
||||
message(videoio found in opencv libraries.)
|
||||
message($$lib)
|
||||
LIBS += -lopencv_videoio
|
||||
}
|
||||
}
|
||||
isEmpty(USE_PRECOMPILED_LIBS) {
|
||||
message(Use system opencv libraries.)
|
||||
LIBS += -lopencv_core -lopencv_highgui -lopencv_imgproc
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -138,9 +86,9 @@ QMAKE_CXXFLAGS += -D__STDC_CONSTANT_MACROS
|
||||
QMAKE_CXXFLAGS *= -Wall
|
||||
|
||||
SOURCES = VOIPPlugin.cpp \
|
||||
gui/VOIPConfigPanel.cpp \
|
||||
services/p3VOIP.cc \
|
||||
services/rsVOIPItems.cc \
|
||||
gui/AudioInputConfig.cpp \
|
||||
gui/AudioStats.cpp \
|
||||
gui/AudioWizard.cpp \
|
||||
gui/SpeexProcessor.cpp \
|
||||
@ -154,9 +102,9 @@ SOURCES = VOIPPlugin.cpp \
|
||||
gui/VOIPToasterNotify.cpp
|
||||
|
||||
HEADERS = VOIPPlugin.h \
|
||||
gui/VOIPConfigPanel.h \
|
||||
services/p3VOIP.h \
|
||||
services/rsVOIPItems.h \
|
||||
gui/AudioInputConfig.h \
|
||||
gui/AudioStats.h \
|
||||
gui/AudioWizard.h \
|
||||
gui/SpeexProcessor.h \
|
||||
@ -170,9 +118,10 @@ HEADERS = VOIPPlugin.h \
|
||||
gui/VOIPToasterNotify.h \
|
||||
interface/rsVOIP.h
|
||||
|
||||
FORMS = gui/AudioInputConfig.ui \
|
||||
FORMS = \
|
||||
gui/AudioStats.ui \
|
||||
gui/AudioWizard.ui \
|
||||
gui/VOIPConfigPanel.ui \
|
||||
gui/VOIPToasterItem.ui
|
||||
|
||||
TARGET = VOIP
|
||||
|
@ -31,14 +31,13 @@
|
||||
#include "VOIPPlugin.h"
|
||||
#include "interface/rsVOIP.h"
|
||||
|
||||
#include "gui/AudioInputConfig.h"
|
||||
#include "gui/VOIPConfigPanel.h"
|
||||
#include "gui/VOIPChatWidgetHolder.h"
|
||||
#include "gui/VOIPGUIHandler.h"
|
||||
#include "gui/VOIPNotify.h"
|
||||
#include "gui/SoundManager.h"
|
||||
#include "gui/chat/ChatWidget.h"
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <speex/speex.h>
|
||||
|
||||
#define IMAGE_VOIP ":/images/talking_on.svg"
|
||||
@ -113,7 +112,7 @@ ConfigPage *VOIPPlugin::qt_config_page() const
|
||||
// The config pages are deleted when config is closed, so it's important not to static the
|
||||
// created object.
|
||||
//
|
||||
return new AudioInputConfig() ;
|
||||
return new VOIPConfigPanel() ;
|
||||
}
|
||||
|
||||
QDialog *VOIPPlugin::qt_about_page() const
|
||||
@ -188,8 +187,6 @@ std::string VOIPPlugin::getPluginName() const
|
||||
|
||||
void VOIPPlugin::getLibraries(std::list<RsLibraryInfo> &libraries)
|
||||
{
|
||||
libraries.push_back(RsLibraryInfo("OpenCV", CV_VERSION));
|
||||
|
||||
const char *speexVersion = NULL;
|
||||
if (speex_lib_ctl(SPEEX_LIB_GET_VERSION_STRING, &speexVersion) == 0 && speexVersion) {
|
||||
libraries.push_back(RsLibraryInfo("Speex", speexVersion));
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <QPainter>
|
||||
|
||||
#include "AudioStats.h"
|
||||
#include "AudioInputConfig.h"
|
||||
#include "VOIPConfigPanel.h"
|
||||
//#include "Global.h"
|
||||
//#include "smallft.h"
|
||||
|
||||
|
@ -202,7 +202,16 @@
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QWidget" name="qwVAD" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -18,15 +18,18 @@
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
#include <opencv2/imgproc/types_c.h>
|
||||
|
||||
#include <QTimer>
|
||||
#include <QPainter>
|
||||
#include <QImageReader>
|
||||
#include <QBuffer>
|
||||
#include <QCamera>
|
||||
#include <QCameraInfo>
|
||||
#include <QCameraImageCapture>
|
||||
#include "QVideoDevice.h"
|
||||
#include "VideoProcessor.h"
|
||||
|
||||
// #define DEBUG_QVIDEODEVICE 1
|
||||
|
||||
QVideoInputDevice::QVideoInputDevice(QWidget *parent)
|
||||
:QObject(parent)
|
||||
{
|
||||
@ -36,16 +39,28 @@ QVideoInputDevice::QVideoInputDevice(QWidget *parent)
|
||||
_echo_output_device = NULL ;
|
||||
}
|
||||
|
||||
bool QVideoInputDevice::stopped()
|
||||
QVideoInputDevice::~QVideoInputDevice()
|
||||
{
|
||||
stop() ;
|
||||
_video_processor = NULL ;
|
||||
|
||||
delete _image_capture;
|
||||
delete _capture_device;
|
||||
delete _timer;
|
||||
}
|
||||
|
||||
bool QVideoInputDevice::stopped() const
|
||||
{
|
||||
return _timer == NULL ;
|
||||
}
|
||||
|
||||
void QVideoInputDevice::stop()
|
||||
{
|
||||
_capture_device_info = QCameraInfo();
|
||||
|
||||
if(_timer != NULL)
|
||||
{
|
||||
QObject::disconnect(_timer,SIGNAL(timeout()),this,SLOT(grabFrame())) ;
|
||||
_capture_device->stop();
|
||||
_timer->stop() ;
|
||||
delete _timer ;
|
||||
_timer = NULL ;
|
||||
@ -53,57 +68,118 @@ void QVideoInputDevice::stop()
|
||||
if(_capture_device != NULL)
|
||||
{
|
||||
// the camera will be deinitialized automatically in VideoCapture destructor
|
||||
_capture_device->release();
|
||||
delete _capture_device ;
|
||||
delete _image_capture ;
|
||||
delete _capture_device ;
|
||||
|
||||
_capture_device = NULL ;
|
||||
}
|
||||
_image_capture = NULL ;
|
||||
}
|
||||
if(_echo_output_device != NULL)
|
||||
_echo_output_device->showFrameOff() ;
|
||||
}
|
||||
void QVideoInputDevice::start()
|
||||
void QVideoInputDevice::getAvailableDevices(QList<QString>& device_desc)
|
||||
{
|
||||
device_desc.clear();
|
||||
|
||||
QList<QCameraInfo> dev_list = QCameraInfo::availableCameras();
|
||||
|
||||
for(auto& cam:dev_list)
|
||||
device_desc.push_back(cam.deviceName());
|
||||
}
|
||||
|
||||
void QVideoInputDevice::start(const QString& description)
|
||||
{
|
||||
// make sure everything is re-initialised
|
||||
//
|
||||
stop() ;
|
||||
|
||||
// Initialise la capture
|
||||
static const int cam_id = 0 ;
|
||||
_capture_device = new cv::VideoCapture(cam_id);
|
||||
QCameraInfo caminfo ;
|
||||
|
||||
if(!_capture_device->isOpened())
|
||||
{
|
||||
std::cerr << "Cannot initialise camera. Something's wrong." << std::endl;
|
||||
return ;
|
||||
}
|
||||
if(description.isNull())
|
||||
caminfo = QCameraInfo::defaultCamera();
|
||||
else
|
||||
{
|
||||
auto cam_list = QCameraInfo::availableCameras();
|
||||
|
||||
_timer = new QTimer ;
|
||||
QObject::connect(_timer,SIGNAL(timeout()),this,SLOT(grabFrame())) ;
|
||||
for(auto& s:cam_list)
|
||||
if(s.deviceName() == description)
|
||||
caminfo = s;
|
||||
}
|
||||
|
||||
_timer->start(50) ; // 10 images per second.
|
||||
if(caminfo.isNull())
|
||||
{
|
||||
std::cerr << "No video camera available in this system!" << std::endl;
|
||||
return ;
|
||||
}
|
||||
_capture_device_info = caminfo;
|
||||
_capture_device = new QCamera(caminfo);
|
||||
|
||||
if(_capture_device->error() != QCamera::NoError)
|
||||
{
|
||||
emit cameraCaptureInfo(CANNOT_INITIALIZE_CAMERA,_capture_device->error());
|
||||
std::cerr << "Cannot initialise camera. Something's wrong." << std::endl;
|
||||
return;
|
||||
}
|
||||
_capture_device->setCaptureMode(QCamera::CaptureStillImage);
|
||||
|
||||
if(_capture_device->error() == QCamera::NoError)
|
||||
emit cameraCaptureInfo(CAMERA_IS_READY,QCamera::NoError);
|
||||
|
||||
_image_capture = new QCameraImageCapture(_capture_device);
|
||||
|
||||
if(!_image_capture->isCaptureDestinationSupported(QCameraImageCapture::CaptureToBuffer))
|
||||
{
|
||||
emit cameraCaptureInfo(CAMERA_IS_READY,QCamera::NoError);
|
||||
|
||||
delete _capture_device;
|
||||
delete _image_capture;
|
||||
return;
|
||||
}
|
||||
|
||||
_image_capture->setCaptureDestination(QCameraImageCapture::CaptureToBuffer);
|
||||
|
||||
QObject::connect(_image_capture,SIGNAL(imageAvailable(int,QVideoFrame)),this,SLOT(grabFrame(int,QVideoFrame)));
|
||||
QObject::connect(this,SIGNAL(cameraCaptureInfo(CameraStatus,QCamera::Error)),this,SLOT(errorHandling(CameraStatus,QCamera::Error)));
|
||||
|
||||
_timer = new QTimer ;
|
||||
QObject::connect(_timer,SIGNAL(timeout()),_image_capture,SLOT(capture())) ;
|
||||
|
||||
_timer->start(50) ; // 10 images per second.
|
||||
|
||||
_capture_device->start();
|
||||
}
|
||||
|
||||
void QVideoInputDevice::grabFrame()
|
||||
void QVideoInputDevice::errorHandling(CameraStatus status,QCamera::Error error)
|
||||
{
|
||||
if(!_timer)
|
||||
return ;
|
||||
|
||||
cv::Mat frame;
|
||||
if(!_capture_device->read(frame))
|
||||
#ifdef DEBUG_QVIDEODEVICE
|
||||
std::cerr << "Received msg from camera capture: status=" << (int)status << " error=" << (int)error << std::endl;
|
||||
#endif
|
||||
if(status == CANNOT_INITIALIZE_CAMERA)
|
||||
{
|
||||
std::cerr << "(EE) Cannot capture image from camera. Something's wrong." << std::endl;
|
||||
return ;
|
||||
std::cerr << "Cannot initialize camera. Make sure to install package libqt5multimedia5-plugins, as this is a common cause for camera not being found." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void QVideoInputDevice::grabFrame(int id,QVideoFrame frame)
|
||||
{
|
||||
if(frame.size().isEmpty())
|
||||
{
|
||||
std::cerr << "Empty frame!" ;
|
||||
return;
|
||||
}
|
||||
|
||||
// get the image data
|
||||
frame.map(QAbstractVideoBuffer::ReadOnly);
|
||||
QByteArray data((const char *)frame.bits(), frame.mappedBytes());
|
||||
QBuffer buffer;
|
||||
buffer.setData(data);
|
||||
buffer.open(QIODevice::ReadOnly);
|
||||
QImageReader reader(&buffer, "JPG");
|
||||
reader.setScaledSize(QSize(640,480));
|
||||
QImage image(reader.read());
|
||||
|
||||
if(frame.channels() != 3)
|
||||
{
|
||||
std::cerr << "(EE) expected 3 channels. Got " << frame.channels() << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
// convert to RGB and copy to new buffer, because cvQueryFrame tells us to not modify the buffer
|
||||
cv::Mat img_rgb;
|
||||
cv::cvtColor(frame, img_rgb, CV_BGR2RGB);
|
||||
QImage image = QImage(img_rgb.data,img_rgb.cols,img_rgb.rows,QImage::Format_RGB888);
|
||||
#ifdef DEBUG_QVIDEODEVICE
|
||||
std::cerr << "Frame " << id << ". Pixel format: " << frame.pixelFormat() << ". Size: " << image.size().width() << " x " << image.size().height() << std::endl; // if(frame.pixelFormat() != QVideoFrame::Format_Jpeg)
|
||||
#endif
|
||||
|
||||
if(_video_processor != NULL)
|
||||
{
|
||||
@ -128,16 +204,12 @@ bool QVideoInputDevice::getNextEncodedPacket(RsVOIPDataChunk& chunk)
|
||||
|
||||
uint32_t QVideoInputDevice::currentBandwidth() const
|
||||
{
|
||||
return _video_processor->currentBandwidthOut() ;
|
||||
if(stopped())
|
||||
return 0;
|
||||
else
|
||||
return _video_processor->currentBandwidthOut() ;
|
||||
}
|
||||
|
||||
QVideoInputDevice::~QVideoInputDevice()
|
||||
{
|
||||
stop() ;
|
||||
_video_processor = NULL ;
|
||||
}
|
||||
|
||||
|
||||
QVideoOutputDevice::QVideoOutputDevice(QWidget *parent)
|
||||
: QLabel(parent)
|
||||
{
|
||||
@ -152,7 +224,9 @@ void QVideoOutputDevice::showFrameOff()
|
||||
|
||||
void QVideoOutputDevice::showFrame(const QImage& img)
|
||||
{
|
||||
#ifdef DEBUG_QVIDEODEVICE
|
||||
std::cerr << "img.size = " << img.width() << " x " << img.height() << std::endl;
|
||||
#endif
|
||||
setPixmap(QPixmap::fromImage(img).scaled( QSize(height()*4/3,height()),Qt::IgnoreAspectRatio,Qt::SmoothTransformation)) ;
|
||||
}
|
||||
|
||||
|
@ -21,13 +21,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <QLabel>
|
||||
#include <QCamera>
|
||||
#include <QCameraInfo>
|
||||
#include "interface/rsVOIP.h"
|
||||
|
||||
#include "opencv2/opencv.hpp"
|
||||
|
||||
#include "gui/VideoProcessor.h"
|
||||
|
||||
class VideoEncoder ;
|
||||
class QCameraImageCapture;
|
||||
|
||||
// Responsible from displaying the video. The source of the video is
|
||||
// a VideoDecoder object, which uses a codec.
|
||||
@ -49,7 +50,7 @@ class QVideoInputDevice: public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QVideoInputDevice(QWidget *parent = 0) ;
|
||||
QVideoInputDevice(QWidget *parent = 0) ;
|
||||
~QVideoInputDevice() ;
|
||||
|
||||
// Captured images are sent to this encoder. Can be NULL.
|
||||
@ -71,19 +72,35 @@ class QVideoInputDevice: public QObject
|
||||
|
||||
// control
|
||||
|
||||
void start() ;
|
||||
void start(const QString &description = QString()) ;
|
||||
void stop() ;
|
||||
bool stopped();
|
||||
bool stopped() const;
|
||||
|
||||
enum CameraStatus {
|
||||
CAMERA_IS_READY = 0x00,
|
||||
CANNOT_INITIALIZE_CAMERA = 0x01,
|
||||
CAMERA_CANNOT_GRAB_FRAMES = 0x02
|
||||
};
|
||||
|
||||
// Gets the list of available devices. The id string for each device can be used when creating a QVideoDevice
|
||||
|
||||
static void getAvailableDevices(QList<QString>& device_desc);
|
||||
|
||||
QString currentCameraDescriptionString() const { return _capture_device_info.deviceName(); }
|
||||
protected slots:
|
||||
void grabFrame() ;
|
||||
void grabFrame(int id, QVideoFrame f) ;
|
||||
void errorHandling(CameraStatus status,QCamera::Error error);
|
||||
|
||||
signals:
|
||||
void networkPacketReady() ;
|
||||
void cameraCaptureInfo(CameraStatus status,QCamera::Error qt_cam_err_code);
|
||||
|
||||
private:
|
||||
VideoProcessor *_video_processor ;
|
||||
QTimer *_timer ;
|
||||
cv::VideoCapture *_capture_device ;
|
||||
QCamera *_capture_device;
|
||||
QCameraImageCapture *_image_capture;
|
||||
QCameraInfo _capture_device_info;
|
||||
|
||||
QVideoOutputDevice *_echo_output_device ;
|
||||
|
||||
|
@ -19,14 +19,14 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include "AudioStats.h"
|
||||
#include "AudioInputConfig.h"
|
||||
#include "VOIPConfigPanel.h"
|
||||
#include "audiodevicehelper.h"
|
||||
#include "AudioWizard.h"
|
||||
#include "gui/VideoProcessor.h"
|
||||
#include "gui/common/RSGraphWidget.h"
|
||||
#include "gui/VideoProcessor.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/RsProtectedTimer.h"
|
||||
|
||||
#include <interface/rsVOIP.h>
|
||||
@ -80,7 +80,7 @@ voipGraph::voipGraph(QWidget *parent)
|
||||
}
|
||||
|
||||
/** Constructor */
|
||||
AudioInputConfig::AudioInputConfig(QWidget * parent, Qt::WindowFlags flags)
|
||||
VOIPConfigPanel::VOIPConfigPanel(QWidget * parent, Qt::WindowFlags flags)
|
||||
: ConfigPage(parent, flags)
|
||||
{
|
||||
std::cerr << "Creating audioInputConfig object" << std::endl;
|
||||
@ -92,19 +92,57 @@ AudioInputConfig::AudioInputConfig(QWidget * parent, Qt::WindowFlags flags)
|
||||
|
||||
inputAudioProcessor = NULL;
|
||||
inputAudioDevice = NULL;
|
||||
abSpeech = NULL;
|
||||
qtTick = NULL;
|
||||
|
||||
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.abSpeech->qcBelow = Qt::red;
|
||||
ui.abSpeech->qcInside = Qt::yellow;
|
||||
ui.abSpeech->qcAbove = Qt::green;
|
||||
|
||||
QList<QString> input_devices;
|
||||
QVideoInputDevice::getAvailableDevices(input_devices);
|
||||
ui.inputDevice_CB->clear();
|
||||
ui.inputDevice_CB->addItem(tr("[No video]"),QString(""));
|
||||
for(auto& s:input_devices)
|
||||
ui.inputDevice_CB->addItem(s,QVariant(s));
|
||||
|
||||
if(!input_devices.empty())
|
||||
whileBlocking(ui.inputDevice_CB)->setCurrentIndex(1); // select default cam
|
||||
|
||||
connect( ui.qsTransmitHold, SIGNAL( valueChanged ( int ) ), this, SLOT( on_qsTransmitHold_valueChanged(int) ) );
|
||||
connect( ui.qsNoise, SIGNAL( valueChanged ( int ) ), this, SLOT( on_qsNoise_valueChanged(int) ) );
|
||||
connect( ui.qsAmp, SIGNAL( valueChanged ( int ) ), this, SLOT( on_qsAmp_valueChanged(int) ) );
|
||||
connect( ui.qcbTransmit, SIGNAL( currentIndexChanged ( int ) ), this, SLOT( on_qcbTransmit_currentIndexChanged(int) ) );
|
||||
connect( ui.inputDevice_CB, SIGNAL( currentIndexChanged ( int ) ), this, SLOT( on_changedCurrentInputDevice(int) ) );
|
||||
}
|
||||
|
||||
void VOIPConfigPanel::showEvent(QShowEvent *)
|
||||
{
|
||||
std::cerr << "Creating the audio pipeline" << std::endl;
|
||||
|
||||
inputAudioProcessor = new QtSpeex::SpeexInputProcessor();
|
||||
inputAudioProcessor->open(QIODevice::WriteOnly | QIODevice::Unbuffered);
|
||||
|
||||
inputAudioDevice = AudioDeviceHelper::getPreferedInputDevice();
|
||||
inputAudioDevice->start(inputAudioProcessor);
|
||||
|
||||
connect(inputAudioProcessor, SIGNAL(networkPacketReady()), this, SLOT(emptyBuffer()));
|
||||
|
||||
std::cerr << "Creating the video pipeline" << std::endl;
|
||||
|
||||
// Create the video pipeline.
|
||||
//
|
||||
|
||||
videoInput = new QVideoInputDevice(this) ;
|
||||
videoInput->setEchoVideoTarget(ui.videoDisplay) ;
|
||||
|
||||
videoProcessor = new VideoProcessor() ;
|
||||
videoProcessor->setDisplayTarget(NULL) ;
|
||||
|
||||
videoProcessor->setMaximumBandwidth(ui.availableBW_SB->value()) ;
|
||||
|
||||
|
||||
videoInput->setVideoProcessor(videoProcessor) ;
|
||||
|
||||
graph_source = new voipGraphSource ;
|
||||
@ -114,17 +152,43 @@ AudioInputConfig::AudioInputConfig(QWidget * parent, Qt::WindowFlags flags)
|
||||
graph_source->setCollectionTimeLimit(1000*300) ;
|
||||
graph_source->start() ;
|
||||
|
||||
if(ui.showEncoded_CB->isChecked())
|
||||
{
|
||||
videoInput->setEchoVideoTarget(nullptr) ;
|
||||
videoProcessor->setDisplayTarget(ui.videoDisplay) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
videoInput->setEchoVideoTarget(ui.videoDisplay) ;
|
||||
videoProcessor->setDisplayTarget(nullptr);
|
||||
}
|
||||
|
||||
QObject::connect(ui.showEncoded_CB,SIGNAL(toggled(bool)),this,SLOT(togglePreview(bool))) ;
|
||||
QObject::connect(ui.availableBW_SB,SIGNAL(valueChanged(double)),this,SLOT(updateAvailableBW(double))) ;
|
||||
|
||||
loadSettings();
|
||||
|
||||
qtTick = new RsProtectedTimer(this);
|
||||
connect( qtTick, SIGNAL( timeout ( ) ), this, SLOT( on_Tick_timeout() ) );
|
||||
qtTick->start(20);
|
||||
|
||||
videoInput->start();
|
||||
}
|
||||
|
||||
void AudioInputConfig::updateAvailableBW(double r)
|
||||
void VOIPConfigPanel::hideEvent(QHideEvent *)
|
||||
{
|
||||
std::cerr << "Deleting the video pipeline" << std::endl;
|
||||
|
||||
clearPipeline();
|
||||
}
|
||||
|
||||
void VOIPConfigPanel::updateAvailableBW(double r)
|
||||
{
|
||||
std::cerr << "Setting max bandwidth to " << r << " KB/s" << std::endl;
|
||||
videoProcessor->setMaximumBandwidth((uint32_t)(r*1024)) ;
|
||||
}
|
||||
|
||||
void AudioInputConfig::togglePreview(bool b)
|
||||
void VOIPConfigPanel::togglePreview(bool b)
|
||||
{
|
||||
if(b)
|
||||
{
|
||||
@ -138,148 +202,98 @@ void AudioInputConfig::togglePreview(bool b)
|
||||
}
|
||||
}
|
||||
|
||||
AudioInputConfig::~AudioInputConfig()
|
||||
VOIPConfigPanel::~VOIPConfigPanel()
|
||||
{
|
||||
disconnect( qtTick, SIGNAL( timeout ( ) ), this, SLOT( on_Tick_timeout() ) );
|
||||
|
||||
graph_source->stop() ;
|
||||
graph_source->setVideoInput(NULL) ;
|
||||
|
||||
clearPipeline();
|
||||
}
|
||||
|
||||
void VOIPConfigPanel::clearPipeline()
|
||||
{
|
||||
delete qtTick;
|
||||
|
||||
graph_source->stop() ;
|
||||
graph_source->setVideoInput(NULL) ;
|
||||
graph_source=nullptr; // is deleted by setSource below. This is a bad design.
|
||||
|
||||
ui.voipBwGraph->setSource(nullptr);
|
||||
|
||||
std::cerr << "Deleting audioInputConfig object" << std::endl;
|
||||
if(videoInput != NULL)
|
||||
{
|
||||
videoInput->stop() ;
|
||||
delete videoInput ;
|
||||
|
||||
videoInput = nullptr;
|
||||
}
|
||||
delete videoProcessor;
|
||||
videoProcessor = nullptr;
|
||||
|
||||
if (inputAudioDevice) {
|
||||
inputAudioDevice->stop();
|
||||
delete inputAudioDevice ;
|
||||
inputAudioDevice = NULL ;
|
||||
inputAudioDevice = nullptr ;
|
||||
}
|
||||
|
||||
if(inputAudioProcessor)
|
||||
{
|
||||
delete inputAudioProcessor ;
|
||||
inputAudioProcessor = NULL ;
|
||||
inputAudioProcessor = nullptr ;
|
||||
}
|
||||
}
|
||||
|
||||
/** Loads the settings for this page */
|
||||
void AudioInputConfig::load()
|
||||
void VOIPConfigPanel::load()
|
||||
{
|
||||
//connect( ui.allowIpDeterminationCB, SIGNAL( toggled( bool ) ), this, SLOT( toggleIpDetermination(bool) ) );
|
||||
//connect( ui.allowTunnelConnectionCB, SIGNAL( toggled( bool ) ), this, SLOT( toggleTunnelConnection(bool) ) );
|
||||
|
||||
qtTick = new RsProtectedTimer(this);
|
||||
connect( qtTick, SIGNAL( timeout ( ) ), this, SLOT( on_Tick_timeout() ) );
|
||||
qtTick->start(20);
|
||||
/*if (AudioInputRegistrar::qmNew) {
|
||||
QList<QString> keys = AudioInputRegistrar::qmNew->keys();
|
||||
foreach(QString key, keys) {
|
||||
qcbSystem->addItem(key);
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
abSpeech = new AudioBar();
|
||||
abSpeech->qcBelow = Qt::red;
|
||||
abSpeech->qcInside = Qt::yellow;
|
||||
abSpeech->qcAbove = Qt::green;
|
||||
//abSpeech->setGeometry(9,20,50,10);
|
||||
ui.qwVadLayout_2->addWidget(abSpeech,0,0,1,0);
|
||||
|
||||
//on_qcbPushClick_clicked(g.s.bPushClick);
|
||||
//ui.on_Tick_timeout();
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
/** Loads the settings for this page */
|
||||
|
||||
void AudioInputConfig::loadSettings() {
|
||||
/*QList<QString> keys;
|
||||
void VOIPConfigPanel::loadSettings()
|
||||
{
|
||||
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());
|
||||
|
||||
if (AudioInputRegistrar::qmNew)
|
||||
keys=AudioInputRegistrar::qmNew->keys();
|
||||
else
|
||||
keys.clear();
|
||||
i=keys.indexOf(AudioInputRegistrar::current);
|
||||
if (i >= 0)
|
||||
loadComboBox(qcbSystem, i);
|
||||
if (rsVOIP->getVoipiNoiseSuppress() != 0)
|
||||
ui.qsNoise->setValue(-rsVOIP->getVoipiNoiseSuppress());
|
||||
else
|
||||
ui.qsNoise->setValue(14);
|
||||
|
||||
loadCheckBox(qcbExclusive, r.bExclusiveInput);*/
|
||||
on_qsNoise_valueChanged(-rsVOIP->getVoipiNoiseSuppress());
|
||||
|
||||
//qlePushClickPathOn->setText(r.qsPushClickOn);
|
||||
//qlePushClickPathOff->setText(r.qsPushClickOff);
|
||||
ui.qsAmp->setValue(20000 - rsVOIP->getVoipiMinLoudness());
|
||||
on_qsAmp_valueChanged(20000 - rsVOIP->getVoipiMinLoudness());
|
||||
|
||||
/*loadComboBox(qcbTransmit, r.atTransmit);
|
||||
loadSlider(qsTransmitHold, r.iVoiceHold);
|
||||
loadSlider(qsTransmitMin, iroundf(r.fVADmin * 32767.0f + 0.5f));
|
||||
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.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());
|
||||
else
|
||||
ui.qsNoise->setValue(14);
|
||||
|
||||
on_qsNoise_valueChanged(-rsVOIP->getVoipiNoiseSuppress());
|
||||
|
||||
ui.qsAmp->setValue(20000 - rsVOIP->getVoipiMinLoudness());
|
||||
on_qsAmp_valueChanged(20000 - rsVOIP->getVoipiMinLoudness());
|
||||
//loadSlider(qsIdle, r.iIdleTime);
|
||||
|
||||
/*int echo = 0;
|
||||
if (r.bEcho)
|
||||
echo = r.bEchoMulti ? 2 : 1;
|
||||
|
||||
loadComboBox(qcbEcho, echo);*/
|
||||
connect( ui.qsTransmitHold, SIGNAL( valueChanged ( int ) ), this, SLOT( on_qsTransmitHold_valueChanged(int) ) );
|
||||
connect( ui.qsNoise, SIGNAL( valueChanged ( int ) ), this, SLOT( on_qsNoise_valueChanged(int) ) );
|
||||
connect( ui.qsAmp, SIGNAL( valueChanged ( int ) ), this, SLOT( on_qsAmp_valueChanged(int) ) );
|
||||
connect( ui.qcbTransmit, SIGNAL( currentIndexChanged ( int ) ), this, SLOT( on_qcbTransmit_currentIndexChanged(int) ) );
|
||||
loaded = true;
|
||||
|
||||
std::cerr << "AudioInputConfig:: starting video." << std::endl;
|
||||
videoInput->start() ;
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
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());
|
||||
/*s.uiDoublePush = qsDoublePush->value() * 1000;*/
|
||||
rsVOIP->setVoipATransmit(static_cast<RsVOIP::enumAudioTransmit>(ui.qcbTransmit->currentIndex() ));
|
||||
rsVOIP->setVoipEchoCancel(ui.qcbEchoCancel->isChecked());
|
||||
bool VOIPConfigPanel::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());
|
||||
/*s.uiDoublePush = qsDoublePush->value() * 1000;*/
|
||||
rsVOIP->setVoipATransmit(static_cast<RsVOIP::enumAudioTransmit>(ui.qcbTransmit->currentIndex() ));
|
||||
rsVOIP->setVoipEchoCancel(ui.qcbEchoCancel->isChecked());
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void AudioInputConfig::on_qsTransmitHold_valueChanged(int v) {
|
||||
void VOIPConfigPanel::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);
|
||||
}
|
||||
|
||||
void AudioInputConfig::on_qsNoise_valueChanged(int v) {
|
||||
void VOIPConfigPanel::on_qsNoise_valueChanged(int v) {
|
||||
QPalette pal;
|
||||
|
||||
if (v < 15) {
|
||||
@ -292,19 +306,19 @@ void AudioInputConfig::on_qsNoise_valueChanged(int v) {
|
||||
rsVOIP->setVoipiNoiseSuppress(- ui.qsNoise->value());
|
||||
}
|
||||
|
||||
void AudioInputConfig::on_qsAmp_valueChanged(int v) {
|
||||
void VOIPConfigPanel::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());
|
||||
}
|
||||
|
||||
void AudioInputConfig::on_qcbEchoCancel_clicked() {
|
||||
void VOIPConfigPanel::on_qcbEchoCancel_clicked() {
|
||||
rsVOIP->setVoipEchoCancel(ui.qcbEchoCancel->isChecked());
|
||||
}
|
||||
|
||||
|
||||
void AudioInputConfig::on_qcbTransmit_currentIndexChanged(int v) {
|
||||
void VOIPConfigPanel::on_qcbTransmit_currentIndexChanged(int v) {
|
||||
switch (v) {
|
||||
case 0:
|
||||
ui.qswTransmit->setCurrentWidget(ui.qwContinuous);
|
||||
@ -321,34 +335,25 @@ void AudioInputConfig::on_qcbTransmit_currentIndexChanged(int v) {
|
||||
}
|
||||
|
||||
|
||||
void AudioInputConfig::on_Tick_timeout()
|
||||
void VOIPConfigPanel::on_Tick_timeout()
|
||||
{
|
||||
if (!inputAudioProcessor)
|
||||
{
|
||||
inputAudioProcessor = new QtSpeex::SpeexInputProcessor();
|
||||
inputAudioProcessor->open(QIODevice::WriteOnly | QIODevice::Unbuffered);
|
||||
// update the sound capture bar
|
||||
|
||||
if (!inputAudioDevice) {
|
||||
inputAudioDevice = AudioDeviceHelper::getPreferedInputDevice();
|
||||
}
|
||||
inputAudioDevice->start(inputAudioProcessor);
|
||||
connect(inputAudioProcessor, SIGNAL(networkPacketReady()), this, SLOT(emptyBuffer()));
|
||||
}
|
||||
ui.abSpeech->iBelow = ui.qsTransmitMin->value();
|
||||
ui.abSpeech->iAbove = ui.qsTransmitMax->value();
|
||||
|
||||
abSpeech->iBelow = ui.qsTransmitMin->value();
|
||||
abSpeech->iAbove = ui.qsTransmitMax->value();
|
||||
if (loaded) {
|
||||
rsVOIP->setVoipfVADmin(ui.qsTransmitMin->value());
|
||||
rsVOIP->setVoipfVADmax(ui.qsTransmitMax->value());
|
||||
}
|
||||
if (loaded) {
|
||||
rsVOIP->setVoipfVADmin(ui.qsTransmitMin->value());
|
||||
rsVOIP->setVoipfVADmax(ui.qsTransmitMax->value());
|
||||
}
|
||||
|
||||
abSpeech->iValue = iroundf(inputAudioProcessor->dVoiceAcivityLevel * 32767.0f + 0.5f);
|
||||
ui.abSpeech->iValue = iroundf(inputAudioProcessor->dVoiceAcivityLevel * 32767.0f + 0.5f);
|
||||
ui.abSpeech->update();
|
||||
|
||||
// also transmit encoded video
|
||||
|
||||
abSpeech->update();
|
||||
|
||||
// also transmit encoded video
|
||||
RsVOIPDataChunk chunk ;
|
||||
|
||||
|
||||
while((!videoInput->stopped()) && videoInput->getNextEncodedPacket(chunk))
|
||||
{
|
||||
videoProcessor->receiveEncodedData(chunk) ;
|
||||
@ -356,14 +361,103 @@ void AudioInputConfig::on_Tick_timeout()
|
||||
}
|
||||
}
|
||||
|
||||
void AudioInputConfig::emptyBuffer() {
|
||||
void VOIPConfigPanel::emptyBuffer() {
|
||||
while(inputAudioProcessor->hasPendingPackets()) {
|
||||
inputAudioProcessor->getNetworkPacket(); //that will purge the buffer
|
||||
}
|
||||
}
|
||||
|
||||
void AudioInputConfig::on_qpbAudioWizard_clicked() {
|
||||
void VOIPConfigPanel::on_qpbAudioWizard_clicked() {
|
||||
AudioWizard aw(this);
|
||||
aw.exec();
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
void VOIPConfigPanel::on_changedCurrentInputDevice(int i)
|
||||
{
|
||||
QString s = dynamic_cast<QComboBox*>(sender())->itemData(i).toString();
|
||||
|
||||
videoInput->stop();
|
||||
|
||||
// check that the camera still exists
|
||||
|
||||
QList<QString> input_devices;
|
||||
QVideoInputDevice::getAvailableDevices(input_devices);
|
||||
|
||||
for(const QString& cams:input_devices)
|
||||
if(s == cams)
|
||||
{
|
||||
std::cerr << "Switching to camera \"" << s.toStdString() << "\"" << std::endl;
|
||||
|
||||
videoInput->start(s);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// if not, re-create the ComboBox
|
||||
|
||||
checkAvailableCameras();
|
||||
}
|
||||
|
||||
void VOIPConfigPanel::checkAvailableCameras()
|
||||
{
|
||||
// save current camera
|
||||
QString current_cam = videoInput->currentCameraDescriptionString();
|
||||
|
||||
// Check that the list of cams we had previously is the same than the list of available camera.
|
||||
|
||||
QList<QString> input_devices;
|
||||
QVideoInputDevice::getAvailableDevices(input_devices);
|
||||
|
||||
bool same = true;
|
||||
if(input_devices.size() != ui.inputDevice_CB->count())
|
||||
same = false;
|
||||
|
||||
if(same)
|
||||
{
|
||||
int n=0;
|
||||
for(auto& s:input_devices)
|
||||
{
|
||||
if(ui.inputDevice_CB->itemData(n).toString() != s)
|
||||
{
|
||||
same = false;
|
||||
break;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
// If not, re-add them to the comboBox and make sure to re-select the same camera.
|
||||
|
||||
if(!same)
|
||||
{
|
||||
whileBlocking(ui.inputDevice_CB)->clear(); // remove existing entries
|
||||
whileBlocking(ui.inputDevice_CB)->addItem(tr("[No video]"),QString(""));
|
||||
int n=0;
|
||||
int found_index = -1;
|
||||
|
||||
for(auto& s:input_devices)
|
||||
{
|
||||
whileBlocking(ui.inputDevice_CB)->addItem(s,QVariant(s));
|
||||
|
||||
if(s == current_cam)
|
||||
found_index = n;
|
||||
|
||||
n++;
|
||||
}
|
||||
|
||||
if(found_index >= 0)
|
||||
ui.inputDevice_CB->setCurrentIndex(found_index);
|
||||
else
|
||||
ui.inputDevice_CB->setCurrentIndex(0); // no video
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <QAudioInput>
|
||||
#include <QWidget>
|
||||
@ -46,9 +45,9 @@ private:
|
||||
voipGraphSource *_src ;
|
||||
};
|
||||
|
||||
#include "ui_AudioInputConfig.h"
|
||||
#include "ui_VOIPConfigPanel.h"
|
||||
|
||||
class AudioInputConfig : public ConfigPage
|
||||
class VOIPConfigPanel : public ConfigPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -60,33 +59,37 @@ class AudioInputConfig : public ConfigPage
|
||||
//VideoDecoder *videoDecoder ;
|
||||
//VideoEncoder *videoEncoder ;
|
||||
QVideoInputDevice *videoInput ;
|
||||
VideoProcessor *videoProcessor ;
|
||||
VideoProcessor *videoProcessor ;
|
||||
bool loaded;
|
||||
QString currentCameraDescription;
|
||||
|
||||
voipGraphSource *graph_source ;
|
||||
|
||||
protected:
|
||||
QTimer *qtTick;
|
||||
/*void hideEvent(QHideEvent *event);
|
||||
void showEvent(QShowEvent *event);*/
|
||||
|
||||
void clearPipeline();
|
||||
public:
|
||||
/** Default Constructor */
|
||||
AudioInputConfig(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
||||
VOIPConfigPanel(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
||||
/** Default Destructor */
|
||||
~AudioInputConfig();
|
||||
~VOIPConfigPanel();
|
||||
|
||||
/** Saves the changes on this page */
|
||||
virtual bool save(QString &errmsg);
|
||||
virtual bool save(QString &errmsg)override ;
|
||||
/** Loads the settings for this page */
|
||||
virtual void load();
|
||||
virtual void load()override ;
|
||||
|
||||
virtual QPixmap iconPixmap() const { return QPixmap(":/images/talking_on.svg") ; }
|
||||
virtual QString pageName() const { return tr("VOIP") ; }
|
||||
virtual QString helpText() const { return ""; }
|
||||
virtual QPixmap iconPixmap() const override { return QPixmap(":/images/talking_on.svg") ; }
|
||||
virtual QString pageName() const override { return tr("VOIP") ; }
|
||||
virtual QString helpText() const override { return ""; }
|
||||
|
||||
virtual void showEvent(QShowEvent *) override;
|
||||
virtual void hideEvent(QHideEvent *event) override;
|
||||
private slots:
|
||||
void updateAvailableBW(double r);
|
||||
void on_changedCurrentInputDevice(int i);
|
||||
void checkAvailableCameras();
|
||||
void updateAvailableBW(double r);
|
||||
void loadSettings();
|
||||
void emptyBuffer();
|
||||
void togglePreview(bool) ;
|
@ -10,50 +10,289 @@
|
||||
<height>832</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="qpbAudioWizard">
|
||||
<property name="text">
|
||||
<string>Audio Wizard</string>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Video</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QVideoOutputDevice" name="videoDisplay">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>170</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="voipGraph" name="voipBwGraph">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Input device:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="inputDevice_CB"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Available bandwidth:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="availableBW_SB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Use this field to simulate the maximum bandwidth available so as to preview what the encoded video will look like with the corresponding compression rate.</p></body></html></string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>KB/s</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>2.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>200.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>30.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showEncoded_CB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Display encoded (and then decoded) frame, to check the codec's quality. If not selected, the image above only shows the frame that is grabbed from your camera.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>preview</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="qgbTransmission">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="qgbAudio">
|
||||
<property name="title">
|
||||
<string>Transmission</string>
|
||||
<string>Audio</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="qliTransmit">
|
||||
<property name="text">
|
||||
<string>&Transmit</string>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="qlNoise">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>qcbTransmit</cstring>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="qcbTransmit">
|
||||
<item>
|
||||
<widget class="QSlider" name="qsNoise">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>When to transmit your speech</string>
|
||||
<string>Noise suppression</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><b>This sets when speech should be transmitted.</b><br /><i>Continuous</i> - All the time<br /><i>Voice Activity</i> - When you are speaking clearly.<br /><i>Push To Talk</i> - When you hold down the hotkey set under <i>Shortcuts</i>.</string>
|
||||
<string><b>This sets the amount of noise suppression to apply.</b><br />The higher this value, the more aggressively stationary noise will be suppressed.</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>14</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>60</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<item>
|
||||
<widget class="QLabel" name="qliNoise">
|
||||
<property name="text">
|
||||
<string>Noise Suppression</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>qsNoise</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="qlAmp">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="qsAmp">
|
||||
<property name="toolTip">
|
||||
<string>Maximum amplification of input sound</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><b>Maximum amplification of input.</b><br />RetroShare normalizes the input volume before compressing, and this sets how much it's allowed to amplify.<br />The actual level is continually updated based on your current speech pattern, but it will never go above the level specified here.<br />If the <i>Microphone loudness</i> level of the audio statistics hover around 100%, you probably want to set this to 2.0 or so, but if, like most people, you are unable to reach 100%, set this to something much higher.<br />Ideally, set it so <i>Microphone Loudness * Amplification Factor >= 100</i>, even when you're speaking really soft.<br /><br />Note that there is no harm in setting this to maximum, but RetroShare will start picking up other conversations if you leave it to auto-tune to that level.</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>19500</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>500</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="qliAmp">
|
||||
<property name="text">
|
||||
<string>Amplification</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>qsAmp</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="qcbEchoCancel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Echo Cancellation Processing</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="qliTransmit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Transmit:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>qcbTransmit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="qcbTransmit">
|
||||
<property name="toolTip">
|
||||
<string>When to transmit your speech</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><b>This sets when speech should be transmitted.</b><br /><i>Continuous</i> - All the time<br /><i>Voice Activity</i> - When you are speaking clearly.<br /><i>Push To Talk</i> - When you hold down the hotkey set under <i>Shortcuts</i>.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="qpbAudioWizard">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Audio Wizard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="qswTransmit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="qwPTT">
|
||||
<layout class="QGridLayout">
|
||||
@ -231,218 +470,21 @@
|
||||
<widget class="QWidget" name="qwContinuous"/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="qgbAudio">
|
||||
<property name="title">
|
||||
<string>Audio Processing</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="qliNoise">
|
||||
<property name="text">
|
||||
<string>Noise Suppression</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>qsNoise</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSlider" name="qsNoise">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Noise suppression</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><b>This sets the amount of noise suppression to apply.</b><br />The higher this value, the more aggressively stationary noise will be suppressed.</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>14</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>60</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="qlNoise">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="qliAmp">
|
||||
<property name="text">
|
||||
<string>Amplification</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>qsAmp</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSlider" name="qsAmp">
|
||||
<property name="toolTip">
|
||||
<string>Maximum amplification of input sound</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><b>Maximum amplification of input.</b><br />RetroShare normalizes the input volume before compressing, and this sets how much it's allowed to amplify.<br />The actual level is continually updated based on your current speech pattern, but it will never go above the level specified here.<br />If the <i>Microphone loudness</i> level of the audio statistics hover around 100%, you probably want to set this to 2.0 or so, but if, like most people, you are unable to reach 100%, set this to something much higher.<br />Ideally, set it so <i>Microphone Loudness * Amplification Factor >= 100</i>, even when you're speaking really soft.<br /><br />Note that there is no harm in setting this to maximum, but RetroShare will start picking up other conversations if you leave it to auto-tune to that level.</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>19500</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>500</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="qlAmp">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="qcbEchoCancel">
|
||||
<property name="text">
|
||||
<string>Echo Cancellation Processing</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Video Processing</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QVideoOutputDevice" name="videoDisplay">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>170</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="voipGraph" name="voipBwGraph">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="AudioBar" name="abSpeech" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Available bandwidth:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="availableBW_SB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Use this field to simulate the maximum bandwidth available so as to preview what the encoded video will look like with the corresponding compression rate.</p></body></html></string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>KB/s</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>2.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>200.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>30.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showEncoded_CB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Display encoded (and then decoded) frame, to check the codec's quality. If not selected, the image above only shows the frame that is grabbed from your camera.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>preview</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>151</height>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@ -459,12 +501,17 @@
|
||||
<customwidget>
|
||||
<class>voipGraph</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>gui/AudioInputConfig.h</header>
|
||||
<header>gui/VOIPConfigPanel.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AudioBar</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/AudioStats.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>qcbTransmit</tabstop>
|
||||
<tabstop>qsDoublePush</tabstop>
|
||||
<tabstop>qsTransmitHold</tabstop>
|
||||
<tabstop>qsTransmitMin</tabstop>
|
Loading…
x
Reference in New Issue
Block a user