diff --git a/plugins/VOIP/gui/QVideoDevice.cpp b/plugins/VOIP/gui/QVideoDevice.cpp index 1e81841b8..9052c5306 100644 --- a/plugins/VOIP/gui/QVideoDevice.cpp +++ b/plugins/VOIP/gui/QVideoDevice.cpp @@ -71,14 +71,34 @@ void QVideoInputDevice::stop() _image_capture = NULL ; } } -void QVideoInputDevice::start() +void QVideoInputDevice::getAvailableDevices(QList& device_desc) +{ + device_desc.clear(); + + QList 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 - QCameraInfo caminfo = QCameraInfo::defaultCamera(); + QCameraInfo caminfo ; + + if(description.isNull()) + caminfo = QCameraInfo::defaultCamera(); + else + { + auto cam_list = QCameraInfo::availableCameras(); + + for(auto& s:cam_list) + if(s.deviceName() == description) + caminfo = s; + } if(caminfo.isNull()) { diff --git a/plugins/VOIP/gui/QVideoDevice.h b/plugins/VOIP/gui/QVideoDevice.h index 40c606f37..f23fd8aa5 100644 --- a/plugins/VOIP/gui/QVideoDevice.h +++ b/plugins/VOIP/gui/QVideoDevice.h @@ -49,7 +49,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,7 +71,7 @@ class QVideoInputDevice: public QObject // control - void start() ; + void start(const QString &description = QString()) ; void stop() ; bool stopped(); @@ -81,6 +81,10 @@ class QVideoInputDevice: public QObject 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& device_desc); + protected slots: void grabFrame(int id, QVideoFrame f) ; void errorHandling(CameraStatus status,QCamera::Error error); diff --git a/plugins/VOIP/gui/VOIPConfigPanel.cpp b/plugins/VOIP/gui/VOIPConfigPanel.cpp index 3fbd9e895..5b93db0cd 100644 --- a/plugins/VOIP/gui/VOIPConfigPanel.cpp +++ b/plugins/VOIP/gui/VOIPConfigPanel.cpp @@ -101,10 +101,17 @@ VOIPConfigPanel::VOIPConfigPanel(QWidget * parent, Qt::WindowFlags flags) ui.abSpeech->qcInside = Qt::yellow; ui.abSpeech->qcAbove = Qt::green; + QList input_devices; + QVideoInputDevice::getAvailableDevices(input_devices); + ui.inputDevice_CB->clear(); + for(auto& s:input_devices) + ui.inputDevice_CB->addItem(s,QVariant(s)); + 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 *) diff --git a/plugins/VOIP/gui/VOIPConfigPanel.ui b/plugins/VOIP/gui/VOIPConfigPanel.ui index 3687dbb89..178436808 100644 --- a/plugins/VOIP/gui/VOIPConfigPanel.ui +++ b/plugins/VOIP/gui/VOIPConfigPanel.ui @@ -10,48 +10,287 @@ 832 - + - - - Audio Wizard + + + Video + + + + + + + + 170 + 128 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + + Input device: + + + + + + + + + + + 0 + 0 + + + + Available bandwidth: + + + + + + + <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> + + + KB/s + + + 1 + + + 2.000000000000000 + + + 200.000000000000000 + + + 30.000000000000000 + + + + + + + + 0 + 0 + + + + <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> + + + preview + + + + + + - - - - 0 - 0 - - + - Transmission + Audio - - - - - &Transmit + + + + + + 30 + 0 + - - qcbTransmit + + - - + + + + true + - When to transmit your speech + Noise suppression - <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>. + <b>This sets the amount of noise suppression to apply.</b><br />The higher this value, the more aggressively stationary noise will be suppressed. + + + 14 + + + 60 + + + 5 + + + Qt::Horizontal - + + + + Noise Suppression + + + qsNoise + + + + + + + + 30 + 0 + + + + + + + + + + + Maximum amplification of input sound + + + <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. + + + 19500 + + + 500 + + + 2000 + + + Qt::Horizontal + + + + + + + Amplification + + + qsAmp + + + + + + + + + + 0 + 0 + + + + Echo Cancellation Processing + + + false + + + + + + + + + + 0 + 0 + + + + &Transmit: + + + qcbTransmit + + + + + + + When to transmit your speech + + + <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>. + + + + + + + + + + 0 + 0 + + + + Audio Wizard + + + + + + + + + 0 + 0 + + 1 @@ -231,221 +470,21 @@ - - - - - - - - - Audio - - - - - - - 30 - 0 - - - - - - - - - - - Amplification - - - qsAmp - - - - - - - - 30 - 0 - - - - - - - - - - - true - - - Noise suppression - - - <b>This sets the amount of noise suppression to apply.</b><br />The higher this value, the more aggressively stationary noise will be suppressed. - - - 14 - - - 60 - - - 5 - - - Qt::Horizontal - - - - - - - Echo Cancellation Processing - - - false - - - - - - - Noise Suppression - - - qsNoise - - - - - - - Maximum amplification of input sound - - - <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. - - - 19500 - - - 500 - - - 2000 - - - Qt::Horizontal - - - - - - - - - - - - - - - Video - - - - - - 170 - 128 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - + - - - - - Available bandwidth: - - - - - - - <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> - - - KB/s - - - 1 - - - 2.000000000000000 - - - 200.000000000000000 - - - 30.000000000000000 - - - - - - - - - <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> - - - preview - - - - - + Qt::Vertical - 1 - 151 + 20 + 40 @@ -473,7 +512,6 @@ - qcbTransmit qsDoublePush qsTransmitHold qsTransmitMin